Jump to content

Continuous Ping in Excel


Recommended Posts

Hi,

Total noob here, so please bear with me. What I have is an excel file with the hostname of a bunch of machines, I want to have a script running that does a continuous ping to all machines to see if they are up or not. It will be a list of about 40 machines and I just want it running for the duration of a migration - about 6 hours.

I would be happy if the script just did one or two pings to the machine and then moved onto the next one and kept on looping.

Anyone have anything handy for this?

thanks!

Link to comment
Share on other sites


2 hours ago, allen2 said:

Or use an already made monitoring program created for this for example Ipswitch whatsup gold: https://www.ipswitch.com/application-and-network-monitoring/whatsup-gold

I had a saying for that, that I cannot remember right now, but that essentially means "that ain't be cheap":
http://www.whatsupgold.com/buy/global/index.aspx

€ 1,727 per year for 25 "points", and OP would need the 100 "points" version for a mere 2,484 €.

Sure the trial version could be used (if it will be used at the most for 6 hours), but (haven't checked) most probably it also has a number of hosts limit.

Now I remember, that saying, it was "as expensive as the cannon needed to shoot at flies". :whistle:

Seriously now, a simple script for pinging a few hosts might be more suited .

Something more or less along the lines of:
 

Unfortunately most of the snippets posted have been corrupted by the last (or maybe the one before the last) board update.

This (basically) would do:
 

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
:Endless_loop
FOR %%A IN (
192.168.0.1
10.2.7.5
8.8.8.8
) DO (
ECHO Pinging %%A
PING -n 1 %%A|FIND "TTL"||ECHO.&&ECHO %%A NOT Reachable&&ECHO.
)
GOTO :Endless_loop

One might insert a delay before the GOTO to slow it down, so that it pings the list of targets every x seconds or minutes.

jaclaz

Link to comment
Share on other sites

From what i remember, at least in the older trial versions (i didn't try it recently), the trial wasn't limited by a number of host.

Another tool (the trial is said to be only limited in time): https://www.paessler.com/info/ping_utility

Or the freeware: http://www.nirsoft.net/utils/multiple_ping_tool.html

There are so much tools (free or not) that are already do what is needed to the OP that i don't think he wanted to learn how to script/program the functionnality.

Also Jaclaz your code isn't multi threaded and for example with a lot of IP (about 40 as the OP stated) , it might ping only one every 40 seconds. Then it wouldn't be an effective monitoring.

It would be very complex to do a multi-threaded batch to properly ping and report the result for a lot of IPs as in batch you can't make a child process speak to his father.

Link to comment
Share on other sites

3 hours ago, allen2 said:

From what i remember, at least in the older trial versions (i didn't try it recently), the trial wasn't limited by a number of host.

Another tool (the trial is said to be only limited in time): https://www.paessler.com/info/ping_utility

Or the freeware: http://www.nirsoft.net/utils/multiple_ping_tool.html

There are so much tools (free or not) that are already do what is needed to the OP that i don't think he wanted to learn how to script/program the functionnality.

Also Jaclaz your code isn't multi threaded and for example with a lot of IP (about 40 as the OP stated) , it might ping only one every 40 seconds. Then it wouldn't be an effective monitoring.

It would be very complex to do a multi-threaded batch to properly ping and report the result for a lot of IPs as in batch you can't make a child process speak to his father.

Well, (at least this is what I do personally when monitoring an address for a test) normally one inserts a timeout so that there is no more than a ping per minute or so, in this case having a 40 seconds interval between pinging the same host sounds just about right to me.

To each its own of course, personally (of course it depends on the specific case) I notice a lot of people usually asking for (polling and receiving) much more data than what they actually *need* just because they can.[1]

But nothing prevents to have - say - four command prompts open, each pinging a subset of 10 addresses. :whistle:

Anyway the Nirsoft little thingy you linked to seems just about right for the core :thumbup

jaclaz

[1] I mean, say that you ping every second each host.

Suddenly one out of the forty fails the ping.

How long is your "reaction time"? Nanoseconds, milliseconds, second or minutes?

How long it take the "intended remedy"? As an example rebooting a device or PC? Nanoseconds, milliseconds, second or minutes? :dubbio:


 


 

Link to comment
Share on other sites

Here is a Demo VBS script that pings in this order, your computer, made up IP,  your computer, made up IP. It uses a counter that resets it self every 5 times. When it stops if you do nothing or select No than the script continues after 30 seconds, if Yes is selected script quits. It displays the ping results in a 3 second self closing message box, it also display the cycles left before being ask to continue or quit.

DemoPing

'-> Run Time Object
Dim Act :Set Act = CreateObject("Wscript.Shell")
'-> Run Time Varibles
Dim C1, i, Ip, Rtn, T1, T2 
 Ip = Array("127.0.0.1", "81.123.55.99","127.0.0.2","82.234.100.56")
'-> Loop To Keep Repeating The Second Loop
  Do
   C1 = C1 + 1
'-> Stops The Script
    If C1 = 5 Then
'-> No Or Time Out Continues The Script, Yes Script Quit,
    If Act.Popup("Would You Like To Quit The Script?",30, _
     "Continue Or Quit", 4132) = 6 Then
      WScript.Quit(1)
     End If
'-> Reset The Counter
     C1 = 0     
    End If 
'-> Threw The Ip Array
  For Each i In Ip
   Ping(i)
   T1 = Rtn & ", Ip Reply : "& i :T2 = "Cycles Left : " & 5-C1
   If Rtn Then
    Act.Popup T1 & vbCrLf & T2,3,"Yes Reply",4128
   Else
    Act.Popup T1 & vbCrLf & T2,3,"No Reply",4128
   End If
  Next 
  Loop Until C1 = 10000
'-> Ping Computer
   Function Ping(P) 
    If Act.Run("Ping -n 1 -w 1000 " & P, 0, True) = 0 Then
     Rtn = True 
    Else
     Rtn = False
    End If  
   End Function

Rename PingDemo.vbs.txt to PingDemo.vbs to make it active PingDemo.vbs.txt

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...