I'm writing a new external script. It works pretty well, and I can test it with `zabbix_agentd -t 'app_thing[param1]`. I'm glad it can do freeform text and not depend on restrictive formats.
I insist on stuff that I write to fail gracefully, so I'm testing with bad data, and expecting that the Zabbix agent will recognize that something failed. In the external script I use error messages and "exit 1" where 1 is something not 0, as is normal in writing shell scripts.
Here's a dummy external script
So when I try testing with valid data:
So far so good. Now trying with something that should throw an error:
I'm confused because I expected that 't' (true) to be a 'f' (false) because the external script returned a non-zero exit code.
When writing a Zabbix external script, how should I signal to the zabbix agent that the external script failed? Maybe I need to write to stderr instead, leaving stdout empty? Does the zabbix agent always return 't' to the server even if the external script fails?
I insist on stuff that I write to fail gracefully, so I'm testing with bad data, and expecting that the Zabbix agent will recognize that something failed. In the external script I use error messages and "exit 1" where 1 is something not 0, as is normal in writing shell scripts.
Here's a dummy external script
Code:
#!/bin/sh [ "$1" == 'ping' ] && echo 1 && exit 0 echo "ERR_invalid_param" && exit 1
Code:
$ zabbix_agentd -t 'app_thing[ping]' app_thing[ping] [t|1]
Code:
$ zabbix_agentd -t 'app_thing[xyzzy]' app_thing[xyzzy] [t|ERR_invalid_param]
When writing a Zabbix external script, how should I signal to the zabbix agent that the external script failed? Maybe I need to write to stderr instead, leaving stdout empty? Does the zabbix agent always return 't' to the server even if the external script fails?
Comment