1

We are running a typical zabbix server setup. A zabbix server and a couple linux servers that has zabbix agent installed and monitored by the zabbix server. However, my problem is there a way to check ping (icmppingsec maybe? :confused:) in between linux_host A to linux_host B and output the result to the zabbix server coming from linux_host A??

I have tried simple check icmppingsec[<target>,<packets>,<interval>,<size>,<timeout>,<mode>] but I found out that the ping is executed by the zabbix server itself and not the host A.

Thanks for the help!

3 Answers 3

5

Found a solution to add this user parameter:

UserParameter=chk.fping[*],sudo /usr/bin/fping -c 3 $1 2>&1 | tail -n 1 | awk '{print $NF}' | cut -d '/' -f2

Add permission in /etc/sudoers because of an error when creating SOCKET.

zabbix ALL=(ALL) NOPASSWD:/usr/bin/fping

In the template, you can add items you'd like to ping.

chk.fping[8.8.8.8]

1
  • 1
    This works, make sure to define in items your type information as "Numeric (float)", otherwise the result will be treated as string.
    – frank_108
    Commented Jun 14, 2023 at 8:16
2

Currently, the ability to ping a host by Zabbix agent is not supported out of the box, but there is a feature request for that: ZBXNEXT-739. Meanwhile, you should add a user parameter on the agent that would do the pinging.

1
  • thank you for the info, i did my research and found how to ping thru userparameters using this code UserParameter=<key>,fping x.x.x.x | grep alive | wc -l but it only outputs 1 and 0, is there a way to output a response time and graph it on zabbix server?
    – newmoon
    Commented Sep 19, 2014 at 9:19
0

I have found a way to get the ping latency from the zabbix agent in order to ping an external host. I declared this parameter to the zabbix_agentd.conf

UserParameter=key_name[*],fping -e x.x.x.x | awk '{ print $4 }' | tr -d '('

It outputs the response time, numeric value only. My next problem is how to make this command readable by zabbix server so that it will be viewable thru graph. On zabbix server the output is "no data" but under Hosts > Items, it is green and enabled.

Thanks for the help!

1
  • Note that if you use a user parameter with arguments, then in the awk command you should use $$4 instead of $4. Otherwise, Zabbix agent will try to substitute $4 with the item's fourth argument, which is probably empty. If you have the IP hardcoded into the command, just omit "[*]" in the key name. See zabbix.com/documentation/2.2/manual/config/items/userparameters for more information on user parameters.
    – asaveljevs
    Commented Sep 22, 2014 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.