From afb2ef7b88d986c7882dc06c02026cd3e4995b6a Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Wed, 9 Apr 2025 17:15:19 +0200 Subject: [PATCH] Update README - Improve structure a bit, moving the installation first and usage second --- README.md | 93 +++++++++++++++++++++++++------------------------------ 1 file changed, 42 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 1b80eed..a6325ec 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,50 @@ This is a generic plugin for Nagios which checks json values from a given HTTP endpoint against argument specified rules and determines the status and performance data for that service. -## Links +## Installation -* [CLI Usage](#cli-usage) -* [Examples](#examples) - * [Riak Stats](docs/RIAK.md) - * [Docker](docs/DOCKER.md) -* [Nagios Installation](#nagios-installation) +Requirements: -## CLI Usage +* Python 3.6+ + +### Nagios + +Assuming a standard installation of Nagios, the plugin can be executed from the machine that Nagios is running on. + +```bash +cp check_http_json.py /usr/local/nagios/libexec/plugins/check_http_json.py +chmod +x /usr/local/nagios/libexec/plugins/check_http_json.py +``` + +Add the following service definition to your server config (`localhost.cfg`): + +``` + +define service { + use local-service + host_name localhost + service_description + check_command + } + +``` + +Add the following command definition to your commands config (`commands.config`): + +``` + +define command{ + command_name + command_line /usr/bin/python /usr/local/nagios/libexec/plugins/check_http_json.py -H : -p [-e|-q|-w|-c ] [-m ] + } + +``` + +### Icinga2 + +An example Icinga2 command definition can be found here: (`contrib/icinga2_check_command_definition.conf`) + +## Usage Executing `./check_http_json.py -h` will yield the following details: @@ -259,50 +294,6 @@ More info and examples the about Timestamp Format can be found at [https://docs. * `./check_http_json.py -H : -p -A '{"content-type": "application/json"}' -w "metric,RANGE"` -## Nagios Installation - -### Requirements - -* Python 3.6+ - -### Configuration - -Assuming a standard installation of Nagios, the plugin can be executed from the machine that Nagios is running on. - -```bash -cp check_http_json.py /usr/local/nagios/libexec/plugins/check_http_json.py -chmod +x /usr/local/nagios/libexec/plugins/check_http_json.py -``` - -Add the following service definition to your server config (`localhost.cfg`): - -``` - -define service { - use local-service - host_name localhost - service_description - check_command - } - -``` - -Add the following command definition to your commands config (`commands.config`): - -``` - -define command{ - command_name - command_line /usr/bin/python /usr/local/nagios/libexec/plugins/check_http_json.py -H : -p [-e|-q|-w|-c ] [-m ] - } - -``` - -## Icinga2 configuration - -The Icinga2 command definition can be found here: (contrib/icinga2_check_command_definition.conf) - - ## License Copyright 2014-2015 Drew Kerrigan.