@@ -37,13 +37,6 @@ class Databases(Plugin):
37
37
AND l.relation IS NULL;
38
38
"""
39
39
40
- # PG 14+ queries
41
- query_sessions = """
42
- SELECT {0}
43
- FROM pg_catalog.pg_stat_database
44
- WHERE datname = '{1}';
45
- """
46
-
47
40
# queries for zabbix agent
48
41
query_agent_discovery = """
49
42
SELECT json_build_object ('data',json_agg(json_build_object('{#DATABASE}',d.datname)))
@@ -60,15 +53,6 @@ class Databases(Plugin):
60
53
key_autovacumm = "pgsql.autovacumm.count{0}"
61
54
key_invalid_indexes = "pgsql.database.invalid_indexes{0}"
62
55
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
-
72
56
DEFAULT_CONFIG = {
73
57
"min_rows" : str (50 ),
74
58
"bloat_scale" : str (0.2 )
@@ -94,12 +78,6 @@ def run(self, zbx):
94
78
zbx .send ("pgsql.database.bloating_tables[{0}]" .format (info [0 ]), int (bloat_count ))
95
79
invalid_indexes_count = Pooler .query (self .query_invalid_indexes , info [0 ])[0 ][0 ]
96
80
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
-
103
81
zbx .send ("pgsql.database.discovery[]" , zbx .json ({"data" : dbs }))
104
82
del dbs , bloat_count , invalid_indexes_count
105
83
@@ -173,17 +151,6 @@ def discovery_rules(self, template, dashboard=False):
173
151
"name" : "PostgreSQL Databases: Count of Invalid Indexes in {#DATABASE}" ,
174
152
"delay" : self .plugin_config ("interval" )}
175
153
]
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
-
187
154
graphs = [{
188
155
"name" : "PostgreSQL Databases: {#DATABASE} size" ,
189
156
"type" : 1 ,
0 commit comments