@@ -56,8 +56,18 @@ class Instance(Plugin):
5656 ('PostgreSQL instance: tuples' , 'CC0000' , 0 ),
5757 Plugin .UNITS .none , Plugin .DELTA .speed_per_second ),
5858 ]
59+ Items_pg_12 = [
60+ # key, zbx_key, description,
61+ # ('graph name', color, side), units, delta
62+ ('checksum_failures' , 'events[checksum_failures]' , 'event: checksum_failures' ,
63+ ('PostgreSQL instance: events' , '00FF00' , 0 ),
64+ Plugin .UNITS .none , Plugin .DELTA .simple_change )
65+ ]
5966
6067 def run (self , zbx ):
68+ if Pooler .server_version_greater ('12.0' ):
69+ self .Items .extend (self .Items_pg_12 )
70+
6171 params = ['sum({0}) as {0}' .format (x [0 ]) for x in self .Items ]
6272 result = Pooler .query ('select {0} from \
6373 pg_catalog.pg_stat_database' .format (
@@ -70,7 +80,7 @@ def run(self, zbx):
7080
7181 def items (self , template ):
7282 result = ''
73- for num , item in enumerate (self .Items ):
83+ for num , item in enumerate (self .Items + self . Items_pg_12 ):
7484 if self .Type == "mamonsu" :
7585 delta = Plugin .DELTA .as_is
7686 else :
@@ -96,7 +106,7 @@ def graphs(self, template):
96106 result = ''
97107 for name in graphs_name :
98108 items = []
99- for num , item in enumerate (self .Items ):
109+ for num , item in enumerate (self .Items + self . Items_pg_12 ):
100110 if item [3 ][0 ] == name :
101111 # split each item to get values for keys of both agent type and mamonsu type
102112 keys = item [1 ].split ('[' )
@@ -112,7 +122,7 @@ def graphs(self, template):
112122
113123 def keys_and_queries (self , template_zabbix ):
114124 result = []
115- for item in self .Items :
125+ for item in ( self .Items + self . Items_pg_12 ) :
116126 # split each item to get values for keys of both agent type and mamonsu type
117127 keys = item [1 ].split ('[' )
118128 result .append ('{0}[*],$2 $1 -c "{1}"' .format ('{0}{1}.{2}' .format (self .key , keys [0 ], keys [1 ][:- 1 ]),
0 commit comments