Skip to content

Commit 0656479

Browse files
committed
Merge branch 'dev'
2 parents f569a8e + 63c2887 commit 0656479

File tree

12 files changed

+50
-45
lines changed

12 files changed

+50
-45
lines changed

.github/workflows/mamonsu-tests-dev.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
- docker_os: 'centos:8'
3434
pg_version: '16'
3535
zabbix_version: '6.2.9'
36+
- docker_os: 'centos:8'
37+
pg_version: '16'
38+
zabbix_version: '6.4.13'
3639
exclude:
3740
- docker_os: 'centos:8'
3841
pg_version: '12'
@@ -74,7 +77,7 @@ jobs:
7477
echo "zabbix_address=$(hostname -I | awk '{print $1}')" >> $GITHUB_OUTPUT
7578
id: zabbix_address
7679
- name: Edit Zabbix address in agent.conf
77-
run: sed -i "s/\(address *= *\).*/\1 ${{ steps.zabbix_address.outputs.zabbix_address }}/" ${{ env.MAMONSU_PATH }}/github-actions-tests/sources/agent_3.5.6.conf
80+
run: sed -i "s/\(address *= *\).*/\1 ${{ steps.zabbix_address.outputs.zabbix_address }}/" ${{ env.MAMONSU_PATH }}/github-actions-tests/sources/agent_3.5.7.conf
7881

7982
- name: Copy test scripts to container
8083
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) mkdir -p -m 755 /mamonsu/

.github/workflows/mamonsu-tests-master.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ jobs:
3333
- docker_os: 'centos:8'
3434
pg_version: '16'
3535
zabbix_version: '6.2.9'
36+
- docker_os: 'centos:8'
37+
pg_version: '16'
38+
zabbix_version: '6.4.13'
39+
- docker_os: 'ubuntu:20.04'
40+
pg_version: '16'
41+
zabbix_version: '6.4.13'
42+
- docker_os: 'ubuntu:20.04'
43+
pg_version: '15'
44+
zabbix_version: '6.4.13'
3645
exclude:
3746
# excludes PG 15, 16 on CentOS
3847
- docker_os: 'centos:7'
@@ -79,7 +88,7 @@ jobs:
7988
echo "zabbix_address=$(hostname -I | awk '{print $1}')" >> $GITHUB_OUTPUT
8089
id: zabbix_address
8190
- name: Edit Zabbix address in agent.conf
82-
run: sed -i "s/\(address *= *\).*/\1 ${{ steps.zabbix_address.outputs.zabbix_address }}/" ${{ env.MAMONSU_PATH }}/github-actions-tests/sources/agent_3.5.6.conf
91+
run: sed -i "s/\(address *= *\).*/\1 ${{ steps.zabbix_address.outputs.zabbix_address }}/" ${{ env.MAMONSU_PATH }}/github-actions-tests/sources/agent_3.5.7.conf
8392

8493
- name: Copy test scripts to container
8594
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) mkdir -p -m 755 /mamonsu/

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Supported platforms:
1717
- FreeBSD;
1818
- Windows;
1919

20-
Supported Zabbix server versions: 3.0 - 6.0
21-
Supported PostgreSQL versions: 9.5 - 14
20+
Supported Zabbix server versions: 4.0.44 - 6.4.13
21+
Supported PostgreSQL versions: 12 - 16
2222
***
2323

2424
***Table of Contents***

github-actions-tests/mamonsu_build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ if [ "${OS%:*}" = "centos" ]; then
4141
python3 setup.py build && python3 setup.py install
4242
make rpm
4343
sudo rpm -i ./mamonsu*.rpm
44-
cat /mamonsu/github-actions-tests/sources/agent_3.5.6.conf > /etc/mamonsu/agent.conf
44+
cat /mamonsu/github-actions-tests/sources/agent_3.5.7.conf > /etc/mamonsu/agent.conf
4545
systemctl daemon-reload
4646
systemctl restart mamonsu
4747
sleep 5
@@ -64,7 +64,7 @@ elif [ "${OS%:*}" = "ubuntu" ]; then
6464
python3 setup.py build && python3 setup.py install
6565
make deb
6666
sudo dpkg -i ./mamonsu*.deb
67-
cat /mamonsu/github-actions-tests/sources/agent_3.5.6.conf > /etc/mamonsu/agent.conf
67+
cat /mamonsu/github-actions-tests/sources/agent_3.5.7.conf > /etc/mamonsu/agent.conf
6868
service mamonsu restart
6969
sleep 5
7070
echo && echo && echo "mamonsu version:"

mamonsu/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__author__ = 'Dmitry Vasilyev'
22
__author_email__ = '[email protected]'
33
__description__ = 'Monitoring agent for PostgreSQL'
4-
__version__ = '3.5.6'
4+
__version__ = '3.5.7'
55
__licence__ = 'BSD'
66

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

mamonsu/plugins/pgsql/connections.py

