Add ipv4/ipv6 only to tcp, udp and http CheckCommand

fixes #10513

Signed-off-by: Gunnar Beutner <gunnar@beutner.name>
This commit is contained in:
Sebastian Chrostek 2015-11-01 16:33:02 +01:00 committed by Gunnar Beutner
parent 3134e446c5
commit a2c09a122b
2 changed files with 46 additions and 5 deletions

View File

@ -424,6 +424,8 @@ http_extendedperfdata | **Optional.** Print additional perfdata. Defaults to
http_onredirect | **Optional.** How to handle redirect pages. Possible values: "ok" (default), "warning", "critical", "follow", "sticky" (like follow but stick to address), "stickyport" (like sticky but also to port)
http_pagesize | **Optional.** Minimum page size required:Maximum page size required.
http_timeout | **Optional.** Seconds before connection times out.
http_ipv4 | **Optional.** Use IPv4 only.
http_ipv6 | **Optional.** Use IPv6 only.
### <a id="plugin-check-command-icmp"></a> icmp
@ -874,6 +876,8 @@ 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.
tcp_ipv4 | **Optional.** Use IPv4 only.
tcp_ipv6 | **Optional.** Use IPv6 only.
### <a id="plugin-check-command-udp"></a> udp
@ -889,6 +893,8 @@ udp_port | **Required.** The port that should be checked.
udp_send | **Required.** The payload to send in the UDP datagram.
udp_expect | **Required.** The payload to expect in the response datagram.
udp_quit | **Optional.** The payload to send to 'close' the session.
udp_ipv4 | **Optional.** Use IPv4 only.
udp_ipv6 | **Optional.** Use IPv6 only.
### <a id="plugin-check-command-ups"></a> ups

View File

@ -22,12 +22,15 @@ template CheckCommand "ipv4-or-ipv6" {
var addr_v4 = macro("$address$")
var addr_v6 = macro("$address6$")
if (addr_v4) {
if (addr_v4 && !macro("$check_ipv6$") || macro("$check_ipv4$")) {
return addr_v4
} else {
return addr_v6
}
}}
vars.check_ipv4 = false
vars.check_ipv6 = false
}
template CheckCommand "ping-common" {
@ -243,6 +246,14 @@ object CheckCommand "tcp" {
value = "$tcp_timeout$"
description = "Seconds before connection times out. Defaults to 10."
}
"-4" = {
set_if = "$tcp_ipv4$"
description = "Use IPv4 only"
}
"-6" = {
set_if = "$tcp_ipv6$"
description = "Use IPv6 only"
}
}
vars.tcp_address = "$check_address$"
@ -250,6 +261,8 @@ object CheckCommand "tcp" {
vars.tcp_refuse = "crit"
vars.tcp_mismatch = "warn"
vars.tcp_timeout = 10
vars.check_ipv4 = "$tcp_ipv4$"
vars.check_ipv6 = "$tcp_ipv6$"
}
object CheckCommand "ssl" {
@ -289,9 +302,19 @@ object CheckCommand "udp" {
required = true
}
"-q" = "$udp_quit$"
"-4" = {
set_if = "$udp_ipv4$"
description = "Use IPv4 only"
}
"-6" = {
set_if = "$udp_ipv6$"
description = "Use IPv6 only"
}
}
vars.udp_address = "$check_address$"
vars.check_ipv4 = "$udp_ipv4$"
vars.check_ipv6 = "$udp_ipv6$"
}
object CheckCommand "http" {
@ -404,6 +427,14 @@ object CheckCommand "http" {
value = "$http_timeout$"
description = "Seconds before connection times out"
}
"-4" = {
set_if = "$http_ipv4$"
description = "Use IPv4 only"
}
"-6" = {
set_if = "$http_ipv6$"
description = "Use IPv6 only"
}
}
vars.http_address = "$check_address$"
@ -411,6 +442,8 @@ object CheckCommand "http" {
vars.http_sni = false
vars.http_linespan = false
vars.http_invertregex = false
vars.check_ipv4 = "$http_ipv4$"
vars.check_ipv6 = "$http_ipv6$"
}
object CheckCommand "ftp" {
@ -1382,17 +1415,19 @@ object CheckCommand "nrpe" {
}
"-4" = {
set_if = "$nrpe_ipv4$"
description = "Use ipv4 only"
description = "Use IPv4 only"
}
"-6" = {
set_if = "$nrpe_ipv6$"
description = "Use ipv6 only"
description = "Use IPv6 only"
}
}
vars.nrpe_address = "$check_address$"
vars.nrpe_no_ssl = false
vars.nrpe_timeout_unknown = false
vars.check_ipv4 = "$nrpe_ipv4$"
vars.check_ipv6 = "$nrpe_ipv6$"
timeout = 5m
}