From 306bb71f63a0ec0b697888a613e11848175a808f Mon Sep 17 00:00:00 2001 From: Tobias von der Krone Date: Wed, 22 Apr 2015 09:15:58 +0200 Subject: [PATCH] Add arguments to "tcp" CheckCommand fixes #9147 Signed-off-by: Gunnar Beutner --- doc/7-icinga-template-library.md | 16 ++++++ itl/command-plugins.conf | 91 ++++++++++++++++++++++++++++++-- 2 files changed, 102 insertions(+), 5 deletions(-) diff --git a/doc/7-icinga-template-library.md b/doc/7-icinga-template-library.md index da80de1bf..e2d6fe3b0 100644 --- a/doc/7-icinga-template-library.md +++ b/doc/7-icinga-template-library.md @@ -745,6 +745,22 @@ Name | Description ----------------|-------------- tcp_address | **Optional.** The host's address. Defaults to "$address$" if the host's `address` attribute is set, "$address6$" otherwise. tcp_port | **Required.** The port that should be checked. +tcp_expect | **Optional.** String to expect in server response (may be repeated). +tcp_all | **Optional.** All expect strings need to occur in server response. Defaults to false. +tcp_escape_send | **Optional.** Enable usage of \n, \r, \t or \\\\ in send string. +tcp_send | **Optional.** String to send to the server. +tcp_escape_quit | **Optional.** Enable usage of \n, \r, \t or \\\\ in quit string. +tcp_quit | **Optional.** String to send server to initiate a clean close of the connection. +tcp_refuse | **Optional.** Accept TCP refusals with states ok, warn, crit. Defaults to crit. +tcp_mismatch | **Optional.** Accept expected string mismatches with states ok, warn, crit. Defaults to warn. +tcp_jail | **Optional.** Hide output from TCP socket. +tcp_maxbytes | **Optional.** Close connection once more than this number of bytes are received. +tcp_delay | **Optional.** Seconds to wait between sending string and polling for response. +tcp_certificate | **Optional.** Minimum number of days a certificate has to be valid. 1st value is number of days for warning, 2nd is critical (if not specified: 0) - seperated by comma. +tcp_ssl | **Optional.** Use SSL for the connection. Defaults to false. +tcp_wtime | **Optional.** Response time to result in warning status (seconds). +tcp_ctime | **Optional.** Response time to result in critical status (seconds). +tcp_timeout | **Optional.** Seconds before connection times out. Defaults to 10. ## udp diff --git a/itl/command-plugins.conf b/itl/command-plugins.conf index 4c30ae10f..534b3a6e1 100644 --- a/itl/command-plugins.conf +++ b/itl/command-plugins.conf @@ -162,13 +162,94 @@ object CheckCommand "tcp" { import "plugin-check-command" import "ipv4-or-ipv6" - command = [ - PluginDir + "/check_tcp", - "-H", "$tcp_address$", - "-p", "$tcp_port$" - ] + command = [ PluginDir + "/check_tcp" ] + + arguments = { + "-H" = { + value = "$tcp_address$" + description = "Host name, IP Address, or unix socket (must be an absolute path)." + } + "-p" = { + value = "$tcp_port$" + description = "The TCP port number." + } + "-e" = { + value = "$ftp_expect$" + description = "String to expect in server response (may be repeated)." + } + "-A" = { + set_if = "$tcp_all$" + description = "All expect strings need to occur in server response. Defaults to false." + } + "-E_send" = { + key = "-E" + order = 1 + set_if = "$tcp_escape_send$" + description = "Enable usage of \n, \r, \t or \\ in send string. + } + "-s" = { + order = 2 + value = "$tcp_send$" + description = "String to send to the server." + } + "-E_quit" = { + key = "-E" + order = 3 + set_if = "$tcp_escape_quit$" + description = "Enable usage of \n, \r, \t or \\ in quit string. + } + "-q" = { + order = 4 + value = "$tcp_quit$" + description = "String to send server to initiate a clean close of the connection." + } + "-r" = { + value = "$tcp_refuse$" + description = "Accept TCP refusals with states ok, warn, crit. Defaults to crit." + } + "-M" = { + value = "$tcp_mismatch$" + description = "Accept expected string mismatches with states ok, warn, crit. Defaults to warn." + } + "-j" = { + set_if = "$tcp_jail$" + description = "Hide output from TCP socket." + } + "-m" = { + value = "$tcp_maxbytes$" + description = "Close connection once more than this number of bytes are received." + } + "-d" = { + value = "$tcp_delay$" + description = "Seconds to wait between sending string and polling for response." + } + "-D" = { + value = "$tcp_certificate$" + description = "Minimum number of days a certificate has to be valid. 1st value is number of days for warning, 2nd is critical (if not specified: 0) - seperated by comma." + } + "-S" = { + set_if = "$tcp_ssl$" + description = "Use SSL for the connection." + } + "-w" = { + value = "$tcp_wtime$" + description = "Response time to result in warning status (seconds)." + } + "-c" = { + value = "$tcp_ctime$" + description = "Response time to result in critical status (seconds)." + } + "-t" = { + value = "$tcp_timeout$" + description = "Seconds before connection times out. Defaults to 10." + } + } vars.tcp_address = "$check_address$" + vars.tcp_all = false + vars.tcp_refuse = "crit" + vars.tcp_mismatch = "warn" + vars.tcp_timeout = 10 } object CheckCommand "ssl" { -- 2.40.0