Skip to content

Commit 42c3eb5

Browse files
committed
fix: add support for Zabbix API v6.4
1 parent 718d958 commit 42c3eb5

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

Diff for: .github/workflows/mamonsu-tests-dev.yml

+3
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'

Diff for: .github/workflows/mamonsu-tests-master.yml

+9
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'

Diff for: 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):

0 commit comments

Comments
 (0)