Skip to content
README.rst 3.33 KiB
Newer Older
nimrod's avatar
nimrod committed
My Nagios plugin wrapper
########################

.. image:: https://git.shore.co.il/shore/mnpw/badges/master/pipeline.svg
    :target: https://git.shore.co.il/shore/mnpw/-/commits/master
    :alt: pipeline status

nimrod's avatar
nimrod committed
.. image:: https://git.shore.co.il/shore/mnpw/-/badges/release.svg
    :target: https://git.shore.co.il/shore/mnpw/-/releases
    :alt: latest release

nimrod's avatar
nimrod committed
The goal of this project is running Nagios plugins without a monitoring system.
It is intended for my personal use as the warning and critical alerts go to `my
notification mechanism <https://git.shore.co.il/nimrod/nextcloud-notifier>`_.
There is a small-ish binary that is created in the CI pipeline that doesn't have
any external dependencies (like the Python VM or any 3rd party Python packages).
nimrod's avatar
nimrod committed
The latest binary is available at
nimrod's avatar
nimrod committed
https://git.shore.co.il/shore/mnpw/-/jobs/artifacts/master/raw/dist/mnpw?job=build-executable
and should work all Linux distro with glibc 2.17 or newer.

Usage
-----

.. code:: shell

  usage: mnpw [-h] [-v] [-V] [-c] [-d] [-q] [-w] [-u] [-e] [-t TIMEOUT]
              command [arguments ...]
nimrod's avatar
nimrod committed

nimrod's avatar
nimrod committed
  My Nagios plugin wrapper.
nimrod's avatar
nimrod committed

nimrod's avatar
nimrod committed
  positional arguments:
    command               Plugin command
    arguments             Command arguments
nimrod's avatar
nimrod committed

nimrod's avatar
nimrod committed
  optional arguments:
    -h, --help            show this help message and exit
    -v, --verbose         Verbose output
    -V, --version         show program's version number and exit
    -c, --chain           Echo the check output and exit with the same exit
                          code, allow for chaining with plugin handlers.
nimrod's avatar
nimrod committed
    -d, --dry-run         Dry-run, don't notify
    -q, --quiet, --silent
                          No output, except for errors.
    -w, --warn            Notify when the check status is WARNING.
    -u, --unknown         Notify when the check status is UNKNOWN.
    -e, --errors          Notify on check errors.
    -t TIMEOUT, --timeout TIMEOUT
                          Command timeout (in seconds), defaults to 10
nimrod's avatar
nimrod committed

nimrod's avatar
nimrod committed
Usage as library
----------------

Although the CLI is of little use to anybody but me, you may find the Nagios
plugin handling useful and would want to use it. The package is not published to
nimrod's avatar
nimrod committed
PyPI so your best option is getting a direct download of the wheel package from
the `releases pages <https://git.shore.co.il/shore/mnpw/-/releases>`_.
nimrod's avatar
nimrod committed

Development
-----------

For local development, the following is required:

- Python 3.6 or newer.
- `Poetry <https://python-poetry.org/>`_.
- `Bats <https://bats-core.readthedocs.io/en/stable/>`_.
- Make.

To run all of the tests locally:

.. code:: shell

   poetry install
   poetry run pre-commit run --all-files
   poetry run pytest
   poetry run make bats

All of those tests (and more) run in the `CI pipeline
<https://git.shore.co.il/shore/mnpw/-/pipelines>`_ on each push.

nimrod's avatar
nimrod committed
To release a new version:

.. code:: shell

    poetry run bumpversion major|minor|patch
    git push --follow-tags

This will commit the version change, tag and push it and the pipeline will
release a new version.

nimrod's avatar
nimrod committed
License
-------

This software is licensed under the MIT license (see the :code:`LICENSE.txt`
file).

Author
------

Nimrod Adar, `contact me <nimrod@shore.co.il>`_ or visit my `website
<https://www.shore.co.il/>`_. Patches are welcome via `git send-email
<http://git-scm.com/book/en/v2/Git-Commands-Email>`_. The repository is located
at: https://git.shore.co.il/nimrod/.