= nagiosharder Query and command a Nagios install using the power of ruby. require 'nagiosharder' site = NagiosHarder::Site.new('http://path/to/nagios/cgi/directory', 'user', 'password', 'version') # version defaults to 3 # get details back about a host's services puts site.host_status('myhost') # schedule a host to have services checks run again right now site.schedule_host_check('myhost') # get details on all services site.service_status(:all) # or just services that have problems site.service_status(:all_problems) # (other valid symbols: :ok, :warning, :unknown, :critical, :pending, :all_problems) # or make it sorted by duration, descending site.service_status(:all_problem, :sort_option => :duration, :sort_type => :desc # (other sort_options: :host, :service, :status, :last_check, :duration, :attempts) # (other sort_types: :asc, :desc) # or get the details for a single service group site.service_status(:all_problem, :group => "AWESOME") # schedule a host to have services checks run again right now site.schedule_service_check('myhost', 'myservice') # schedule 20 minutes of downtime, starting now site.schedule_host_downtime('myhost', :start_time => Time.now, :end_time => Time.now + 20.minutes) # schedule a flexible 20 minutes of downtime between now and 2 hours from now site.schedule_host_downtime('myhost', :type => :flexible, :start_time => Time.now, :end_time => Time.now + 2.hours, :hours => 0, :minutes => 20) # acknowledge a down service site.acknowledge_service('myhost', 'myservice', 'something bad happened') # or unacknowledge site.unacknowledge_service('myhost', 'myservice') # disable notifications for a service: site.disable_service_notifications('myhost', 'myservice') # check if notifications are disabled: site.service_notifications_disabled?('myhost', 'myservice') # enable notifications for a service: site.enable_service_notifications('myhost', 'myservice') # disable notifications, and wait for nagios to process it: site.disable_service_notifications('myhost', 'myservice') until site.service_notifications_disabled?('myhost', 'myservice') sleep 3 end To be continue? == Note on Patches/Pull Requests * Fork the project. * Make your feature addition or bug fix. * Add tests for it. This is important so I don't break it in a future version unintentionally. * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) * Send me a pull request. Bonus points for topic branches. == Copyright Copyright (c) 2010 Josh Nichols. See LICENSE for details.