0

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!

1
  • It's better to use cron and just catch exit code of the task (call zabbix_sender within it for example). For case something is really wrong and no exit code being sent just set nodata trigger for a hour. Commented Jan 1, 2016 at 9:53

1 Answer 1

2

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.

2
  • Well the idea here would to not have any agent on the zabbix server to execute the command. So isn't there any way that the server itself can pull item data when it's an external check? Commented Jan 4, 2016 at 8:30
  • Than you might want to try to set up an item with the SSH agent: ssh.run[<unique short description>,<ip>,<port>,<encoding>] Commented Jan 4, 2016 at 8:37

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.