Zabbix external check for application monitoring

zabbix

I'm new in zabbix world, and I created a specific script to be run every half hour. This script returns (through sys.exit(X)) 0 if everything is OK, 1 for warning, 2 critical; 3 unknown (well I conceived it Nagios/centreon style, I have experience on these).

I can execute it through su – zabbix python3 /usr/lib/zabbix/externalscripts/NBackupWD.py ignoredarg -c companyname

The output is text+exit code if there are warnings or critical issues, just the exit code if there are no issues.

So I created an Item called "Backups" with the key "NBackupWD.py[-c companyname]" but from now on, i'm lost.

How to make zabbix execute it and change the trigger state in function of that return code? I understood that I need to create an item, then link it to a trigger (how?), the documentation is very unclear and nowhere is mentioned the adaptation of the return code to trigger the corresponding state (if script sends exit code of 2, then warning.. like on nagios…)

Also, can you please indicate how in the interface to add it? (if possible with screenshots) because on Google, many of the indications are for versions prior 2.4.2 and as I understood there was a change of behavior of scripts at this version.

thank you!

Best Answer

If you created an item you have a key. Let's say your key is:

backup.wd

This key you can use to create the trigger. If you are on the configuration-> item screen you can use the wizard to create a trigger for the item which has no trigger yet. In the popup screen you can provide the expression.

After you have set this up you need to make sure you made a UserParamater in the zabbix_agentd.conf on the agent. Here you need the key again. Create a UserParameter like:

UserParameter=backup.wd, python3 /usr/lib/zabbix/externalscripts/NBackupWD.py ignoredarg -c companyname

You do have to make sure the script is on the agent. Restart the agent and this should do the trick.

Also make sure the item you created is able to handle the given output.

Related Topic