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.1.tar.gz (18.4 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.1-py2.py3-none-any.whl (18.0 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for monitool-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b67d7e83812dec06fce44d9a574b820bcba36b8fb4f8d2e0369df12adcc37d7d
MD5 db1ba262088d7294b370bff48f9b8a8d
BLAKE2b-256 dcb9d07be7392c80d3917f07e1f6fa660b44fbd5984ef4738a1885db262d9fe9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for monitool-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e23cea0c32b9767a328b8e7e6c7cc81bdbd600a4d977ad6733a20f166c48ee53
MD5 694ed75524b4b2d1986ca1d3d66d3f2d
BLAKE2b-256 d1671ddb8f37028677e6d58a86e6b953c57b232d49f9b8ad5998bb8d12142009

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