Class: Monittr::Services::Host

Inherits:
Base
  • Object
show all
Defined in:
lib/monittr.rb

Overview

A “host” service in Monit

mmonit.com/monit/documentation/monit.html#connection_testing

<service type=“4”>

Constant Summary

Constants inherited from Base

Base::TYPES

Instance Method Summary collapse

Methods inherited from Base

#inspect, #load, #value

Constructor Details

#initialize(xml) ⇒ Host

Returns a new instance of Host.



158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/monittr.rb', line 158

def initialize(xml)
  @xml = xml
  super( { :name          => value('name'                          ),
           :status        => value('status',                  :to_i),
           :monitored     => value('monitor',                 :to_i),
           :response_time => value('port/responsetime'             )
         } )
  rescue Exception => e
    puts "ERROR: #{e.class} -- #{e.message}, In: #{e.backtrace.first}"
   super( { :name => 'Error',
            :status  => 3,
            :message => e.message } )
end