Ad Widget

Collapse

Ping host from zabbix-agent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sabat
    Junior Member
    • Aug 2018
    • 13

    #1

    Ping host from zabbix-agent

    Hello,

    as i have my zabbix 4.4 on VPS machine, remote location, i'm trying to run ping (latency response) from zabbix-agent machine in my network.


    5 years ago someone posted this, but I cant get it to runn - I have no data....
    UserParameter=chk.fping[*],sudo /usr/bin/fping -c 3 $1 2>&1 | tail -n 1 | awk '{print $NF}' | cut -d '/' -f2 Add permition in /etc/sudoers because of error in creating SOCKET.
    zabbix ALL=(ALL) NOPASSWD:/usr/bin/fping
    In template you can add items you'd like to ping
    chk.fping[8.8.8.8]

    When i run as root
    /usr/bin/fping -c 3 $1 2>&1 | tail -n 1 | awk '{print $NF}' | cut -d '/' -f2
    from command line it is working...

    any help?
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    On the machine running the zabbix-agent, first create a directory that zabbix can safely write to while debugging:

    Code:
    mkdir /tmp/zabbix-debug
    chmod 700 /tmp/zabbix-debug
    sudo chown zabbix /tmp/zabbix-debug
    Then modify the UserParameter to do this:

    Code:
    [B]UserParameter=chk.fping[*],sudo /usr/bin/fping -c 3 $1 2>&1 | tee -a /tmp/zabbix-debug/chk.fping | tail -n 1 | awk '{print $NF}' | cut -d '/' -f2[/B]
    then restart zabbix-agent on that system so it reads the updated UserParameter.

    Look at what gets written to /tmp/zabbix-debug/chk.fping to see if that gives you a clue about what the problem is.

    Once you've got it figured out and fixed, be sure to remove the "tee -a /tmp/zabbix-debug/chk.fping" from the UserParameter, and restart, so it don't keep appending output to that debug file.

    Comment

    Working...