Hello All,
Problem statement: Get the packet loss/delay miliseconds using Ping.
Tried Solution:
I am trying to trigger custom script written, which just takes ip address as first argument, and returns number of delay in mili seconds. Below is my script.
Now it is located under
I have also created a symbolic link in
to above.
Also added this line under zabbix_agentd.conf on zabbix server
And then in my template, added new item called
item name : checkPing
type as externalcheck
Key as checkPing[{HOST.CONN}] ( tried {HOST.HOST} but it didn't work so used this key)
Since this template is mixture of snmp and general ( snmp because i am trying to monitory a firewall with discovery rull, and item prototypes), Is there any other config involved?
1). Do i need to make any changes to run this from zabbix server to firewall ping test (as above solution isn't working).
2). If i want to run this on a client machine behind firewall and ping some other server to check the latency or connectivity what other changes to be done on this?
zabbix server: Oracle Linux server 6.4 with kernel 2.6.39-400, zabbix server/ agent version: 2.0.6
Any pointers are greatly helpful.
Thanks
Problem statement: Get the packet loss/delay miliseconds using Ping.
Tried Solution:
I am trying to trigger custom script written, which just takes ip address as first argument, and returns number of delay in mili seconds. Below is my script.
Code:
#!/bin/bash
echo -e "\n\n" >>/tmp/o.txt
echo "received $1">>/tmp/o.txt
if [ "$#" != 1 ];
then
echo -e "YOU HAVE TO PASS THE IP ADDRESS OF THE MACHINE TO PING AS FIRST ARGUMENT...!!!\n";
exit -1
fi
ip=$1
stat=1
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
OIFS=$IFS
IFS='.'
ip=($ip)
IFS=$OIFS
[[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
stat=$?
fi
echo "returing $stat">>/tmp/o.txt
if [[ $stat == 0 ]];
then
echo "inside okay">>/tmp/o.txt
result=$(/bin/ping -c 5 $1 | grep -E "time=" | awk '{print $7}' | sed s/time=//g | xargs echo | sed -e 's/\s/ + /g' | sed -e 's/^/( /' | sed -e 's/$/ ) \/ 5/' | bc)
sleep 2
echo "$time|$result">>/tmp/o.txt
echo $result
else
echo "inside no">>/tmp/o.txt
echo -e "OOPS, I CAN't VALIDATE YOUR IP ADDRESS... SORRY...!!!";
exit -2;
fi
Code:
/usr/local/etc/scripts/checkPing
Code:
/etc/zabbix/externalscripts/
Also added this line under zabbix_agentd.conf on zabbix server
Code:
UserParameter=checkPing[*], /usr/local/etc/scripts/checkPing $1
item name : checkPing
type as externalcheck
Key as checkPing[{HOST.CONN}] ( tried {HOST.HOST} but it didn't work so used this key)
Since this template is mixture of snmp and general ( snmp because i am trying to monitory a firewall with discovery rull, and item prototypes), Is there any other config involved?
1). Do i need to make any changes to run this from zabbix server to firewall ping test (as above solution isn't working).
2). If i want to run this on a client machine behind firewall and ping some other server to check the latency or connectivity what other changes to be done on this?
zabbix server: Oracle Linux server 6.4 with kernel 2.6.39-400, zabbix server/ agent version: 2.0.6
Any pointers are greatly helpful.
Thanks
Comment