Class: Monittr::Services::System

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

Overview

A “system” service in Monit

<service type=“5”>

Constant Summary

Constants inherited from Base

Base::TYPES

Instance Method Summary collapse

Methods inherited from Base

#inspect, #load, #value

Constructor Details

#initialize(xml) ⇒ System

Returns a new instance of System.



91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/monittr.rb', line 91

def initialize(xml)
  @xml = xml
  super( { :name      => value('name'                          ),
           :status    => value('status',                  :to_i),
           :monitored => value('monitor',                 :to_i),
           :load      => value('system/load/avg01',       :to_f),
           :cpu       => value('system/cpu/user',         :to_f),
           :memory    => value('system/memory/percent',   :to_f),
           :swap      => value('system/swap/percent',     :to_f),
           :uptime    => value('//server/uptime',         :to_i)
         } )
end