Skip to content

Commit de36edd

Browse files
committed
fix: add statement for case where variable for discovery rule is absent
1 parent f7efb43 commit de36edd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mamonsu/lib/plugin.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ def _loop(self):
177177
# convert zabbix key to right type: zabbix-trapper or zabbix-agent
178178
def right_type(self, key, var="", var_discovery=""):
179179
if self.Type == "mamonsu":
180-
new_key = key.format('[{0}{1}]'.format(var, var_discovery[:-1]))
180+
if len(var_discovery) == 0:
181+
new_key = key.format('[{0}]'.format(var))
182+
else:
183+
new_key = key.format('[{0}{1}]'.format(var, var_discovery[:-1]))
181184
else:
182185
if self.AgentPluginType == 'sys':
183186
if var_discovery != "":

0 commit comments

Comments
 (0)