Class: Monittr::Services::Base

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

Direct Known Subclasses

Filesystem, Host, Process, System

Constant Summary collapse

TYPES =
{ 0 => "Filesystem", 1 => "Directory", 2 => "File", 3 => "Daemon", 4 => "Connection", 5 => "System" }

Instance Method Summary collapse

Instance Method Details

#inspectObject



78
79
80
# File 'lib/monittr.rb', line 78

def inspect
  %Q|<#{self.class} name="#{name}" status="#{status}" message="#{message}">|
end

#loadObject



69
70
71
72
# File 'lib/monittr.rb', line 69

def load
  # Note: the `load` gives some headaches, let's be explicit
  @table[:load]
end

#value(matcher, converter = :to_s) ⇒ Object



74
75
76
# File 'lib/monittr.rb', line 74

def value(matcher, converter=:to_s)
  @xml.xpath(matcher).first.content.send(converter) rescue nil
end