Skip to content

A python template for making writting NRPE compatable plugins easy.

License

Notifications You must be signed in to change notification settings

timdaman/nrpe_template

Repository files navigation

Build Status Code Climate Test Coverage

Author: Tim Laurence

This is a sample NRPE compatible plugin. It contains many help functions which should make writing your own checks fast and easy. It supports for both python 2.7 and 3.

Right now it tests the current time as returned from a remote service to see if it meets certain standards. You can use this an example fo rhow to impliment your own checks.

For example run this during second 31 for an OK

 python sample_plugin.py --prime --good 31 32 33 34 35 36 37 38 39 40 --below_range 40:50

Other times will generally be critical

Hints for using this:

  • Rather then returning statues information directly use the helper functions; ok('message'), warning('message'), critical('message'), unknown('message'),
  • When sensible please don't forget to include performance data. There is a function called add_performance_data() to make this easy
  • Try to avoid importing libraries outside of the standard library. Doing so can make it harder to run your plug-in on and the various servers that may end up running it. By sticking to the standard library this should run most places where python is installed
  • Test your code with python 2.7 and to ensure it works on current and future python releases
  • The Requests package is awesome but not included in the standard library. :( As an aid I have wrapped urllib to make it easier to make http requests by using the following helper functions; get_url(), get_url_ascii, get_url_utf8(), and get_url_json(). You are welcome.
  • I have included a logger to make it easy to debug while developing and then turn off that output. Use logger.debug('your message') for development. Comment or uncomment the line above the declaration for 'logger; to turning this output on and off.

Credits:

About

A python template for making writting NRPE compatable plugins easy.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages