check_ifoperstatus v2.3.3 (nagios-plugins 2.3.3)

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
preethu.d
Posts: 109
Joined: Wed Nov 25, 2020 11:32 pm

check_ifoperstatus v2.3.3 (nagios-plugins 2.3.3)

Post by preethu.d »

Hi Team,

I am getting the below error for interface status monitor (attached the screenshot) for all interfaces on a device. Interface bandwidth data is available.

"check_ifoperstatus v2.3.3 (nagios-plugins 2.3.3)"

below is the error I am getting when I perform run check command for interface status monitor.

Also I have noticed the SNMP string (S9#!tM0n) which was configured is splitting into argument 1, 2 and 3 instead of showing in argument 1.

I have modified and placed in argument 1 but it shows another interface name which is not available in the device.


Can you please help in fixing the issue.

"
[nagios@spnidcnagiosxi ~]$ /usr/local/nagios/libexec/check_ifoperstatus -H 192.168.205.232 -C S9# -k tM0n 9
check_ifoperstatus v2.3.3 (nagios-plugins 2.3.3)
The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute
copies of the plugins under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

usage:
check_ifoperstatus -k <IF_KEY> -H <HOSTNAME> [-C <community>]
Copyright (C) 2000 Christoph Kron
check_ifoperstatus.pl comes with ABSOLUTELY NO WARRANTY
This program is licensed under the terms of the GNU General Public License
(check source code for details)


check_ifoperstatus plugin for Nagios monitors operational
status of a particular network interface on the target host

Usage:
-H (--hostname) Hostname to query - (required)
-C (--community) SNMP read community (defaults to public,
used with SNMP v1 and v2c
-v (--snmp_version) 1 for SNMP v1 (default)
2 for SNMP v2c
SNMP v2c will use get_bulk for less overhead
if monitoring with -d
-L (--seclevel) choice of "noAuthNoPriv", "authNoPriv", or "authPriv"
-U (--secname) username for SNMPv3 context
-c (--context) SNMPv3 context name (default is empty string)
-A (--authpass) authentication password (cleartext ascii or localized key
in hex with 0x prefix generated by using "snmpkey" utility
auth password and authEngineID
-a (--authproto) Authentication protocol (MD5 or SHA1)
-X (--privpass) privacy password (cleartext ascii or localized key
in hex with 0x prefix generated by using "snmpkey" utility
privacy password and authEngineID
-P (--privproto) privacy protocol (DES or AES; default: DES)
-k (--key) SNMP IfIndex value
-d (--descr) SNMP ifDescr value
-T (--type) SNMP ifType integer value (see http://www.iana.org/assignments/ianaiftype-mib)
-p (--port) SNMP port (default 161)
-I (--ifmib) Agent supports IFMIB ifXTable. Do not use if
you don't know what this is.
-n (--name) the value should match the returned ifName
(Implies the use of -I)
-w (--warn =i|w|c) ignore|warn|crit if the interface is dormant (default critical)
-D (--admin-down =i|w|c) same for administratively down interfaces (default warning)
-M (--maxmsgsize) Max message size - useful only for v1 or v2c
-t (--timeout) seconds before the plugin times out (default=15)
-V (--version) Plugin version
-h (--help) usage help

-k or -d or -T must be specified

Note: either -k or -d or -T must be specified and -d and -T are much more network
intensive. Use it sparingly or not at all. -n is used to match against
a much more descriptive ifName value in the IfXTable to verify that the
snmpkey has not changed to some other network interface after a reboot.
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: check_ifoperstatus v2.3.3 (nagios-plugins 2.3.3)

Post by ssax »

Make sure that you surround the community with single-quotes.

Does this work from the CLI showing the proper port?

Code: Select all

/usr/local/nagios/libexec/check_ifoperstatus -H 192.168.205.232 -C 'S9#!tM0n' -k 9 -v 2 -p 161

Edit the service and set $ARG1$ to 'S9#!tM0n' (with the single-quotes) OR add your SNMP community as a User Macro to $ARG1$:

https://assets.nagios.com/downloads/nag ... ponent.pdf

Then change $ARG2$ to 9.

Then change $ARG3$ to:

Code: Select all

 -v 2 -p 161
Save, Apply Configuration, and force a check.
preethu.d
Posts: 109
Joined: Wed Nov 25, 2020 11:32 pm

Re: check_ifoperstatus v2.3.3 (nagios-plugins 2.3.3)

Post by preethu.d »

Hi,

I have added SNMP string in single quote but it gives the below error when I perform run check command.

[nagios@nagiosxi ~]$ /usr/local/nagios/libexec/check_ifoperstatus -H 192.168.205.232 -C 'S9#!tM0n' -k -v 2 -p 161

The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute
copies of the plugins under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

usage:
check_ifoperstatus -k <IF_KEY> -H <HOSTNAME> [-C <community>]
Copyright (C) 2000 Christoph Kron
check_ifoperstatus.pl comes with ABSOLUTELY NO WARRANTY
This program is licensed under the terms of the GNU General Public License
(check source code for details)


check_ifoperstatus plugin for Nagios monitors operational
status of a particular network interface on the target host

Usage:
-H (--hostname) Hostname to query - (required)
-C (--community) SNMP read community (defaults to public,
used with SNMP v1 and v2c
-v (--snmp_version) 1 for SNMP v1 (default)
2 for SNMP v2c
SNMP v2c will use get_bulk for less overhead
if monitoring with -d
-L (--seclevel) choice of "noAuthNoPriv", "authNoPriv", or "authPriv"
-U (--secname) username for SNMPv3 context
-c (--context) SNMPv3 context name (default is empty string)
-A (--authpass) authentication password (cleartext ascii or localized key
in hex with 0x prefix generated by using "snmpkey" utility
auth password and authEngineID
-a (--authproto) Authentication protocol (MD5 or SHA1)
-X (--privpass) privacy password (cleartext ascii or localized key
in hex with 0x prefix generated by using "snmpkey" utility
privacy password and authEngineID
-P (--privproto) privacy protocol (DES or AES; default: DES)
-k (--key) SNMP IfIndex value
-d (--descr) SNMP ifDescr value
-T (--type) SNMP ifType integer value (see http://www.iana.org/assignments/ianaiftype-mib)
-p (--port) SNMP port (default 161)
-I (--ifmib) Agent supports IFMIB ifXTable. Do not use if
you don't know what this is.
-n (--name) the value should match the returned ifName
(Implies the use of -I)
-w (--warn =i|w|c) ignore|warn|crit if the interface is dormant (default critical)
-D (--admin-down =i|w|c) same for administratively down interfaces (default warning)
-M (--maxmsgsize) Max message size - useful only for v1 or v2c
-t (--timeout) seconds before the plugin times out (default=15)
-V (--version) Plugin version
-h (--help) usage help

-k or -d or -T must be specified

Note: either -k or -d or -T must be specified and -d and -T are much more network
intensive. Use it sparingly or not at all. -n is used to match against
a much more descriptive ifName value in the IfXTable to verify that the
snmpkey has not changed to some other network interface after a reboot.
preethu.d
Posts: 109
Joined: Wed Nov 25, 2020 11:32 pm

Re: check_ifoperstatus v2.3.3 (nagios-plugins 2.3.3)

Post by preethu.d »

attached the screenshot.

Regards,
Preethu
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: check_ifoperstatus v2.3.3 (nagios-plugins 2.3.3)

Post by ssax »

You need to do this:

Then change $ARG2$ to 9.

Then change $ARG3$ to:
-v 2 -p 161
preethu.d
Posts: 109
Joined: Wed Nov 25, 2020 11:32 pm

Re: check_ifoperstatus v2.3.3 (nagios-plugins 2.3.3)

Post by preethu.d »

Thanks for the update.
I added ARG 2 & ARG 3 and I am able to see the node status as UP when I perform run check command.
But once I make the changes a "\" is coming automatically in string in ARG 1 (attached the screenshot) and if I do run check command again it display SNMP not responding.
I tried to removed "\" from SNMP string, but when I save the changes it is reappearing.

Reagrds,
Preethu
You do not have the required permissions to view the files attached to this post.
preethu.d
Posts: 109
Joined: Wed Nov 25, 2020 11:32 pm

Re: check_ifoperstatus v2.3.3 (nagios-plugins 2.3.3)

Post by preethu.d »

Also I have done the same changes for other interfaces but in status, it displays same interface name

Regards,
Preethu
You do not have the required permissions to view the files attached to this post.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: check_ifoperstatus v2.3.3 (nagios-plugins 2.3.3)

Post by gsmith »

Hi,

SSAX is out for the next week. I am able to duplicate your issue:

Code: Select all

I added ARG 2 & ARG 3 and I am able to see the node status as UP when I perform run check command.
But once I make the changes a "\" is coming automatically in string in ARG 1 (attached the screenshot) and if I do run check command again it display SNMP not responding.
I tried to removed "\" from SNMP string, but when I save the changes it is reappearing.
Could you please run the following commands and provide me with the outout:

Code: Select all

/usr/local/nagios/libexec/check_ifoperstatus -H 192.168.205.232 -C 'S9#!tM0n' -k 1 -v 2 -p 161
/usr/local/nagios/libexec/check_ifoperstatus -H 192.168.205.232 -C 'S9#!tM0n' -k 2 -v 2 -p 161
/usr/local/nagios/libexec/check_ifoperstatus -H 192.168.205.232 -C 'S9#!tM0n' -k 3 -v 2 -p 161
/usr/local/nagios/libexec/check_ifoperstatus -H 192.168.205.232 -C 'S9#!tM0n' -k 5 -v 2 -p 161
/usr/local/nagios/libexec/check_ifoperstatus -H 192.168.205.232 -C 'S9#!tM0n' -k 9 -v 2 -p 161
Thanks
preethu.d
Posts: 109
Joined: Wed Nov 25, 2020 11:32 pm

Re: check_ifoperstatus v2.3.3 (nagios-plugins 2.3.3)

Post by preethu.d »

Hi,

Below is the output. I ca see the status of interfaces, I need to monitor only specific interfaces, how do we know which value to keep for each interface. Also how we can eliminate extra "\" appearing in snmp string.

/usr/local/nagios/libexec/check_ifoperstatus -H 192.168.205.232 -C 'S9#!tM0n' -k 9 -v 2 -p 161
OK: Interface GigabitEthernet1/0/1 (index 9) is up.

/usr/local/nagios/libexec/check_ifoperstatus -H 192.168.205.232 -C 'S9#!tM0n' -k 1 -v 2 -p 161
WARNING: Interface GigabitEthernet0/0 (index 1) is administratively down.

/usr/local/nagios/libexec/check_ifoperstatus -H 192.168.205.232 -C 'S9#!tM0n' -k 2 -v 2 -p 161
WARNING: Interface Bluetooth0/4 (index 2) is administratively down.

/usr/local/nagios/libexec/check_ifoperstatus -H 192.168.205.232 -C 'S9#!tM0n' -k 3 -v 2 -p 161
OK: Interface Null0 (index 3) is up.

/usr/local/nagios/libexec/check_ifoperstatus -H 192.168.205.232 -C 'S9#!tM0n' -k 5 -v 2 -p 161
OK: Interface unrouted VLAN 1002 (index 5) is up.

Reagrds,
Preethu
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: check_ifoperstatus v2.3.3 (nagios-plugins 2.3.3)

Post by gsmith »

Hi Preethu,

It is looking like the the \ is being added to escape the ! by the gui, but it shouldn't be doing that. I am
opening a bug report with the Dev team.

As an alternative you can try the /usr/local/nagios/libexec/check_ifoperstatusnag plugin that Nagios provides.

Another plugin you can try is at
https://labs.consol.de/nagios/check_nwc ... ndex.html
This plugin requires a different setup:

wget https://labs.consol.de/assets/downloads ... 3.1.tar.gz
tar zxf check_nwc_health-8.3.1.tar.gz
cd check_nwc_health-8.3.1
./configure
make all
make install

Then test it out against the device you want to monitor:

Code: Select all

 /usr/local/nagios/libexec/check_nwc_health --hostname X.X.X.X -t 60 --community 'yourcommunity' --mode cpu-load
  /usr/local/nagios/libexec/check_nwc_health --hostname X.X.X.X -t 60 --community 'yourcommunity' --mode hardware-health
  /usr/local/nagios/libexec/check_nwc_health --hostname X.X.X.X -t 60 --community 'yourcommunity' --mode memory-usage
  /usr/local/nagios/libexec/check_nwc_health --hostname X.X.X.X -t 60 --community 'yourcommunity' --mode disk-usage
  /usr/local/nagios/libexec/check_nwc_health --hostname X.X.X.X -t 60 --community 'yourcommunity' --mode interface-usage
  /usr/local/nagios/libexec/check_nwc_health --hostname X.X.X.X -t 60 --community 'yourcommunity' --mode interface-errors
You can see the plugin help for other options:

Code: Select all

   /usr/local/nagios/libexec/check_nwc_health -h


You would need to reach out to the vendor of the device you want to monitor in order to determine what OIDs
you need to monitor as they will know the proper ones that meet your needs. We don't know this information.
Their support people or their website should have a list of MIB files you need for their device. You can look at the files,
or load them into a MIBbrowser to see what each OID represents.

Please let me know if you need assistance setting up one of these alternative plugins.

Thanks
Locked