Add arguments to "tcp" CheckCommand

fixes #9147

Signed-off-by: Gunnar Beutner <gunnar@beutner.name>
This commit is contained in:
Tobias von der Krone 2015-04-22 09:15:58 +02:00 committed by Gunnar Beutner
parent 2b8530be7c
commit 306bb71f63
2 changed files with 102 additions and 5 deletions

View File

@ -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_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_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.
## <a id="plugin-check-command-udp"></a> udp ## <a id="plugin-check-command-udp"></a> udp

View File

@ -162,13 +162,94 @@ object CheckCommand "tcp" {
import "plugin-check-command" import "plugin-check-command"
import "ipv4-or-ipv6" import "ipv4-or-ipv6"
command = [ command = [ PluginDir + "/check_tcp" ]
PluginDir + "/check_tcp",
"-H", "$tcp_address$", arguments = {
"-p", "$tcp_port$" "-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_address = "$check_address$"
vars.tcp_all = false
vars.tcp_refuse = "crit"
vars.tcp_mismatch = "warn"
vars.tcp_timeout = 10
} }
object CheckCommand "ssl" { object CheckCommand "ssl" {