birmingham@ic.fbi.gov , phoenix@ic.fbi.gov , fbise@leo.gov
NickSoft Linux Cookbook Index NickSoft Linux Cookbook
Quick howto's, Real live examples.
 
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[MRTG] Ping graphs

 
Post new topic   Reply to topic    NickSoft Linux Cookbook Index -> MRTG
View previous topic :: View next topic  
Author Message
NickSoft
Site Admin


Joined: 13 Nov 2006
Posts: 22

PostPosted: Mon Nov 13, 2006 3:25 pm    Post subject: [MRTG] Ping graphs Reply with quote

Here is sample conf file:
Code:

#Ping is slow process. Use forks to ping multiple hosts at a time.
Forks: 10

Target[ping.google]: `/etc/mrtg/ping.sh www.google.com`
Title[ping.google]: Ping Google
PageTop[ping.google]: <H1>Ping Google</H1>
MaxBytes[ping.google]: 2000
Options[ping.google]: unknaszero,nopercent,gauge
ShortLegend[ping.google]:
LegendI[ping.google]: Pkt loss [%]
LegendO[ping.google]: Avg RTT [ms]
YLegend[ping.google]: RTT (ms)

Target[ping.yahoo]: `/etc/mrtg/ping.sh www.yahoo.com`
Title[ping.yahoo]: Ping Yahoo
PageTop[ping.yahoo]: <H1>Ping Yahoo</H1>
MaxBytes[ping.yahoo]: 2000
Options[ping.yahoo]: unknaszero,nopercent,gauge
ShortLegend[ping.yahoo]:
LegendI[ping.yahoo]: Pkt loss [%]
LegendO[ping.yahoo]: Avg RTT [ms]
YLegend[ping.yahoo]: RTT (ms)



Here is the script (/etc/mrtg/ping.sh):
Code:
#!/bin/sh
PING="/bin/ping"
ADDR="$1"
DATA=`$PING -c10 -s500 $ADDR -q `
LOSS=`echo "$DATA" |/usr/bin/tail -n 2|/usr/bin/head -n 1| awk '{print $6 }' | /usr/bin/tr -d %`
RTT=`echo $DATA |/usr/bin/tail -n 1| awk -F/ '{print $5 }'`

if [ -n "$LOSS" ] ; then
  LOSS=0
fi
if [[ "$RTT" == "" ]] ; then
  RTT=0
fi
echo $LOSS
if [[ "$LOSS" == "100" ]] ; then
              echo 0
else
  echo $RTT
fi
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NickSoft Linux Cookbook Index -> MRTG All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




MLDb.org Magic Eight Ball Croler Web Search Croler Web Directory Bianca Ryan MyBestMatch.net Microlab.info

Powered by 220V