Skip to main content

Pycinga is a simple Python library meant to make writing Icinga plugins much easier. Icinga plugins have quite a few guidelines to adhere to, and Pycinga provides helpers to make this easy.

Install

To install, simply use pip or easy_install:

pip install pycinga

Documentation

Documentation for the latest version can always be found at http://pycinga.readthedocs.io/en/latest.

Features

The core features supported by Pycinga:

  • Parsing command line arguments such that the standard expected arguments (such as -H, -w, -c) are accepted.

  • Returning proper POSIX exit code based on status.

  • Parsing Icinga range formats (such as “@10:20”, “~:50”, “10”, etc.)

  • Outputting status and message.

  • Outputting performance data.

Example

What all these features result in is a concise, simple, and guidelines-compliant Python-based Icinga plugin:

from pycinga import Plugin

class UserCheck(Plugin):
    """
    Icinga plugin to check how many users are logged into this
    machine.
    """

    def check(self):
        # Get the number of logged in users, for now we hardcode
        users = 27

        # Build a response and exit. This `response_for_value` automatically
        # creates a response with the proper status given the value and the
        # warning/critical ranges passed in via the command line.
        response = self.response_for_value(users, "%d users" % users)
        response.set_perf_data("users", users)
        response.set_perf_data("another metric", 27, "MB")
        return response

if __name__ == '__main__':
    # Build the plugin instance and run it. This will also parse
    # command line arguments by default.
    UserCheck().check().exit()

While the above example subclasses Plugin, you’re of course welcome to simply call Plugin`s methods directly and build a ``Response` yourself.

Metadata

Release files for pycinga 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycinga 1.0.1
File Size Uploaded
pycinga-1.0.1.tar.gz 10.8 kB Details

Release files / pycinga-1.0.1.tar.gz

Download URL pycinga-1.0.1.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
68f31ea79e6c67bf85fd238fd812ba21581a610d47c5dd50f088f82b6002230f
BLAKE2b-256 checksum
How to use checksums
7834853f4180e057d6012a3aeb93210927686fcb59276674ed7e26899138b975
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.1

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page