mplugin is a Python class library which helps writing Nagios or Icinga compatible plugins easily in Python. It cares for much of the boilerplate code and default logic commonly found in monitoring checks, including:
- Monitoring Plugin API compliant parameters and output formatting
- Full monitoring range syntax support
- Automatic threshold checking
- Multiple independend measures
- Custom status line to communicate the main point quickly
- Long output and performance data
- Timeout handling
- Persistent "cookies" to retain state information between check runs
- Resume log file processing at the point where the last run left
- No dependencies beyond the Python standard library.
mplugin runs on POSIX and Windows systems. It is compatible with and Python 3.10 and later.
This is a fork of the nagiosplugin. Changes:
- Drop support for Python versions 3.9 and below
- Add type hints
- Remove deprecated code:
ScalarResult - Rename all four service state objects to lower-class names. For example,
Okwas renamed took, and so on - Rename the warning state from
warntowarning - Export the class
ServiceState - Convert all namped tuples in classes (
Metric,Performance,ServiceState) - Remove
compat.py - Replace the
result_clsattribute with aresultmethod - Add helper methods
ok(),warning(),critical(),unknown()inContext - Add the
setup_argparsefunction - Merge all code into a single source file,
- Merge the entire code base into a single file to make it easier to embed the code in a monitoring plugin instead of importing it. This allows a plugin to be implemented without dependencies.
- Do not remove leading unfilled semicolons in the rendered performance data
- Add additional parameters (
invert,start,end) to the constructor of theRangeclass - Allow the return of multiple performance data points in the
Context.performancemethod - Move timespan related code into a subpackage named
timespan.py - Add the
convert_timespan_to_sec()function to convert time interval strings, such as2h30min, into seconds. - Add class
Timespan - Remove unused argument
linebreakin the methodOutput.format_perfdata() - Rename
verbose_strintoverboseandsummary_strintosummary
mplugin is currently maintained by Josef Friedrich <[email protected]>. A public issue tracker can be found at <https://github.com/Josef-Friedrich/mplugin/issues> for bugs, suggestions, and patches.
The mplugin package is released under the Zope Public License 2.1 (ZPL), a BSD-style Open Source license.
Comprehensive documentation is available online. The examples mentioned in the tutorials can also be found in the examples directory of the source distribution.
mplugin was originally written and maintained by Christian Kauhaus <[email protected]>. Additional contributions from the community are acknowledged in the file CONTRIBUTORS.txt