Class: Fuey::Inspections::Ping

Inherits:
Inspection show all
Defined in:
lib/fuey_client/fuey/inspections/ping.rb

Instance Attribute Summary collapse

Attributes inherited from Inspection

#name, #state

Instance Method Summary collapse

Methods inherited from Inspection

#failed?, #notify, #passed?

Methods included from ModelInitializer

#initialize

Instance Attribute Details

#hostObject

Returns the value of attribute host.



6
7
8
# File 'lib/fuey_client/fuey/inspections/ping.rb', line 6

def host
  @host
end

#resultObject

Returns the value of attribute result.



6
7
8
# File 'lib/fuey_client/fuey/inspections/ping.rb', line 6

def result
  @result
end

Instance Method Details

#_executeObject



8
9
10
11
12
13
14
15
# File 'lib/fuey_client/fuey/inspections/ping.rb', line 8

def _execute
  result = Net::Ping::External.new(@host).ping
  if result
    self.pass
  else
    self.fail
  end
end

#statusObject



21
22
23
24
25
26
# File 'lib/fuey_client/fuey/inspections/ping.rb', line 21

def status
  {
    :settings => host || "",
    :statusMessage => %(#{state} ping for #{host}),
  }.merge(super)
end

#to_sObject



17
18
19
# File 'lib/fuey_client/fuey/inspections/ping.rb', line 17

def to_s
  %(Ping #{name} #{host})
end