Python library to write Icinga plugins.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file pycinga-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pycinga-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59d6bc99ef3d20f487bfc3a8114ace969d2db82f4e87340887e42f453d06267f |
|
MD5 | 7a68141fe664a4db0abf34beaf5067ea |
|
BLAKE2b-256 | b46fa41a3b62fe14adf228d2f636005c408a14ec05feac4bbb1c63e8912d2c68 |