Ruby - Ping A Machine

September 16, 2014

Whenever I cannot reach a website that is hosted internally at my company, I always ping it before taking any further steps. Today I pinged a machine and thought ‘I wonder how I do this in Ruby?’ Well, that’s what I am going to show you quickly.

First install the net-ping gem:

gem install net-ping

That is all I needed to do, just install the net-ping gem, create a new ‘External’ object and call ping passing in the machine name, port and timeout value.

Ruby is just so awesome! Short and sweet, straight to the answer!


Discussion, links, and tweets

My name is Deon Heyns and I am a developer learning things and documenting them in realtime. Python, Ruby, Scala, .NET, and Groovy are all languages I have written code in. I appeared in the New York Post once. I host my code up at GitHub and Bitbucket so have a look at my code, fork it and send those pull requests.

comments powered by Disqus