RubyGems Navigation menu

nagios_analyzer 0.0.1

h1. nagios_analyzer h2. Description nagios_analyzer gem allows you to parse a status.dat file produced by nagios or shinken. It's similar to nagios_parser in some way, but has different goals: * the parser doesn't rely on 3rd party library nor standard parser like 'racc', I want to keep the code very simple to read and maintain ; * the parser supports defining scopes, which are processed on the raw file for performance concern, ruby objects being instanciated lately when necessary : on my conf (85hosts/700services), spawning a ruby object for each section makes the script at least 10 times slower (0.25s => >3s). Most of the time, you'll only want to access a subset of your services or hosts, so it's ok. Since nagios_parser looks very cool too, you should try both and keep the best one for you. h2. Installation <pre>gem install nagios_analyzer</pre> h2. Usage <pre> require 'nagios_analyzer' require 'pp' status = NagiosAnalyzer::Status.new("/path/to/status.dat") # get services items pp status.service_items # get host items pp status.host_items # all items ? pp status.items # in fact, each items is a hash pp status.items.first # get all sections, even those where status is OK status = NagiosAnalyzer::Status.new("/path/to/status.dat", :include_ok => true) # define a personal scope (applied to section string, so look at your status.dat!) not_acknowleged = lambda{|section| section.include?("problem_has_been_acknowledged=0") } status = NagiosAnalyzer::Status.new("/path/to/status.dat", :scope => not_acknowledged) # add more scopes status.scopes << lambda{|s| s.include?("notifications_enabled=1") } #no notifications status.scopes << lambda{|s| s.start_with?("hoststatus") } #only host statuses # reset cached results (if you changed scopes!) status.reset_cache! </pre>

Versions:

  1. 0.0.5 - July 14, 2013 (11 KB)
  2. 0.0.4 - July 14, 2013 (10.5 KB)
  3. 0.0.3 - February 22, 2012 (9 KB)
  4. 0.0.2 - May 6, 2011 (8.5 KB)
  5. 0.0.1 - January 27, 2011 (9 KB)

Development Dependencies:

Authors:

  • Jean-Baptiste Barth

Owners:

9a00ce848763a4472291fcbcefd31a07

Total downloads 5,940

For this version 1,293

Required Ruby Version: None

Licenses:

N/A

Gemfile:
gem 'nagios_analyzer', '~> 0.0.1' = Copy to clipboard Copied!

install:
gem install nagios_analyzer -v 0.0.1 = Copy to clipboard Copied!

Links: