[mrtg] Re: Can MRTG monitor ping times?

Jeff Liebermann jeffl at comix.santa-cruz.ca.us
Fri Jul 9 06:41:34 MEST 1999


> How I can monitor ping times with MRTG?
> Any ideas?

The correct way is to use ping probe.  It works.

However, I like shell scripts so I wrote this one that
extracts the ping times from a single packet ping and
belches the numbers in the proper format.  Your unspecified
operating system may have a different ping command and
formatting, so be careful here.  Just install this shell
script where MRTG can find it and run it from the "target"
line in mrtg.cfg.


#!/bin/sh
# by Jeff Liebermann  08/19/98
#
# Record ping times.
#
# Results of:
#	ping -c 1 -s 1024 bloat
######
# PING bloat (192.168.111.30): 1024 data bytes
# 1032 bytes from bloat (192.168.111.30): icmp_seq=0 ttl=128 time=10 ms
# --- bloat ping statistics ---
# 1 packets transmitted, 1 packets received, 0% packet loss
# round-trip min/avg/max = 10/10/10 ms
######
#
# Really disgusting way to get rid of extra leading spaces
# by feeding it to a shell variable.  Ugly at best.
#
# usage: whatever machine_name_or_ip
# i.e.   whatever bloat.comix.santa-cruz.ca.us
#
retch=`ping -c 1 -s 1025 $1 | grep "time"`	# extract line with ping time.
set $retch	# break apart into fields using IFS seperators
ping=`echo $8 | cut -c 6-`	# extract print time.
echo $ping	# ping time=xxx
echo $ping	# ping time=xxx
echo "0"	# Filler
echo "0"	# Filler
#

-- 
# Jeff Liebermann  Liebermann Design  150 Felker St #D  Santa Cruz  CA  95060
# 831.336.2558 voice  wb6ssy at ki6eh.#cca.ca.usa.noam  wb6ssy.ampr.org 44.4.18.10
# 831.421.6491 digital_pager    73557,2074  cis [don't]
# jeffl at comix.santa-cruz.ca.us  http://www.cruzio.com/~jeffl

--
* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg

--
* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg


More information about the mrtg mailing list