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



81
82
83
# File 'lib/monittr.rb', line 81

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

#loadObject



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

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

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



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

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