Class: Monittr::Services::Filesystem

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

Overview

A “filesystem” service in Monit

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

<service type=“0”>

Constant Summary

Constants inherited from Base

Base::TYPES

Instance Method Summary collapse

Methods inherited from Base

#inspect, #load, #value

Constructor Details

#initialize(xml) ⇒ Filesystem

Returns a new instance of Filesystem.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/monittr.rb', line 109

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