vi /etc/zabbix/externalscripts/packetlossnote: you may need to create the external scripts directory:
mkdir -p /etc/zabbix/externalscripts2. cut out and paste this in "packetloss" file
#!/bin/sh3. Make the file runnable by typing:
if [ -z $1 ]
then
echo "missing ip / hostname address"
echo " example ./packetloss 192.168.201.1 10000"
echo "10000 = 10000 bytes to ping with. the more you use the harder the network will have to deliver it and you start see packetloss. ping with normal ping size is kinda pointless, on LAN networks I recommend to use 10000 - 20000 and on Internet around 1394 (1500 - 48(pppoe + IP + TCP) - 58(ipsec)"
echo "Remember some firewalls might block pings over 100"
echo " "
fi
if [ -z $2 ]
then
echo "missing ping size"
echo " example ./packetloss 192.168.201.1 10000"
echo "10000 = 10000 bytes to ping with. The more you use the harder the network will have to deliver
it and you start see packetloss. ping with normal ping size is kinda pointless, on LAN networks I recommend to use 10000 - 20000 and on Internet around 1394 (1500 - 48(pppoe + IP + TCP) - 58(ipsec)"
echo "Remember some firewalls might block pings over 100"
echo " "
exit
fi
PINGCOUNT = 10
tal=`ping -q -i0.30 -n -s $2 -c$PINGCOUNT $1 | grep "packet loss" | cut -d " " -f6 | cut -d "%" -f1`
if [ -z $tal ]
then
echo 100
else
echo $tal
fi
chmod u+x etc/zabbix/externalscripts/packetloss4. in zabbix verify the host/template you want to monitor the packet loss on have a valid IP or host name and the correct "Connect to" selected.
Then under Item you create a new Item for that host/template
Type: External CheckSAVE
Key: packetloss[10000]
5. now check monitoring -> latest data for that host and you should start seeing packet loss values.
Done.
The number 10000 is Ping size, its very hard to spot packet loss when only sending a few bytes as a normal ping does.
Try increasing the size until you see packet loss then you know you pushing your equipment to the limit.
No comments:
Post a Comment