bgdnlp / pyzlack

Python script to send Zabbix alerts to Slack
BSD 2-Clause "Simplified" License
3 stars 4 forks source link

UnboundLocalError: local variable 'status' referenced before assignment #2

Open rpanev opened 4 years ago

rpanev commented 4 years ago

Hello,

i use zabbix 3 and 4, at 3 it works perfectly but at 4 i have the following error:

Traceback (most recent call last): File "/usr/lib/zabbix/alertscripts/pyzlack", line 266, in <module> main() File "/usr/lib/zabbix/alertscripts/pyzlack", line 253, in main enrich_message(args.subject, args.body) File "/usr/lib/zabbix/alertscripts/pyzlack", line 168, in enrich_message if status == 'OK' or subject[0:3] == 'OK:': UnboundLocalError: local variable 'status' referenced before assignment

bgdnlp commented 4 years ago

It's looking for {TRIGGER.STATUS}, which should be part of the alert message. I'm guessing it's missing from your alert?

I should add a condition to check for that. Meanwhile, adding the status to the message should fix it.