Nagios::Nrdp

Build Status Coverage Status

About

The Nagios::Nrdp module provides the ability to submit passive check results and commands to a Nagios server using NRDP. It currenly only supports token based authentication.

Installation Instructions

  1. Install and configure NRDP.
  2. gem install nagios_nrdp

Basic Usage

  • Send a host passive check
require 'nagios_nrdp'

url = 'http://some.host/nrdp'
token = 'your token'
hostname = 'hostname'
state = 1
output = 'DOWN'

nrdp = Nagios::Nrdp.new(url: url, token: token)
nrdp.submit_check(hostname: hostname, state: state.to_i, output: output)
  • Send a service passive check:
require 'nagios_nrdp'

url = 'http://some.host/nrdp'
token = 'your token'
hostname = 'hostname'
servicename = 'service'
state = 1
output = 'DOWN'

nrdp = Nagios::Nrdp.new(url: url, token: token)
nrdp.submit_check(hostname: hostname, servicename: servicename, state: state.to_i, output: output)
  • Send multiple passive checks:
require 'nagios_nrdp'

url = 'http://some.host/nrdp'
token = 'your token'
checks = [{ hostname: 'host1', state: 1, output: 'DOWN' },
          { hostname: 'host2', state: 0, output: 'UP' }]

nrdp = Nagios::Nrdp.new(url: url, token: token)
nrdp.submit_checks(checks)
  • Send a command:
require 'nagios_nrdp'

url = 'http://some.host/nrdp'
token = 'your token'
command = 'COMMAND;hostname'

nrdp = Nagios::Nrdp.new(url: url, token: token)
nrdp.submit_command(command)

Contributing

  1. Fork it ( https://github.com/stjeanp/nagios_nrdp/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request