]> granicus.if.org Git - icinga2/commitdiff
Add ipv4/ipv6 only to tcp, udp and http CheckCommand
authorSebastian Chrostek <sebastian@chrostek.net>
Sun, 1 Nov 2015 15:33:02 +0000 (16:33 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Mon, 2 Nov 2015 07:32:04 +0000 (08:32 +0100)
fixes #10513

Signed-off-by: Gunnar Beutner <gunnar@beutner.name>
doc/7-icinga-template-library.md
itl/command-plugins.conf

index cb1e3cafaffa3f7f4c57f51fd3d450752d1b2d99..cddc31bb4cee491f70d11053b84b934407a17af3 100644 (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
@@ -516,8 +518,8 @@ nrpe_no_ssl     | **Optional.** Whether to disable SSL or not. Defaults to `fals
 nrpe_timeout_unknown | **Optional.** Whether to set timeouts to unknown instead of critical state. Defaults to `false`.
 nrpe_timeout    | **Optional.** The timeout in seconds.
 nrpe_arguments | **Optional.** Arguments that should be passed to the command. Multiple arguments must be defined as array.
-nrpe_ipv4      | **Optional.** Use IPv4 only.
-nrpe_ipv6      | **Optional.** Use IPv6 only.
+nrpe_ipv4       | **Optional.** Use IPv4 only.
+nrpe_ipv6       | **Optional.** Use IPv6 only.
 
 
 ### <a id="plugin-check-command-nscp"></a> nscp
@@ -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
index 88b8d62443ad48b07387d2ca5f2e87848bdb93f4..8d640a4d4fd03851985b5e1f72c4c3da392488a0 100644 (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
 }