Ad Widget

Collapse

Return codes of "zabbix_agentd"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • just2blue4u
    Senior Member
    • Apr 2006
    • 347

    #1

    Return codes of "zabbix_agentd"

    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:
    Code:
    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?
    Big ZABBIX is watching you!
    (... and my 48 hosts, 4513 items, 1280 triggers via zabbix v1.6 on CentOS 5.0)
  • xaitax
    Member
    • Apr 2006
    • 39

    #2
    Code:
    [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
    Last edited by xaitax; 01-08-2006, 14:53.

    Comment

    • just2blue4u
      Senior Member
      • Apr 2006
      • 347

      #3
      "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...
      Big ZABBIX is watching you!
      (... and my 48 hosts, 4513 items, 1280 triggers via zabbix v1.6 on CentOS 5.0)

      Comment

      • xaitax
        Member
        • Apr 2006
        • 39

        #4
        Uhm, "0" is correct return-value.
        Code:
        [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

        Comment

        • just2blue4u
          Senior Member
          • Apr 2006
          • 347

          #5
          return codes w/o success-/errorinformation

          I can confirm the behaviour you posted.
          But i need the returncodes of "zabbix_agentd -t <item>".

          Look at this:
          Code:
          [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.
          Sorry, i can't believe that...
          Big ZABBIX is watching you!
          (... and my 48 hosts, 4513 items, 1280 triggers via zabbix v1.6 on CentOS 5.0)

          Comment

          Working...