Ad Widget

Collapse

I need help to monitoring ICMP from an Agent to an external host.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GalaxyNax
    Junior Member
    • Aug 2023
    • 3

    #1

    I need help to monitoring ICMP from an Agent to an external host.

    Hello,

    I need help sending pings to Google's IP address (8.8.8.8) and recording the response time in milliseconds. I've considered the following setup: UserParameter=test[*],fping -e 8.8.8.8 | awk '{ print $4 }' | tr -d '('. When I test this, I get the following result: 'sudo zabbix_agent2 -t test[a] test[a] [s|8.8.8.8 is alive 14.7 ms)'. However, this value is not a floating-point number, which prevents me from monitoring it correctly in Zabbix. When I create the response time item as an active agent, it doesn't collect any data and remains in a 'No Data' state. Can you help me resolve this?"​
    ​
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4806

    #2
    For extracting data from returned values, there's "preprocessing". https://www.zabbix.com/documentation.../preprocessing
    Why it does not work as active check... too many options, too little info... Some mistake in agent config for example... ServerActive not set? or issues with FW-s...

    Comment

    • LenR
      Senior Member
      • Sep 2009
      • 1005

      #3
      Isn't that just an item like icmppingsec[8.8.8.8,2,60,24,60,avg] ?

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4806

        #4
        Originally posted by LenR
        Isn't that just an item like icmppingsec[8.8.8.8,2,60,24,60,avg] ?
        not really, as icmppingsec is simple check and not a agent item. Thus executed in different place. server/proxy vs agent.

        Comment

        • LenR
          Senior Member
          • Sep 2009
          • 1005

          #5
          Something is wrong with your script if it’s returning more than 14.7

          Comment

          • GalaxyNax
            Junior Member
            • Aug 2023
            • 3

            #6
            Thanks everybody for your help.

            I solve it. with this way:

            I create a userprametter in the agent:

            UserParameter=icmp.ping[*],ping -q -c4 -W2 $1 >/dev/null 2>&1;echo $?
            UserParameter=icmp.pingloss[*],ping -q -c4 -W2 $1 | grep "packet loss" | cut -d "," -f3 | sed 's/ \(.*\)%.*/\1/'
            UserParameter=icmp.pingsec[*],ping -q -c4 -W2 $1 | grep "min/avg" | cut -d "=" -f2 | sed 's/.*\/\(.*\)\/.*\/.*/\1/'



            ​

            Comment

            • alexandret
              Junior Member
              • Feb 2022
              • 1

              #7
              Same for Windows Agent.
              UserParameter=icmppingsec[*], powershell -NoProfile -ExecutionPolicy bypass -Command "Test-Connection -ComputerName $1 -Count 4 | Measure-Object ResponseTime -Average | ForEach-Object { '{0:N5}' -f ($_.Average / 1000) -replace ',', '.'}"

              Comment

              Working...