Skip to content

Commit 4c1e6eb

Browse files
committed
v2.2.0: change default item type to 'Zabbix trapper'
1 parent f9417c1 commit 4c1e6eb

File tree

7 files changed

+236
-223
lines changed

7 files changed

+236
-223
lines changed

mamonsu/__init__.py

Lines changed: 1 addition & 1 deletion
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__ = '2.1.8'
4+
__version__ = '2.2.0'
55
__licence__ = 'BSD'
66

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

mamonsu/lib/zbx_template.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ZbxTemplate(object):
3838

3939
# https://www.zabbix.com/documentation/2.0/manual/appendix/api/item/definitions
4040
item_defaults = [
41-
('name', None), ('type', 7), ('snmp_community', None),
41+
('name', None), ('type', 2), ('snmp_community', None),
4242
('multiplier', 0), ('inventory_link', 0),
4343
('key', None), ('snmp_oid', None), ('history', 7),
4444
('trends', 365), ('status', 0), ('delay', 60),
@@ -83,7 +83,7 @@ class ZbxTemplate(object):
8383
]
8484

8585
discovery_defaults = [
86-
('name', None), ('type', 7), ('snmp_community', None),
86+
('name', None), ('type', 2), ('snmp_community', None),
8787
('snmp_oid', None), ('delay', 60), ('status', 0),
8888
('allowed_hosts', None), ('snmpv3_contextname', None),
8989
('snmpv3_securityname', None), ('snmpv3_securitylevel', 0),

mamonsu/plugins/pgsql/driver/pool.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def __init__(self):
4343
self.all_connections = {}
4444
self._server_version = {}
4545
self._mamonsu_bootstrap = {}
46+
self._mamonsu_bootstrap_cache = 0
4647
self._in_recovery = {}
4748
self._in_recovery_cache = 0
4849

@@ -83,16 +84,19 @@ def server_version_less(self, version, db=None):
8384
return self.server_version(db) <= LooseVersion(version)
8485

8586
def mamonsu_bootstrap(self, db=None):
86-
if db in self._mamonsu_bootstrap:
87+
if (db in self._mamonsu_bootstrap) and (self._mamonsu_bootstrap_cache < 10):
88+
self._mamonsu_bootstrap_cache += 1
8789
return self._mamonsu_bootstrap[db]
90+
self._mamonsu_bootstrap_cache = 0
8891
sql = """select count(*) from pg_catalog.pg_class
8992
where relname = 'mamonsu_config'"""
9093
result = int(self.query(sql, db)[0][0])
9194
self._mamonsu_bootstrap[db] = (result == 1)
9295
if self._mamonsu_bootstrap[db]:
93-
self.all_connections[db].log.info("Detect mamonsu bootstrap")
96+
self.all_connections[db].log.info("Found mamonsu bootstrap")
9497
else:
95-
self.all_connections[db].log.info("Can't detect mamonsu bootstrap")
98+
self.all_connections[db].log.info("Can't found mamonsu bootstrap")
99+
self.all_connections[db].log.info("hint: run `mamonsu bootstrap` if you want to run without superuser rights")
96100
return self._mamonsu_bootstrap[db]
97101

98102
def extension_installed(self, ext, db=None):

0 commit comments

Comments
 (0)