Avatar of IT CAMPER
IT CAMPERFlag for United States of America

asked on 

Need a script or batch to ping across WAN and log results

We have a very relaxed policy WAN between two offices that needs to remain clear of heavy traffic.  Every so often I might have an application exceed what it should use and end up slowing everything to a crawl.  Unless there is another free solution that somewhere is aware of, I could use a simple script or batch to ping across the WAN (I am able to ping a computer) and then write the findings to a log if the time=>300ms for more than 5 replies (or something similar that could be tweaked).  I could then copy the solution and have it check for even worse, say time=>1000 and then use blat to email me the log.  The problem now is that I am unaware of any issues until users start complaining about slowness in certain areas.  By then it looks bad on me.  Thanks for the help!
Network AnalysisVB ScriptMicrosoft DOS

Avatar of undefined
Last Comment
IT CAMPER
Avatar of sshah254
sshah254

Nagios.
MRTG.

They will do what you want at specified intervals, and log it, and notify you.

They might require a little time to setup, but you should be able to get it to work.

Ss
Avatar of Ben Personick (Previously QCubed)
Sure, this is relatively easy, I will build you a script in the next hour or two.

Q
waiting for my laptop to complete windows updates, I already have the script partially formed in my hrad, itmay be possible to make it a single-line command given enough time, but I will build for batch file instantiation instead.....if...windows 7......will...ever....finish....configuring........updates.......!

Q
SOLUTION
Avatar of Ben Personick (Previously QCubed)
Ben Personick (Previously QCubed)
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of IT CAMPER
IT CAMPER
Flag of United States of America image

ASKER

Great solution!  I am testing it tomorrow when at the office.  I also would like for it to record the ping results to a log.  I actually will be trying to have more than one batch file.  The first file would detect smaller delays and just write them consecutive to a local log.  I could then have that log emailed to me once a day or even once a week to review a pattern of traffic at a certain time of the day or certain day of the week.  This is almost like a simple poor mans way of graphing WAN traffic for analysis.

The second patch, more specific to the one you have created, would detect a much larger problem during the time it is occuring, then emails me a notice.  I would have these batches executing several times an hour to get a good sample of the WAN during all hours of the day.
I can certainly create one which does that as well, it's just a bit more complex, and would be a separate Question.

Let me know if there are any issues with the batch I created here; I could not find a slow enough network to run tests with the batch file myself.
Avatar of IT CAMPER
IT CAMPER
Flag of United States of America image

ASKER

Understood.  I tested the batch and it seems to stay in a loop, no matter the latency of the WAN.  I copied a file across the WAN that slowed the PING to over 1000ms for seveal minutes.  Can we have the batch create a log file with each PING so that we can see the results of the test?
SOLUTION
Avatar of ReneGe
ReneGe
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Qlemo
Qlemo
Flag of Germany image

Just a note for the contributing Experts:
   set /a count += 1
is sufficient. Further you do not need to use % in set /a around a variable.
It's only a nuance, but would you please refrain from using tabs? Two or four spaces are really enough for indention ...
And of course    ping -n 5 127.0.0.1   does only wait 4 seconds.
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of IT CAMPER
IT CAMPER
Flag of United States of America image

ASKER

Just got back from vacation.  Will be finalizing this tomorrow.  Updates to follow.
Avatar of IT CAMPER
IT CAMPER
Flag of United States of America image

ASKER

Great work everyone!
VB Script
VB Script

VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.

39K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo