From 26a1b3dbe856322d234bcc9414af92851eb746c7 Mon Sep 17 00:00:00 2001 From: Ricardo Bartels Date: Fri, 10 May 2019 11:21:34 +0200 Subject: [PATCH 1/2] added icinga2 command definitions --- README.md | 5 +- contrib/icinga2_check_command_definition.conf | 104 ++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 contrib/icinga2_check_command_definition.conf diff --git a/README.md b/README.md index b021554..1da08f5 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,10 @@ define command{ ``` -More info about options in Usage. +## Icinga2 configuration + +The Icinga2 command definition can be found here: (contrib/icinga2_check_command_definition.conf) + ## License diff --git a/contrib/icinga2_check_command_definition.conf b/contrib/icinga2_check_command_definition.conf new file mode 100644 index 0000000..a8bfc49 --- /dev/null +++ b/contrib/icinga2_check_command_definition.conf @@ -0,0 +1,104 @@ +object CheckCommand "http_json" { + import "plugin-check-command" + + command = [ PluginDir + "/check_http_json.py" ] + + arguments = { + "--host" = { + value = "$address$" + description = "Hostname or address of the interface to query" + required = true + } + "--port" = { + value = "$http_json_port$" + description = "TCP port number" + } + "--path" = { + value = "$http_json_path$" + description = "URL path to query (i.e.: /v1/service/xyz)" + } + "--timeout" = { + value = "$http_json_timeout$" + description = "Connection timeout (seconds)" + } + "--basic-auth" = { + value = "$http_json_basic_auth$" + description = "Basic auth string 'username:password'" + } + "--ssl" = { + set_if = "$http_json_ssl$" + description = "use TLS to connect to remote host" + } + "--insecure" = { + set_if = "$http_json_insecure$" + description = "do not check server SSL certificate" + } + "--cacert" = { + value = "$http_json_cacert_file$" + description = "path of cacert file to validate server cert" + } + "--cert" = { + value = "$http_json_cert_file$" + description = "client certificate in PEM format" + } + "--key" = { + value = "$http_json_key_file$" + description = "client certificate key file in PEM format ( if not bundled into the cert )" + } + "--data" = { + value = "$http_json_post_data$" + description = "the http payload to send as a POST" + } + "--headers" = { + value = "$http_json_headers$" + description = "additional http headers in JSON format to send with the request" + } + + "--field_separator" = { + value = "$http_json_field_separator$" + description = "JSON Field separator, defaults to '.'; Select element in an array with '(' ')'" + } + + "--warning" = { + value = "$http_json_warning$" + description = "Warning threshold for these values, WarningRange is in the format [@]start:end" + } + "--critical" = { + value = "$http_json_critical$" + description = "Critical threshold for these values, CriticalRange is in the format [@]start:end" + } + "--key_exists" = { + value = "$http_json_key_exists$" + description = "Checks existence of these keys to determine status. Return warning if key is not present." + } + "--key_exists_critical" = { + value = "$http_json_key_exists_critical$" + description = "Checks existence of these keys to determine status. Return critical if key is not present." + } + "--key_equals" = { + value = "$http_json_key_equals$" + description = "Checks equality of these keys and values. Return warning if equality check fails" + } + "--key_equals_critical" = { + value = "$http_json_key_equals_critical$" + description = "Checks equality of these keys and values. Return critical if equality check fails" + } + "--key_equals_unknown" = { + value = "$http_json_key_equals_unknown$" + description = "Checks equality of these keys and values. Return unknown if equality check fails" + } + "--key_not_equals" = { + value = "$http_json_key_not_equals$" + description = "Checks equality of these keys and values (key[>alias],value key2,value2) to determine status. Multiple key values can be delimited with colon (key,value1:value2). Return warning if equality check succeeds." + } + "--key_not_equals_critical" = { + value = "$http_json_key_not_equals_critical$" + description = "Checks equality of these keys and values (key[>alias],value key2,value2) to determine status. Multiple key values can be delimited with colon (key,value1:value2). Return critical if equality check succeeds." + } + "--key_metrics" = { + value = "$http_json_key_metrics$" + description = "Gathers the values of these keys" + } + } +} + From aad2376ac0e9f1b055151e690dd3c978970bc112 Mon Sep 17 00:00:00 2001 From: Ricardo Bartels Date: Thu, 2 Apr 2020 08:39:42 +0200 Subject: [PATCH 2/2] added missing cli args for V2.0 --- contrib/icinga2_check_command_definition.conf | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/contrib/icinga2_check_command_definition.conf b/contrib/icinga2_check_command_definition.conf index a8bfc49..1c034e1 100644 --- a/contrib/icinga2_check_command_definition.conf +++ b/contrib/icinga2_check_command_definition.conf @@ -1,9 +1,9 @@ object CheckCommand "http_json" { - import "plugin-check-command" + import "plugin-check-command" - command = [ PluginDir + "/check_http_json.py" ] + command = [ PluginDir + "/check_http_json.py" ] - arguments = { + arguments = { "--host" = { value = "$address$" description = "Hostname or address of the interface to query" @@ -53,12 +53,14 @@ object CheckCommand "http_json" { value = "$http_json_headers$" description = "additional http headers in JSON format to send with the request" } - "--field_separator" = { value = "$http_json_field_separator$" description = "JSON Field separator, defaults to '.'; Select element in an array with '(' ')'" } - + "--value_separator" = { + value = "$http_json_value_separator$" + description = "JSON Value separator, defaults to ':'" + } "--warning" = { value = "$http_json_warning$" description = "Warning threshold for these values, WarningRange is in the format [@]start:end"