Re: ping replacment?
From: Floyd Davidson (floyd_at_barrow.com)
Date: 09/03/03
- Previous message: Bit Twister: "Re: Can't ping or get some sites"
- In reply to: Jørn Dahl-Stamnes: "Re: ping replacment?"
- Next in thread: armin walland: "Re: ping replacment?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 03 Sep 2003 04:11:39 -0800
jorn.dahl-stamnes@nospam.novit.no (Jørn Dahl-Stamnes) wrote:
>In article <87r830prml.fld@barrow.com>, Floyd Davidson <floyd@barrow.com> wrote:
>>
>>What are you trying to accomplish?
>
>I watched a network connection that somethime lost the connection. I used ping
>to see if there was any delay in the network. But when the network lost the
>connection, it was not detected by ping when I looked at delay.
>
>I wanted to see when I lost the connection and when it was OK again. And I
>want to do it without having to look at the screen all the time, something
>like
>
># ping <some arguments> | tee ping.out
>
>go home and then look a ping.out file the next morning and say "aaah.. at 7 pm
>it failed..."
Write a small script with a loop that executes ping at some
regular interval. Depending on what kind of resolution you need,
that can be seconds or minutes... whatever. You only need to
log when it fails, and thus the log will be short and sweet,
and easy to read.
Here is an example that will give you 10 second resolution on
when the ping fails, and 1 second resolution on when it again
succeeds.
#!/bin/sh
#
host=192.168.0.2
interval=10
while true
do
date
echo $host $interval
if ! ping -c1 -w3 $host 2>&1 > /dev/null
then
date >> ping.log
echo " ping FAILED" >> ping.log
echo "*************" >> ping.log
sleep 1
continue
fi
sleep $interval
done
-- Floyd L. Davidson <http://web.newsguy.com/floyd_davidson> Ukpeagvik (Barrow, Alaska) floyd@barrow.com
- Previous message: Bit Twister: "Re: Can't ping or get some sites"
- In reply to: Jørn Dahl-Stamnes: "Re: ping replacment?"
- Next in thread: armin walland: "Re: ping replacment?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|