22
33from mamonsu .plugins .pgsql .plugin import PgsqlPlugin as Plugin
44from distutils .version import LooseVersion
5- import mamonsu .lib .platform as platform
65from .pool import Pooler
76
87
@@ -24,12 +23,6 @@ class Connections(Plugin):
2423 'number of disabled' ,
2524 '00CCCC' )
2625 ]
27- # ( key, name, graph)
28- Item_ppid_children = [
29- ('pgsql.count_all_pids{0}' ,
30- 'Number of PostgreSQL parent pid children' ,
31- ('PostgreSQL: count children of PostgreSQL parent pid' , 'BBB000' , 0 )),
32- ]
3326 Max_connections = None
3427
3528 query_agent = "select count(*) from pg_catalog.pg_stat_activity where state = '{0}';"
@@ -82,12 +75,6 @@ def run(self, zbx):
8275 self .Max_connections = result [0 ][0 ]
8376 zbx .send ('pgsql.connections[max_connections]' , int (self .Max_connections ))
8477
85- # get number of child pids of ppid
86- if platform .LINUX :
87- num_of_children_pids = self .get_num_of_children_pids ()
88- key = self .Item_ppid_children [0 ][0 ].format ('[]' )
89- zbx .send (key , num_of_children_pids + 1 )
90-
9178 def items (self , template ):
9279 result = template .item ({
9380 'name' : 'PostgreSQL: number of total connections' ,
@@ -111,11 +98,6 @@ def items(self, template):
11198 'key' : self .right_type (self .key , item [1 ]),
11299 'delay' : self .plugin_config ('interval' )
113100 })
114- result += template .item ({
115- 'name' : 'PostgreSQL: number of child pids' ,
116- 'key' : self .right_type (self .Item_ppid_children [0 ][0 ]),
117- 'delay' : self .plugin_config ('interval' )
118- })
119101 return result
120102
121103 def graphs (self , template ):
@@ -137,10 +119,6 @@ def graphs(self, template):
137119 'key' : self .right_type (self .key , "max_connections" ),
138120 'color' : '00BB00'
139121 })
140- items .append ({
141- 'key' : self .right_type (self .Item_ppid_children [0 ][0 ]),
142- 'color' : '0BB000'
143- })
144122 graph = {'name' : 'PostgreSQL connections' , 'items' : items }
145123 return template .graph (graph )
146124
0 commit comments