@@ -89,51 +89,51 @@ const (
8989 TO {{.pooler_user}};
9090 GRANT USAGE ON SCHEMA {{.pooler_schema}} TO {{.pooler_user}};
9191 `
92- CPOmonitoring = `
93- GRANT pg_monitor TO cpo_exporter;
94- GRANT SELECT ON TABLE pg_authid TO cpo_exporter;
95-
96- CREATE SCHEMA IF NOT EXISTS exporter;
97- ALTER SCHEMA exporter OWNER TO cpo_exporter;
98- CREATE EXTENSION IF NOT EXISTS pgnodemx with SCHEMA exporter;
99- alter extension pgnodemx UPDATE;
100- CREATE TABLE IF NOT EXISTS exporter.pgbackrestbackupinfo (
101- data jsonb NOT NULL,
102- data_time timestamp with time zone DEFAULT now() NOT NULL
103- )
104- WITH (autovacuum_analyze_scale_factor='0', autovacuum_vacuum_scale_factor='0', autovacuum_vacuum_threshold='2', autovacuum_analyze_threshold='2');
105- ALTER TABLE exporter.pgbackrestbackupinfo OWNER TO cpo_exporter;
106-
107- GRANT pg_execute_server_program TO cpo_exporter;
108-
109- CREATE OR REPLACE FUNCTION exporter.update_pgbackrest_info()
110- RETURNS VOID AS $$
111- DECLARE
112- last_entry_timestamp TIMESTAMP;
113- record_count INT;
114- BEGIN
115- SELECT COUNT(*) INTO record_count
116- FROM exporter.pgbackrestbackupinfo;
117-
118- IF record_count > 0 THEN
119- SELECT data_time INTO last_entry_timestamp
120- FROM exporter.pgbackrestbackupinfo
121- ORDER BY data_time DESC
122- LIMIT 1;
123-
124- IF last_entry_timestamp < NOW() - INTERVAL '5 minutes' THEN
125- DELETE FROM exporter.pgbackrestbackupinfo;
126- ELSE
127- RETURN;
128- END IF;
129- END IF;
130-
131- EXECUTE format(
132- 'COPY exporter.pgbackrestbackupinfo (data) FROM program ''pgbackrest info --output=json'' WITH (FORMAT text, DELIMITER ''|'')'
133- );
134- END;
135- $$ LANGUAGE plpgsql;
136- `
92+ // CPOmonitoring = `
93+ // GRANT pg_monitor TO cpo_exporter;
94+ // GRANT SELECT ON TABLE pg_authid TO cpo_exporter;
95+
96+ // CREATE SCHEMA IF NOT EXISTS exporter;
97+ // ALTER SCHEMA exporter OWNER TO cpo_exporter;
98+ // CREATE EXTENSION IF NOT EXISTS pgnodemx with SCHEMA exporter;
99+ // alter extension pgnodemx UPDATE;
100+ // CREATE TABLE IF NOT EXISTS exporter.pgbackrestbackupinfo (
101+ // data jsonb NOT NULL,
102+ // data_time timestamp with time zone DEFAULT now() NOT NULL
103+ // )
104+ // WITH (autovacuum_analyze_scale_factor='0', autovacuum_vacuum_scale_factor='0', autovacuum_vacuum_threshold='2', autovacuum_analyze_threshold='2');
105+ // ALTER TABLE exporter.pgbackrestbackupinfo OWNER TO cpo_exporter;
106+
107+ // GRANT pg_execute_server_program TO cpo_exporter;
108+
109+ // CREATE OR REPLACE FUNCTION exporter.update_pgbackrest_info()
110+ // RETURNS VOID AS $$
111+ // DECLARE
112+ // last_entry_timestamp TIMESTAMP;
113+ // record_count INT;
114+ // BEGIN
115+ // SELECT COUNT(*) INTO record_count
116+ // FROM exporter.pgbackrestbackupinfo;
117+
118+ // IF record_count > 0 THEN
119+ // SELECT data_time INTO last_entry_timestamp
120+ // FROM exporter.pgbackrestbackupinfo
121+ // ORDER BY data_time DESC
122+ // LIMIT 1;
123+
124+ // IF last_entry_timestamp < NOW() - INTERVAL '5 minutes' THEN
125+ // DELETE FROM exporter.pgbackrestbackupinfo;
126+ // ELSE
127+ // RETURN;
128+ // END IF;
129+ // END IF;
130+
131+ // EXECUTE format(
132+ // 'COPY exporter.pgbackrestbackupinfo (data) FROM program ''pgbackrest info --output=json'' WITH (FORMAT text, DELIMITER ''|'')'
133+ // );
134+ // END;
135+ // $$ LANGUAGE plpgsql;
136+ // `
137137 cpoMonitoring = `
138138 GRANT pg_monitor TO cpo_exporter;
139139 GRANT SELECT ON TABLE pg_authid TO cpo_exporter;
0 commit comments