Another useful bash scrpt
- This bash script strips the ping loss percentage figure which you can use for graphing purpose in MRTG, RRD or other graphing products.
#!/bin/sh
#Date: 25-Jun-08
#Author: info[@]roshankarki.com.np
#Purpose: Strip Ping loss percentage to fed into RRD
host="google.com"
cnt=6
file="/tmp/ping.txt"
ping -c $cnt $host > $file
line=`grep "packet loss" $file`
line1=`echo $line | cut -d" " -f7`
loss=`basename $line1 %`
echo $loss
#END
Suggested Modification
- Use low byte like 1byte data while pinging.
- If RTO occurs then it will take long time to execute script so better use less time to wait.
- Insted of ping use fping
nice
ReplyDelete