2016-04-20 【Ruby】RubyでPING Ruby rubyでnet-pingを使ってPINGを確認するサンプルスクリプトを作ってみました。 事前に「gem install net-ping」でnet-pingをインストールする必要があります。 ◆ソース(ping_check.rb) require 'net/ping' # PING送信先の指定addr = 'yahoo.co.jp' # インスタンス生成pi = Net::Ping::External.new(addr); # PINGチェックif pi.ping? puts 'PING OK'else puts 'PING NG'end ◆実行結果 # ruby ping_check.rbPING OK