Skip to content

A library for submitting passive checks to Nagios NRDP endpoints

License

Notifications You must be signed in to change notification settings

alexforster/nrdpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nrdpy

Overview

nrdpy is a library for submitting passive checks to Nagios NRDP endpoints.

Example

from nrdpy import NRDP, HostResult, ServiceResult

# create a "host check" result

host_result = HostResult(host='server.local')

rtt = do_ping('server.local')

if rtt is not None:
    host_result.state = HostResult.Up
    host_result.output = '{}ms RTT'.format(rtt)
    host_result.add_perf_data('rtt', rtt, units='ms')
else:
    host_result.state = HostResult.Down

# create a "service check" result

service_result = ServiceResult(host='server.local', service='ssh')

connected = do_tcp_connect('server.local', port=22)

if connected == True:
    service_result.state = ServiceResult.Ok
else:
    service_result.state = ServiceResult.Critical

# submit check results

nagios = NRDP(endpoint='http://nagios.local/nrdp', token='psD0u8RUbeq')

nagios.submit(results=[host_result, service_result])

About

A library for submitting passive checks to Nagios NRDP endpoints

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages