Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ping & caputer to log file 2

Status
Not open for further replies.

hinesjrh

MIS
Jan 4, 2005
260
US
Can someone explain to me how to set up a constant ping to an IP address and capture the output to a log file. I am having some power issues at one of my remote sites, and I want to caputer when & how often it goes down.
 
If it's a Windows machine, you can run a fairly rudimentary batch file to do this. Create a file, e.g. pingtest.bat, and insert the following lines in it:

@echo off
:START
echo.|date >> log.txt
echo.|time >> log.txt
ping a.b.c.d >> log.txt
goto START

Basically this will capture the date and time, run 4 pings and repeat. It will save all the output to a new file called log.txt

If you want to run more pings than the default of 4, simply add a -n flag (e.g. ping -n 10 a.b.c.d will run 10 pings) to the ping command above. If you run a continuous ping (-t), the batch file will never loop and thus you will never be sure what time it went down.

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top