Ad Widget

Collapse

check zabbix agent connectivity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • whitehat
    Junior Member
    • Feb 2010
    • 25

    #1

    check zabbix agent connectivity

    Hi!
    Is there any way to ask zabbix (active) agent if it successfully connected to a zabbix server?
    For example I want to deploy a cron job on all servers where zabbix agents are installed. If zabbix agent can't establish connection with the server (routing issues, vpn, firewall) - it will alert me.
  • jamesNJ
    Senior Member
    • Jun 2015
    • 103

    #2
    You could probably do something simple using zabbix_sender or zabbix_get from a script.

    zabbix_sender could be configured to send traps to zabbix server, and the return code read if success/fail

    zabbix_get could be a little simpler by connecting to the local agent and query tcp availability of ports on the master, such as:
    zabbix_get -s 127.0.0.1 -k "net.tcp.port[zabbix-server-ip,10051]"
    That should return 1 if the local host can open a TCP port to zabbix server process.

    I hope that helps

    Comment

    • akbar415
      Senior Member
      • May 2015
      • 119

      #3
      Originally posted by whitehat
      Hi!
      Is there any way to ask zabbix (active) agent if it successfully connected to a zabbix server?
      For example I want to deploy a cron job on all servers where zabbix agents are installed. If zabbix agent can't establish connection with the server (routing issues, vpn, firewall) - it will alert me.
      Use "Template App Zabbix Agent".
      This template check the connection with the zabbix agent. If no data was received in a period of time, they will alert. Apply this template in all your hosts.

      To manually check if has connection between server and agent, type follow on the server command line.

      Code:
      zabbix_get -s ip_or_hostname_of_agent_host - k"system.uptime"

      Comment

      • whitehat
        Junior Member
        • Feb 2010
        • 25

        #4
        jamesNJ
        The problem is that I want to know for sure that this particular agent is successfully connected to it's server. I don't know to which proxy it will connect, and I don't know if server is configured properly and "knows" this particular agent.
        That's why I want to ask agent itself, not to simulate agent connection with zabbixx_sender etc.
        akbar415
        I have the opposite problem - on each of monitored hosts, I want to make sure that the agent could successfully connect to proxy/server and send metrics there.
        For example, several new servers where installed and zabbix agents were auto-deployed there, but they were misconfigured and trying to reach the wrong proxy. I can't see them in Discovered.
        Right now I can see that connection is failed in agent logs:
        "27927:20150804:122035.345 active check configuration update from [1.5.5.1:11151] started to fail (cannot connect to [[1.5.5.1]:11151]: [4] Interrupted system call)"
        Is there a way to get from agent it's current connection status without parsing log files?
        Last edited by whitehat; 04-08-2015, 21:23.

        Comment

        • akbar415
          Senior Member
          • May 2015
          • 119

          #5
          Originally posted by whitehat
          akbar415
          I have the opposite problem - on each of monitored hosts, I want to make sure that the agent could successfully connect to proxy/server and send metrics there.
          For example, several new servers where installed and zabbix agents were auto-deployed there, but they were misconfigured and trying to reach the wrong proxy. I can't see them in Discovered.
          Right now I can see that connection is failed in agent logs:
          "27927:20150804:122035.345 active check configuration update from [1.5.5.1:11151] started to fail (cannot connect to [[1.5.5.1]:11151]: [4] Interrupted system call)"
          Is there a way to get from agent it's current connection status without parsing log files?

          Let me see if I undestand you.

          You want some way to know if in a host with auto-deploy of zabbix agent they can connect to specific proxy or zabbix server.

          Well, this is trick. My sugestion:
          1 - If you use a script to automatically install the zabbix agent. insert in this script something to test the connectivity with zabbix server or zabbix-proxy, o to read agent log file and send you an email fi something was wrong
          2 - In some place in your company you may have a list with all new installations of O.S, mkae a way to compare this list with the hosts you have on Zabbix, if someone is missing....

          Comment

          • jamesNJ
            Senior Member
            • Jun 2015
            • 103

            #6
            Is this something that needs to be checked frequently (like someone may be messing with configurations over time), or is this more of an issue of accurate initial deployment?

            If all of your clients can get access to the zabbix master, then your software install can include a default installation which points to the master, and then a script you can call (perhaps with zabbix_get) which will send a key to the host which initiates a reconfiguration and restart of the agent.

            I suppose part of the question akbar415 indicates below is how an arbitrary machine is supposed to know who it should connect to. Perhaps an install time script which references some list is the answer.

            Or maybe it might be easier to construct a default zabbix agent config that uses a DNS name instead of IP (like zabbix.company.com), and then make sure that your various locations resolve that name to the local server/proxy the agent is supposed to connect to and accept connections from.

            Comment

            Working...