Skip to content

Instantly share code, notes, and snippets.

@lazyfrosch
Last active June 26, 2018 14:54
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazyfrosch/005c8becab82c712681c to your computer and use it in GitHub Desktop.
Save lazyfrosch/005c8becab82c712681c to your computer and use it in GitHub Desktop.
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