A ruby ping program

When testing load balancing/failover, for example Cisco’s HSRP (Hot Standby Router Protocol), you want to run ping and see how long it takes to failover from one router to another. But the regular ping program does not have this functionality so I wrote this small Ruby ping program that timestamps each packet. So, I would run this program and have the router failover and see how many seconds it takes to failover. There are probably other uses for it but this is the main reason why I wrote it.

The program consists of a test myping_test.rb, and the main program ping.rb. The test program verifies that either a valid IP address or ‘localhost’ was entered. The IP address verification is achieved using a regex expression.

The program can be run both from a command line or from within my_ping.rb itself. It currently runs under windows but the next version will be OS independent (when I get around to it). I will also clean up the ruby errors when you stop the program with ctrl-c.

Please feel free to use it or modify but, if you don’t mind, I’d like to know what changes you did. 

You can download it here: MyPing

Leave a Comment