Ruby - Ping A Machine
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!