Wrap IPv6 addresses in udp6:[<addr>] for check_snmp

refs #8259
This commit is contained in:
Gunnar Beutner 2015-02-13 12:11:53 +01:00
parent bb033b5ce3
commit 1f05cc23d1
1 changed files with 11 additions and 2 deletions

View File

@ -718,7 +718,6 @@ object CheckCommand "load" {
object CheckCommand "snmp" {
import "plugin-check-command"
import "ipv4-or-ipv6"
command = [ PluginDir + "/check_snmp" ]
@ -740,7 +739,17 @@ object CheckCommand "snmp" {
}
}
vars.snmp_address = "$check_address$"
vars.snmp_address = {{
var addr_v4 = macro("$address$")
var addr_v6 = macro("$address6$")
if (addr_v4) {
return addr_v4
} else {
return "udp6:[" + addr_v6 + "]"
}
}}
vars.snmp_community = "public"
vars.snmp_invert_search = false
vars.snmp_timeout = "10"