Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
check_nwc_health command for Icinga 2
object CheckCommand "nwc_health" {
import "plugin-check-command"
command = [ "/etc/icinga2/plugins/check_nwc_health" ]
arguments = {
"-H" = "$nwc_address$"
"--community" = "$snmp_community$"
"--protocol" = "$snmp_protocol$"
"--mode" = "$nwc_mode$"
"--warning" = "$nwc_warning$"
"--critical" = "$nwc_critical$"
"--name" = "$nwc_name$"
}
vars.snmp_community = "public"
vars.nwc_address = "$address$"
vars.nwc_timeout = 15
vars.snmp_protocol = "2c"
}
object Host "core-switch" {
import "generic-host"
address = "127.0.0.1"
vars.snmp_community = "mysecretpublic"
vars.interfaces["GigabitEthernet0/1"] = {
description = "Management"
}
vars.interfaces["GigabitEthernet0/2"] = {
description = "Uplink 1"
}
vars.interfaces["GigabitEthernet0/3"] = {
description = "Uplink 2"
}
vars.interfaces["Port-Channel1"] = {
description = "Main Uplink"
}
}
apply Service "if-status" for (if_name => config in host.vars.interfaces) {
import "generic-service"
name = "interface " + if_name + " status"
notes = config.description
command = "nwc_health"
vars.nwc_mode = "interface-status"
vars.nwc_name = if_name
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment