Skip to content

Commit 0e349e0

Browse files
committed
fix: trigger for non-active slots
1 parent 0395f1f commit 0e349e0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mamonsu/plugins/pgsql/xlog.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
NUMBER_NON_ACTIVE_SLOTS = 0
88

9+
910
class Xlog(Plugin):
1011
DEFAULT_CONFIG = {'lag_more_than_in_sec': str(60 * 5)}
1112

@@ -31,7 +32,7 @@ class Xlog(Plugin):
3132
key_wall = 'pgsql.wal.write{0}'
3233
key_count_wall = "pgsql.wal.count{0}"
3334
key_replication = "pgsql.replication_lag{0}"
34-
key_non_active_slots = "pgsql.replication.non_active_slots"
35+
key_non_active_slots = "pgsql.replication.non_active_slots{0}"
3536
AgentPluginType = 'pg'
3637

3738
def run(self, zbx):
@@ -136,10 +137,11 @@ def triggers(self, template):
136137
'on {HOSTNAME} (value={ITEM.LASTVALUE})',
137138
'expression': '{#TEMPLATE:' + self.right_type(self.key_replication, "sec") + '.last()}>' +
138139
self.plugin_config('lag_more_than_in_sec')
139-
}) + template.trigger({
140+
})
141+
triggers += template.trigger({
140142
'name': 'PostgreSQL number of non-active replication slots '
141143
'on {HOSTNAME} (value={ITEM.LASTVALUE})',
142-
'expression': '{#TEMPLATE:' + self.right_type(self.key_replication, "sec") + '.last()}≠' +
144+
'expression': '{#TEMPLATE:' + self.right_type(self.key_non_active_slots) + '.last()}≠' +
143145
str(NUMBER_NON_ACTIVE_SLOTS)
144146
})
145147
return triggers

0 commit comments

Comments
 (0)