Skip to main content

A little library for writing monitoring plugins for Nagios, Icinga, and probably others that are ABI-compatible.

Project description

monitool

A little library for writing monitoring plugins for Nagios, Icinga, and probably others that are ABI-compatible.

Usage

import monitool
from monitool import Info, Perf, Status

# First: define a Plugin class.
class Plugin(monitools.Plugin):
    # Then: set up some defaults
    description = 'My awesome monitoring plugin'

    # single_valued = False
    # If the above is uncommented, doesn't add args.warn (-w) and args.crit
    (-c) automatically

    def configure_parser(self, parser):
        parser.add_argument('arg', type=float, help='The value to check')
        parser.add_argument('unit', default='', help='The unit this value has')

    # Finally: define some checks
    # The Plugin automatically finds `check`, and any method starting with
    `check_`, but you can override `all_checks` to change this
    def check(self, args):
        return Info(
            # status = Status.OK  # Without this, inferred from the Perf data
            head='The arg is {}{}'.format(args.arg, args.unit),
            perf=Perf('arg', args.arg, args.unit, args.warn, args.crit),
        )

if __name__ == '__main__':
    Plugin().main()  # don't forget to run it!

The API is experimental and subject to change. Feedback is welcome!

Further examples are in the examples/ directory; the one above is by no means a complete demonstration.

Specification

This package attempts to conform with the Nagios plugin guidelines. Generally speaking, usage of this library (without malice) that results in an out-of-spec output is a bug. Feel free to report it as such!

License

GPLv3 or later at your option. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

monitool-0.1.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

monitool-0.1-py2.py3-none-any.whl (17.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file monitool-0.1.tar.gz.

File metadata

  • Download URL: monitool-0.1.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for monitool-0.1.tar.gz
Algorithm Hash digest
SHA256 6b2a7f6d430532fb083bd8a02c0c0badab5210d0f78ab25ac77f87ed84c8102e
MD5 db2b556d42da841b5e6e6c1b8f59712d
BLAKE2b-256 04674e380ef56e8a9b04864ca43d073671140a3c9af0e42a1f55ffc63be1d222

See more details on using hashes here.

File details

Details for the file monitool-0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: monitool-0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for monitool-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b1b85d495f80c4e27ab34597c490841f92398512e1c94a3dae5ab0acea63a166
MD5 5db7c11d1a87de28be94107c34705c84
BLAKE2b-256 214cb6a81538bb7f032922761213f08f4bcded5b5255f535736f886bc4651e75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page