11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/pingmon/pinger.rb', line 11
def ping
@config.load unless @config.loaded?
PingMon.log << "[#{Time.now}] - Pinging host '#{@config.host}'." if PingMon.log
result = PingMon::Pinger.ping(@config.host)
unless result
PingMon.log << "[#{Time.now}] - '#{@config.host}' appears to be: DOWN. Sending notification." if PingMon.log
notify_down_status if @config.notify_when_down
else
PingMon.log << "[#{Time.now}] - '#{@config.host}' appears to be: UP." if PingMon.log
end
result
end
|