Add check command negate.

fixes #10507

Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>
This commit is contained in:
Lennart Betz 2015-11-01 12:31:58 +01:00 committed by Michael Friedrich
parent cdfc283395
commit 5c8386b388
2 changed files with 55 additions and 1 deletions

View File

@ -986,7 +986,6 @@ pgsql_query | **Optional.** SQL query to run. Only first column in first row wi
pgsql_query_warning | **Optional.** SQL query value to result in warning status (double).
pgsql_query_critical | **Optional.** SQL query value to result in critical status (double).
### <a id="plugin-check-command-mysql"></a> mysql
Check command object for the `check_mysql` plugin.
@ -995,6 +994,7 @@ Custom attributes passed as [command parameters](3-monitoring-basics.md#command-
Name | Description
------------------------|---------------------------------------------------------------
<<<<<<< HEAD
mysql_hostname | **Optional.** Host name, IP Address, or unix socket (must be an absolute path).
mysql_port | **Optional.** Port number (default: 3306).
mysql_ignore_auth | **Optional.** Ignore authentication failure and check for mysql connectivity only.
@ -1013,6 +1013,23 @@ mysql_key | **Optional.** Path to private SSL key.
mysql_cadir | **Optional.** Path to CA directory.
mysql_ciphers | **Optional.** List of valid SSL ciphers.
### <a id="plugin-check-command-negate"></a> negate
Check command object for the `negate` plugin.
Custom attributes passed as [command parameters](3-monitoring-basics.md#command-passing-parameters):
Name | Description
------------------------|---------------------------------------------------------------
negate_timeout | **Optional.** Seconds before plugin times out (default: 11).
negate_timeout_result | **Optional.** Custom result on Negate timeouts, default to UNKNOWN.
negate_ok | **Optional.** OK, WARNING, CRITICAL or UNKNOWN.
negate_warning | Numeric values are accepted.
negate_critical | If nothing is specified, permutes OK and CRITICAL.
negate_substitute | **Optional.** Substitute output text as well. Will only substitute text in CAPITALS.
negate_command | **Required.** Command to be negated.
negate_arguments | **Optional.** Arguments for the negated command.
## <a id="windows-plugins"></a> Windows Plugins for Icinga 2

View File

@ -1702,3 +1702,40 @@ object CheckCommand "mysql" {
vars.mysql_hostname = "$check_address$"
}
object CheckCommand "negate" {
import "plugin-check-command"
command = [ PluginDir + "/negate" ]
arguments = {
"-t" = "$negate_timeout$"
"-T" = "$negate_timeout_result$"
"-o" = "$negate_ok$"
"-w" = "$negate_warning$"
"-c" = "$negate_critical$"
"-s" = {
set_if = "$negate_substitute$"
}
"--wrapped-plugin" = {
value = {{
var command = macro("$negate_command$")
var arguments = macro("$negate_arguments$")
if (typeof(command) == String && !arguments) {
return command
}
var escaped_args = []
for (arg in resolve_arguments(command, arguments)) {
escaped_args.add(arg)
}
return escaped_args.join(" ")
}}
skip_key = true
order = 1
}
}
vars.negate_timeout_result = "UNKNOWN"
}