Pinging with times

Today, I found the need to write a simple batch script that would be able to ping a remote host as well as output the times as to when a group of pings were sent. The need for this stemmed from a customer of the company I work for having problems with Cisco IP phones re-registering with the central Cisco Unified Communications Manager server at a certain time every day. Initially, the prognosis was that DHCP was the root cause of the re-registering whereby the devices were renewing their DHCP lease, which by default on Cisco routers is every 24 hours, disconnecting from the network briefly then reconnecting to the network with the same IP address and then re-registering with CUCM. However, this turned out to not be the case as the DHCP lease was extended to occur every seven days but the phones continued to re-register every day. The times in which the re-registering occurred began to change also, varying from 11:30am to 3:45am.

A colleague of mine, during the diagnostic stage, pointed out that the office in which all these phones were re-registering at has a satellite ADSL link to the main office where the CUCM server is at. Now, to prove that this satellite link is the root cause of the re-registering every day, as it is known to be flaky, a constant stream of pings would need to be sent to the remote site’s voice gateway. Simply pinging an interface wouldn’t suffice as time data is not captured and any drops in packets would not be able to be married up to any data captured from the Real Time Monitoring Tool which can be used to view logs on CUCM servers. This is where my very simple, not so clean, batch script comes in handy.

The build of  the script is simple – there’s two files; pingWithTimes.bat and output.bat. The pingWithTimes batch file simple echos the current system time and then pings the the desired interface IP address for, by default, ten times before looping back to the start. Output.bat runs the pingWithTimes.bat file and then saves any output to a text file name output.txt.

The IP address and name of the text document can be edited by using a text editor such as Notepad or Notepad++. Ideally, I would like the script to have prompts but for now, this will suffice.

You can download the .rar of these files here.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: