Computing.Net > Forums > Programming > Ping Monitoring Batch File

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Ping Monitoring Batch File

Reply to Message Icon

Name: bismarkcount
Date: June 4, 2007 at 08:45:09 Pacific
OS: Windows xp
CPU/Ram: inter core2 duo 1.6ghz 1g
Product: Dell
Comment:

hi everybody!
i am using some code i found in this blog from M2 to monitor some hosts through a ping, and save in a file those IPs which are not reachable.

this is the code:

@echo off > badhost.log
for /f %%I in (IPList.txt) do (
ping %%I | find "Reply" > nul
if errorlevel 1 echo %%I Not reachable >> badhost.log )


I have unsuccessfully tried to save all the pinging output in a different log, besides the non reachable hosts.
i mean, saving in another log file every ping performed by the loop:

Pinging xx.xx.x.xxx with 32 bytes of data:

Reply from xx.xx.x.xxx: bytes=32 time<1ms TTL=128
Reply from xx.xx.x.xxx: bytes=32 time<1ms TTL=128
Reply from xx.xx.x.xxx: bytes=32 time<1ms TTL=128
Reply from xx.xx.x.xxx: bytes=32 time<1ms TTL=128

Ping statistics for 10.96.1.233:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms


any ideas???
thnx a lot



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: June 4, 2007 at 08:55:53 Pacific
Reply:

@echo off > badhost.log
for /f %%I in (IPList.txt) do (
ping %%I >> allIP.log
ping %%I | find "Reply" > nul
if errorlevel 1 echo %%I Not reachable >> badhost.log )


=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 2
Name: bismarkcount
Date: June 4, 2007 at 09:26:09 Pacific
Reply:

well, yeah Mechanix... i tried that too, but the matter here is that pinging 2 times will take twice the time... i dont really have any problems with the time, but i heard that it is not very advisble to have a batch file running too much time, and this process would be running about 5 times a day...

isnt there a way to use the same ping i use to find the replay (ping %%I | find "Reply" > nul) as to track all the pinging response?



0

Response Number 3
Name: Mechanix2Go
Date: June 4, 2007 at 10:39:40 Pacific
Reply:

@echo off > badhost.log
for /f %%I in (IPList.txt) do (
ping %%I > %temp%\#
find "Reply" < %temp%\# > nul
if errorlevel 1 echo %%I Not reachable >> badhost.log
type %temp%\# >> allIP.log
)



=====================================
If at first you don't succeed, you're about average.

M2



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Ping Monitoring Batch File

batch files , ping results www.computing.net/answers/programming/batch-files-ping-results/14790.html

Mechanix2 - Ping Batch File Help www.computing.net/answers/programming/mechanix2-ping-batch-file-help/15252.html

DOS batch file need to rec pings www.computing.net/answers/programming/dos-batch-file-need-to-rec-pings/14727.html