How to fix UNKNOWN - check_nwc_health timed out after 30 seconds?

I am using check_nwc_health for monitoring interfaces of network devices. But now continuosly getting UNKNOWN - check_nwc_health timed out after 30 seconds. The below is my check command.

object CheckCommand “check_nwc” {
import “plugin-check-command”
import “ipv4-or-ipv6”
command = [ “/usr/lib64/nagios/plugins/check_nwc_health” ]
arguments = {
“-H” = “$nwc_address$”
“–protocol” = “$snmp_protocol$”
“–username” = “$snmpv3_user$”
“–authpassword” = “$snmpv3_auth_key$”
“–authprotocol” = “$snmpv3_auth_alg$”
“–privprotocol” = “$snmpv3_priv_alg$”
“–privpassword” = “$snmpv3_priv_key$”
“–mode” = “$nwc_mode$”
“–warning” = “$nwc_warning$”
“–critical” = “$nwc_critical$”
“–name” = “$nwc_name$”
“–timeout” = “$nwc_timeout$”

vars.nwc_address = “$check_address$”
vars.snmp_protocol = “3”
vars.snmpv3_user = “some-user”
vars.snmpv3_auth_key = “"
vars.snmpv3_auth_alg = "

vars.snmpv3_priv_alg = “"
vars.snmpv3_priv_key = "

vars.nwc_timeout = “30”

changed the vars.nwc_timeout = “60”. now getting. the error “<Terminated by signal 9 (Killed).>”

1 Like

First you have run in the timeout of the plugin, now in the one of Icinga 2.

In this cases I run the command on the CLI and measure the execution time by prepending time. With this timing you can configure Icinga 2 by setting vars.nwc_timeout and check_timeout on the service to proper values. The check’s timeout should be lower then the service’s one so it ends in a controlled fashion instead of getting killed.

Just to add two more things:

  • A timeout of 60s and more is ok if needed but can cause trouble if the intervals (check_interval and retry_interval) are not chosen carefully to respect the long run time.
  • You should avoid posting passwords!