+7-10
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ class Connections(Plugin):
3737
WHERE (backend_type NOT IN ('{0}'));
3838
""".format("', '".join(default_backend_types))
3939

40-
Max_connections = None
41-
4240
query_agent = """
4341
SELECT count(*)
4442
FROM pg_catalog.pg_stat_activity
@@ -125,14 +123,13 @@ def run(self, zbx):
125123
"(backend_type = 'client backend' OR backend_type = 'parallel worker')" if Pooler.server_version_greater(
126124
"10.0") else "state IS NOT NULL"))
127125
zbx.send("pgsql.connections[waiting]", int(result[0][0]))
128-
if self.Max_connections is None:
129-
result = Pooler.query("""
130-
SELECT setting
131-
FROM pg_settings
132-
WHERE name = 'max_connections';
133-
""")
134-
self.Max_connections = result[0][0]
135-
zbx.send("pgsql.connections[max_connections]", int(self.Max_connections))
126+
127+
result = Pooler.query("""
128+
SELECT setting
129+
FROM pg_settings
130+
WHERE name = 'max_connections';
131+
""")
132+
zbx.send("pgsql.connections[max_connections]", int(result[0][0]))
136133

137134
if Pooler.server_version_greater("10.0"):
138135
result = Pooler.query(self.query_other_connections)

mamonsu/tools/zabbix_cli/request.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from collections import OrderedDict
66

77

8+
from distutils.version import LooseVersion
89
import urllib.request as urllib2
910

1011

@@ -13,20 +14,22 @@ class Request(object):
1314
def __init__(self, url, user, passwd):
1415
self._url, self._user, self._passwd = url, user, passwd
1516
self._id, self._auth_tocken = 0, None
16-
17+
self._api_version = self.post(method='apiinfo.version', params=[])
18+
1719
def set_user(self, user):
1820
self._user=user
19-
21+
2022
def set_passwd(self, passwd):
2123
self._passwd=passwd
22-
24+
2325
def _auth(self):
2426
if self._auth_tocken is None:
2527
if not self._user:
2628
return None
29+
user_field = 'user' if LooseVersion(self._api_version) < LooseVersion('6.4') else 'username'
2730
self._auth_tocken = self.post(
2831
'user.login',
29-
{'user': self._user, 'password': self._passwd})
32+
{user_field: self._user, 'password': self._passwd})
3033
return self._auth_tocken
3134

3235
def _get_id(self):

packaging/debian/changelog

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
mamonsu (3.5.7-1) stable; urgency=low
2+
* added support for Zabbix 6.4 API: handle deprecated parameters for auth request;
3+
* removed caching of pgsql.connections[max_connections] metric;
4+
* update default logrotate rules;
5+
16
mamonsu (3.5.6-1) stable; urgency=low
27
* changed pg_locks plugin metrics names. Warning: custom user-defined triggers and processing functions may be broken if they use item.name parameter.;
38

+5-22
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
/var/log/mamonsu/agent.log {
2-
daily
3-
rotate 7
4-
compress
5-
missingok
6-
notifempty
7-
create 0640 mamonsu mamonsu
8-
sharedscripts
9-
postrotate
10-
[ -e /var/run/mamonsu/mamonsu.pid ] && /etc/init.d/mamonsu restart >/dev/null
11-
endscript
12-
}
13-
141
/var/log/mamonsu/mamonsu.log {
152
daily
163
rotate 7
@@ -20,15 +7,11 @@
207
create 0640 mamonsu mamonsu
218
sharedscripts
229
postrotate
23-
[ -e /var/run/mamonsu/mamonsu.pid ] && /etc/init.d/mamonsu restart >/dev/null
10+
if [ -d "/run/systemd/system" -a -x "/bin/systemctl" ]; then
11+
/bin/systemctl condrestart mamonsu >/dev/null
12+
else
13+
/etc/init.d/mamonsu condrestart >/dev/null
14+
fi
2415
endscript
2516
}
2617

27-
/var/log/mamonsu/localhost.log {
28-
daily
29-
rotate 7
30-
compress
31-
missingok
32-
notifempty
33-
create 0640 mamonsu mamonsu
34-
}

packaging/rpm/SPECS/mamonsu.spec

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: mamonsu
2-
Version: 3.5.6
2+
Version: 3.5.7
33
Release: 1%{?dist}
44
Summary: Monitoring agent for PostgreSQL
55
Group: Applications/Internet
@@ -73,6 +73,11 @@ chown -R mamonsu.mamonsu /var/log/mamonsu
7373
chown -R mamonsu.mamonsu /etc/mamonsu
7474

7575
%changelog
76+
* Fri Apr 5 2024 Maxim Styushin <[email protected]> - 3.5.7-1
77+
- added support for Zabbix 6.4 API: handle deprecated parameters for auth request;
78+
- removed caching of pgsql.connections[max_connections] metric;
79+
- update default logrotate rules;
80+
7681
* Thu Jan 11 2024 Alexandra Kuznetsova <[email protected]> - 3.5.6-1
7782
- changed pg_locks plugin metrics names. Warning: custom user-defined triggers and processing functions may be broken if they use item.name parameter.;
7883

packaging/win/mamonsu.def.nsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
!define NAME Mamonsu
2-
!define VERSION 3.5.6
2+
!define VERSION 3.5.7
33
!define MAMONSU_REG_PATH "Software\PostgresPro\Mamonsu"
44
!define MAMONSU_REG_UNINSTALLER_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall"
55
!define EDB_REG "SOFTWARE\Postgresql"

0 commit comments

Comments
 (0)