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.
- Install and configure NRDP.
gem install nagios_nrdp
- 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)
- Fork it ( https://github.com/stjeanp/nagios_nrdp/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request