Skip to content

Commit 4ee719e

Browse files
committed
fix: removed pgsql health triggers from native zabbix agent template
1 parent 52ab1c8 commit 4ee719e

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

mamonsu/plugins/pgsql/health.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,22 @@ def macros(self, template, dashboard=False):
106106
return []
107107

108108
def triggers(self, template, dashboard=False):
109-
result = template.trigger({
110-
"name": "PostgreSQL Health: service has been restarted on {HOSTNAME} (uptime={ITEM.LASTVALUE})",
111-
"expression": "{#TEMPLATE:" + self.right_type(self.key_uptime) + ".change()}>" +
112-
self.plugin_macros["pg_uptime"][0][1]
113-
}) + template.trigger({
114-
"name": "PostgreSQL Health: cache hit ratio too low on {HOSTNAME} ({ITEM.LASTVALUE})",
115-
"expression": "{#TEMPLATE:" + self.right_type(self.key_cache, "hit") + ".last()}<" +
116-
self.plugin_macros["cache_hit_ratio_percent"][0][1]
117-
}) + template.trigger({
118-
"name": "PostgreSQL Health: no ping from PostgreSQL for 3 minutes on {HOSTNAME}",
119-
"expression": "{#TEMPLATE:" + self.right_type(self.key_ping) + ".nodata(180)}=1"
120-
})
121-
return result
109+
if self.Type == 'mamonsu':
110+
result = template.trigger({
111+
"name": "PostgreSQL Health: service has been restarted on {HOSTNAME} (uptime={ITEM.LASTVALUE})",
112+
"expression": "{#TEMPLATE:" + self.right_type(self.key_uptime) + ".change()}>" +
113+
self.plugin_macros["pg_uptime"][0][1]
114+
}) + template.trigger({
115+
"name": "PostgreSQL Health: cache hit ratio too low on {HOSTNAME} ({ITEM.LASTVALUE})",
116+
"expression": "{#TEMPLATE:" + self.right_type(self.key_cache, "hit") + ".last()}<" +
117+
self.plugin_macros["cache_hit_ratio_percent"][0][1]
118+
}) + template.trigger({
119+
"name": "PostgreSQL Health: no ping from PostgreSQL for 3 minutes on {HOSTNAME}",
120+
"expression": "{#TEMPLATE:" + self.right_type(self.key_ping) + ".nodata(180)}=1"
121+
})
122+
return result
123+
else:
124+
return ""
122125

123126
def keys_and_queries(self, template_zabbix):
124127
# TODO: define another metric key because it duplicates native zabbix agents keys

0 commit comments

Comments
 (0)