PDA

View Full Version : Return codes of "zabbix_agentd"


just2blue4u
01-08-2006, 14:35
I have built a script to untar, configure, make, install ... my zabbix agents on servers.
In this script, i do "zabbix_agentd -t agent.version" and want to ask if the command returned without errors:

zabbix_agentd -t agent.version
[ $? == 255 ] && sleep 3 || exit


Is 255 the correct return value if the command was executed correctly, or which value should be returned?

Is there a list of the different return codes?

xaitax
01-08-2006, 14:47
[xai@w00t bin]# zabbix_agentd -t; echo $?
zabbix_agentd: option requires an argument -- t
usage: zabbix_agentd [-vhp] [-c <file>] [-t <metric>]
255
You see, 255 is a FAILURE return code.
Normally - I didn't test at all - `0' should have been returned, if command was successfull.

- xai

just2blue4u
02-08-2006, 11:57
"0" was, what i was expecting first, too. But i got back the "255" after a correct agent.version check. So this code has multiple meanings?!

I'm sorry, this doesn't help me... :(

xaitax
02-08-2006, 13:09
Uhm, "0" is correct return-value.
[xai@w00t bin]# /etc/init.d/zabbix_agentd stop
Shutting down zabbix_agentd: [ OK ]
[xai@w00t bin]# ./zabbix_agentd; echo $?
0
[xai@w00t bin]# ps auxf | grep zabbix_agentd | grep -v grep
zabbix 30176 0.0 0.0 2004 900 ? SN 13:12 0:00 ./zabbix_agentd
zabbix 30177 0.0 0.0 2028 768 ? SN 13:12 0:00 \_ ./zabbix_agentd
zabbix 30178 0.0 0.0 2028 764 ? SN 13:12 0:00 \_ ./zabbix_agentd
zabbix 30179 0.0 0.0 2028 772 ? SN 13:12 0:00 \_ ./zabbix_agentd
zabbix 30180 0.0 0.0 2020 748 ? SN 13:12 0:00 \_ ./zabbix_agentd
zabbix 30181 0.0 0.0 2072 712 ? SN 13:12 0:00 \_ ./zabbix_agentd
[xai@w00t bin]#
Version must be a "special" status. If you want to know how which reply results, have a look into the sources.

- xai

just2blue4u
02-08-2006, 14:22
I can confirm the behaviour you posted.
But i need the returncodes of "zabbix_agentd -t <item>".

Look at this:

[root@dori ~]# zabbix_agentd -t agent.version; echo $?
agent.version [s|1.1]
255
[root@dori ~]# zabbix_agentd -t system.uptime; echo $?
system.uptime [u|2310324]
255
[root@dori ~]# zabbix_agentd -t system.cpu.intr; echo $?
system.cpu.intr [u|1152053400]
255
usage: zabbix_agentd [-vhp] [-c <file>] [-t <metric>]
255
[root@dori ~]# zabbix_agentd -t foobar; echo $?
foobar [m|ZBX_NOTSUPPORTED]
255

According to this tests, The return code of "zabbix_agentd", provided by "$?" doesn't seem to provide any information about success/failure. :eek:
Sorry, i can't believe that...