  | 
				NickSoft Linux Cookbook Quick howto's, Real live examples.   
				 | 
                                
 
                                 | 
			 
		 
		 
	
		| View previous topic :: View next topic   | 
	 
	
	
		| Author | 
		Message | 
	 
	
		NickSoft Site Admin
  
  Joined: 13 Nov 2006 Posts: 22
 
  | 
		
			
				 Posted: Mon Nov 13, 2006 3:25 pm    Post subject: [MRTG] Ping graphs | 
				     | 
			 
			
				
  | 
			 
			
				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 | 
		 | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
	 
	    
	   | 
	
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
  | 
   
 
		 |