Ad Widget

Collapse

How to use zabbix_get

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nmail_uk
    Member
    • May 2009
    • 65

    #1

    How to use zabbix_get

    Just a quick question, how do you use zabbix_get?

    I'm basically trying to test the result of one of my pre-defined commands, but when I run it in zabbix_get, the output is empty, yet Zabbix is getting the result back fine.

    Code:
    root zabbix (networkmail): ./sbin/zabbix_get -s127.0.0.1 -p10050 -k"agent.version"                                                         
    root zabbix (networkmail):
    What's the idea of zabbix_get if it doesn't show the result on the command-line?

    Thanks,
    Andy
  • jamied66
    Member
    • Sep 2008
    • 37

    #2
    I've had good luck without the quotes.

    Code:
    [jed@zabbix ~]# /usr/local/sbin/zabbix_get -s127.0.01 -p10050 -kagent.version
    1.6.4

    Comment

    • nmail_uk
      Member
      • May 2009
      • 65

      #3
      @jamied66,

      What platform are you running on? How did you install Zabbix, from source or package (RPM) ?

      I cannot get a result on CentOS or Solaris:

      CentOS 5.3:

      Code:
      root ~ (networkmail): /opt/nmail/zabbix/sbin/zabbix_get -s127.0.0.1 -p10050 -kagent.version
      root ~ (networkmail):
      Solaris 10:

      Code:
      root ~ (networkmail): /opt/nmail/zabbix/sbin/zabbix_get -s127.0.0.1 -p10050 -kagent.version
      
      root ~ (networkmail):
      Note there is a subtle difference - Solaris outputs a blank line, whereas CentOS doesn't. Should this be logged as a bug?

      Comment

      • jamied66
        Member
        • Sep 2008
        • 37

        #4
        I'm running RHEL 5.2 with Zabbix 1.6.4 compiled from source. (edited to add: and a mish-mash of agents - 1.6.4 and 1.4 pre-compiled agents running on multiple OS's)

        I'm DEF. not an authority on Zabbix, to call something a bug or not. Have you tried the simple troubleshooting standards?

        Often times if I get an empty string from an agent (usually on the initial start of the agent), restarting it fixes that. Also, is there anything in your agent logs if you have them on debug level?
        Last edited by jamied66; 19-05-2009, 22:46.

        Comment

        • Calimero
          Senior Member
          • Nov 2006
          • 481

          #5
          nmail_uk, what if you telnet to the host you want to query ?

          Code:
          [10:33] zzz@zabbix1:~$ telnet zabbix2-adm 10050
          Trying 172.31.246.62...
          Connected to zabbix2-adm.
          Escape character is '^]'.
          agent.version
          ZBXD1.6.1Connection closed by foreign host.
          [10:33] zzz@zabbix1:~$
          If the connection is terminated right after it is established, that means that zabbix_agentd rejects the connection as it originates from the wrong IP.
          Check that the IP you gave (Server=) in zabbix_agentd.conf matches the IP of your zabbix server. Make sure you're using the right interface if you servers are multi-homed.

          Comment

          • nmail_uk
            Member
            • May 2009
            • 65

            #6
            @Calimero

            You're right - if I run zabbix_get from my Zabbix server pointing to the host running the agent, it works fine. It would be nice for zabbix_get to show a message to that effect.

            Is this hard-coded, that the zabbix agent doesn't accept any connections from any IP except the zabbix server?

            Cheers,
            Andy

            Comment

            • renke
              Junior Member
              • Sep 2009
              • 3

              #7
              Originally posted by nmail_uk
              Is this hard-coded, that the zabbix agent doesn't accept any connections from any IP except the zabbix server?
              no, just extend the config entry "Server" in your zabbix-agentd.conf (no spaces, comma-separated list, first entry is used for active checks).

              greetings, renke

              Comment

              Working...