class Nagios
Attributes
all[RW]
db[RW]
problems[RW]
Public Class Methods
new(config)
click to toggle source
# File lib/nagios.rb, line 6 def initialize (config) @db = Influx.new(config['influxdb']['host'], config['nagios']['dbname'], config['influxdb']['port'], config['influxdb']['user'], config['influxdb']['password']) @status = NagiosAnalyzer::Status.new(config['nagios']['file'], include_ok: true) @all = @status.service_items @problems = @status.service_problems return @status end
Public Instance Methods
by_host(host)
click to toggle source
# File lib/nagios.rb, line 30 def by_host(host) issues = self.all.select{ |service| service.host_name == host} return issues end
by_status(status)
click to toggle source
# File lib/nagios.rb, line 35 def by_status(status) issues = self.all.select{ |service| service.status == status} return issues end
host_list()
click to toggle source
# File lib/nagios.rb, line 14 def host_list() host_list = [] self.all.each do |service| host_list << service.host_name end host_list.uniq!.sort! end
status_list()
click to toggle source
# File lib/nagios.rb, line 22 def status_list() status_list = [] self.all.each do |service| status_list << service.status end status_list.uniq!.sort! end