Ad Widget

Collapse

Ping from each zabbix agent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • konxsolution
    Junior Member
    • Mar 2016
    • 7

    #1

    Ping from each zabbix agent

    Hi guys,

    I could not find an option to monitor ping to a certain IP, say 8.8.8.8 from each host. Any way to achieve this?

    Thanks.

    Zabbix 3.0.1
    Centos 7
  • LenR
    Senior Member
    • Sep 2009
    • 1005

    #2
    Probably, create an item icmpping[8.8.8.8] in a template called something like "all hosts". Link that template to all your hosts.

    I'm not sure it's a good idea, I wouldn't set the update interval very low....

    Comment

    • bbrendon
      Senior Member
      • Sep 2005
      • 870

      #3
      icmpping is a server only item. It sounds like you want the agent to ping. If that's the case what you're looking for isn't built directly into the agent. You'll have to either create a userparameter or use the system.run item.
      Unofficial Zabbix Expert
      Blog, Corporate Site

      Comment

      • Zabbixtrainee
        Junior Member
        • Mar 2016
        • 20

        #4
        Hi,

        I was struggling with this same thing a while ago, and I ended up using this one liner which I found somewhere.

        Copy paste the line below to the agentd_conf file. Change the IP address to whatever you want and if you are running a non-english computer replace "Received" to whatever it says in the cmd when pinging has been succesful.

        UserParameter=CheckPing,@echo off && for /f "tokens=3 delims==" %A IN ('ping -w 200 -n 1 198.16.0.65 ^| find "Received"') do for /f "tokens=1 delims=^, " %B IN ("%A") do echo %B



        Now it's not very reliable because it only sends one package to the wanted host, so my advice is to make a trigger that fires when x amount of pings have failed. (or ofc you can just modify the script to whatever suits you)
        For example this will fire up when two consecutive checks have failed:

        {Host:CheckPing.last(#1)}=0
        and
        {Host:CheckPing.last(#2)}=0

        The item key in this case is: CheckPing

        Comment

        • bbrendon
          Senior Member
          • Sep 2005
          • 870

          #5
          Now to get that into system.run....
          Unofficial Zabbix Expert
          Blog, Corporate Site

          Comment

          • kloczek
            Senior Member
            • Jun 2006
            • 1771

            #6
            Originally posted by bbrendon
            Now to get that into system.run....
            OK, I'll try to add to this pinch of salt

            I can bet that pinging using ICMP is probably pointless.
            Why? Probably applications running on hosts with agents are not using ICMP and they are communicating probably over TCP on some exact port. If it is true ICMP could be even blocked and application still may be working correctly so relaying on results of ping command could be even misleading

            Everyone testing network status must remember as well that on using ICMP back are sent UDP packets which are on some physical paths have lowest priority or even can be lost. Still in such cases communication over TCP could be perfectly fine

            Whoever is using ICMP must remember that this protocol has exact propose and this propose could different than exact test which should be done to confirm that monitored application has fully working network resources.
            In other words sens of using ICMP should be only only as secondary test
            http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
            https://kloczek.wordpress.com/
            zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
            My zabbix templates https://github.com/kloczek/zabbix-templates

            Comment

            • LenR
              Senior Member
              • Sep 2009
              • 1005

              #7
              Sorry about my earlier post, I got sidetracked...

              This is form a 2010 post:

              Add to zabbix_agentd.conf on linux server
              UserParameter=CheckVPN,fping x.x.x.x | grep alive | wc -l

              Comment

              Working...