@@ -37,13 +37,6 @@ class Databases(Plugin):
3737 AND l.relation IS NULL;
3838 """
3939
40- # PG 14+ queries
41- query_sessions = """
42- SELECT {0}
43- FROM pg_catalog.pg_stat_database
44- WHERE datname = '{1}';
45- """
46-
4740 # queries for zabbix agent
4841 query_agent_discovery = """
4942 SELECT json_build_object ('data',json_agg(json_build_object('{#DATABASE}',d.datname)))
@@ -60,15 +53,6 @@ class Databases(Plugin):
6053 key_autovacumm = "pgsql.autovacumm.count{0}"
6154 key_invalid_indexes = "pgsql.database.invalid_indexes{0}"
6255
63- # PG 14+ keys
64- key_db_sessions = [("sessions" , "pgsql.database.sessions[{0}]" , "Total Number of Sessions" , Plugin .UNITS .none , Plugin .VALUE_TYPE .numeric_unsigned ),
65- ("sessions_abandoned" , "pgsql.database.sessions_abandoned[{0}]" , "Client Lost Connection Terminated Sessions" , Plugin .UNITS .none , Plugin .VALUE_TYPE .numeric_unsigned ),
66- ("sessions_fatal" , "pgsql.database.sessions_fatal[{0}]" , "Fatal Errors Terminated Sessions" , Plugin .UNITS .none , Plugin .VALUE_TYPE .numeric_unsigned ),
67- ("sessions_killed" , "pgsql.database.sessions_killed[{0}]" , "Operator Intervention Terminated Sessions" , Plugin .UNITS .none , Plugin .VALUE_TYPE .numeric_unsigned ),
68- ("session_time" , "pgsql.database.session_time[{0}]" , "Time Spent by Sessions" , Plugin .UNITS .ms , Plugin .VALUE_TYPE .numeric_float ),
69- ("active_time" , "pgsql.database.active_time[{0}]" , "Time Spent Executing SQL Statements" , Plugin .UNITS .ms , Plugin .VALUE_TYPE .numeric_float ),
70- ("idle_in_transaction_time" , "pgsql.database.idle_in_transaction_time[{0}]" , "Time Spent Idling While in a Transaction" , Plugin .UNITS .ms , Plugin .VALUE_TYPE .numeric_float )]
71-
7256 DEFAULT_CONFIG = {
7357 "min_rows" : str (50 ),
7458 "bloat_scale" : str (0.2 )
@@ -94,12 +78,6 @@ def run(self, zbx):
9478 zbx .send ("pgsql.database.bloating_tables[{0}]" .format (info [0 ]), int (bloat_count ))
9579 invalid_indexes_count = Pooler .query (self .query_invalid_indexes , info [0 ])[0 ][0 ]
9680 zbx .send ("pgsql.database.invalid_indexes[{0}]" .format (info [0 ]), int (invalid_indexes_count ))
97-
98- if Pooler .server_version_greater ("14" ):
99- for session_item in self .key_db_sessions :
100- session_result = Pooler .query (self .query_sessions .format (session_item [0 ], info [0 ]), info [0 ])[0 ][0 ]
101- zbx .send (session_item [1 ].format (info [0 ]), int (session_result ))
102-
10381 zbx .send ("pgsql.database.discovery[]" , zbx .json ({"data" : dbs }))
10482 del dbs , bloat_count , invalid_indexes_count
10583
@@ -173,17 +151,6 @@ def discovery_rules(self, template, dashboard=False):
173151 "name" : "PostgreSQL Databases: Count of Invalid Indexes in {#DATABASE}" ,
174152 "delay" : self .plugin_config ("interval" )}
175153 ]
176-
177- if Pooler .server_version_greater ("14" ):
178- for session_item in self .key_db_sessions :
179- items .append ({
180- "key" : self .right_type (session_item [1 ], var_discovery = "{#DATABASE}," ),
181- "name" : "PostgreSQL Databases {{#DATABASE}}: {0}" .format (session_item [2 ]),
182- "units" : session_item [3 ],
183- "value_type" : session_item [4 ],
184- "delay" : self .plugin_config ("interval" )
185- })
186-
187154 graphs = [{
188155 "name" : "PostgreSQL Databases: {#DATABASE} size" ,
189156 "type" : 1 ,
0 commit comments