Skip to content

Commit 18e03ee

Browse files
committedMay 19, 2021
Merge branch 'dev'
2 parents f98984f + 471db70 commit 18e03ee

File tree

11 files changed

+84
-56
lines changed

11 files changed

+84
-56
lines changed
 

‎mamonsu/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__author__ = 'Dmitry Vasilyev'
22
__author_email__ = 'info@postgrespro.ru'
33
__description__ = 'Monitoring agent for PostgreSQL'
4-
__version__ = '2.7.0'
4+
__version__ = '2.7.1'
55
__licence__ = 'BSD'
66

77
__url__ = 'https://github.com/postgrespro/mamonsu'

‎mamonsu/plugins/pgsql/connections.py

-22
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from mamonsu.plugins.pgsql.plugin import PgsqlPlugin as Plugin
44
from distutils.version import LooseVersion
5-
import mamonsu.lib.platform as platform
65
from .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

‎mamonsu/plugins/pgsql/plugin.py

-22
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,6 @@ def check(self, extension):
3434

3535
return self._ext_installed
3636

37-
@staticmethod
38-
def get_num_of_children_pids():
39-
result = Pooler.query("SELECT pg_backend_pid();")
40-
child_pid = result[0][0]
41-
try:
42-
parent_pid = subprocess.check_output(['ps', '-oppid', '--no-headers', '--pid', str(child_pid)],
43-
stderr=subprocess.PIPE, encoding='utf8')
44-
except subprocess.CalledProcessError:
45-
raise PluginDisableException("Unable to get parent process for {0} pid.".format(child_pid))
46-
47-
parent_pid = int(parent_pid.split("\n")[0])
48-
try:
49-
child_pids = subprocess.check_output(['ps', '-opid', '--no-headers', '--ppid', str(parent_pid)],
50-
stderr=subprocess.PIPE, encoding='utf8')
51-
except subprocess.CalledProcessError:
52-
raise PluginDisableException("Unable to get children processes for {0} pid.".format(child_pid))
53-
# we want to return number of ALL PostgreSQL processes meaning parent pid + count(children pids)
54-
# len of the splitted result has extra blank line in the end so we return just the length of
55-
# splitted child pids output
56-
count_child_pids = len(child_pids.split("\n"))
57-
return count_child_pids
58-
5937
def disable_and_exit_if_extension_is_not_installed(self, ext, db=None):
6038
if not self.extension_installed(ext, db=db, silent=True):
6139
self.disable()

‎packaging/conf/old_templates/template_2.7.1.xml

+30
Large diffs are not rendered by default.

‎packaging/conf/old_templates/template_agent_2.7.1.xml

+30
Large diffs are not rendered by default.

‎packaging/conf/template.xml

+4-4
Large diffs are not rendered by default.

‎packaging/conf/template_agent.xml

+4-4
Large diffs are not rendered by default.

‎packaging/debian/changelog

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
mamonsu (2.7.1-1) stable; urgency=low
2+
* rm metric to count children of PostgreSQL parent pid
3+
14
mamonsu (2.7.0-1) stable; urgency=low
25
* update bootstrap
36
* fix ArchiveCommand plugin

‎packaging/rpm/SPECS/mamonsu.alt.spec

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
33

44
Name: mamonsu
5-
Version: 2.7.0
5+
Version: 2.7.1
66
Release: 1%{?dist}
77
Summary: Monitoring agent for PostgreSQL
88
Group: Applications/Internet
@@ -73,6 +73,9 @@ chown mamonsu.mamonsu /var/log/mamonsu
7373
/sbin/chkconfig --del mamonsu
7474

7575
%changelog
76+
* Wed May 19 2021 Daria Vilkova <d.vilkova@postgrespro.ru> - 2.7.1-1
77+
- rm metric to count children of PostgreSQL parent pid
78+
7679
* Mon Apr 26 2021 Daria Vilkova <d.vilkova@postgrespro.ru> - 2.7.0-1
7780
- update bootstrap
7881
- fix ArchiveCommand plugin

‎packaging/rpm/SPECS/mamonsu.spec

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: mamonsu
2-
Version: 2.7.0
2+
Version: 2.7.1
33
Release: 1%{?dist}
44
Summary: Monitoring agent for PostgreSQL
55
Group: Applications/Internet
@@ -70,6 +70,9 @@ chown mamonsu.mamonsu /var/log/mamonsu
7070
/sbin/chkconfig --del mamonsu
7171

7272
%changelog
73+
* Wed May 19 2021 Daria Vilkova <d.vilkova@postgrespro.ru> - 2.7.1-1
74+
- rm metric to count children of PostgreSQL parent pid
75+
7376
* Mon Apr 26 2021 Daria Vilkova <d.vilkova@postgrespro.ru> - 2.7.0-1
7477
- update bootstrap
7578
- fix ArchiveCommand plugin

‎packaging/rpm/SPECS/mamonsu.suse.spec

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%define _datarootdir %{_prefix}/share
22
Name: mamonsu
3-
Version: 2.7.0
3+
Version: 2.7.1
44
Release: 1%{?dist}
55
Summary: Monitoring agent for PostgreSQL
66
Group: Applications/Internet
@@ -74,6 +74,9 @@ chown mamonsu.mamonsu /var/log/mamonsu
7474
/sbin/chkconfig --del mamonsu
7575

7676
%changelog
77+
* Wed May 19 2021 Daria Vilkova <d.vilkova@postgrespro.ru> - 2.7.1-1
78+
- rm metric to count children of PostgreSQL parent pid
79+
7780
* Mon Apr 26 2021 Daria Vilkova <d.vilkova@postgrespro.ru> - 2.7.0-1
7881
- update bootstrap
7982
- fix ArchiveCommand plugin

0 commit comments

Comments
 (0)
Please sign in to comment.