Page 1 of 2

Nagios ASR Plugin

Posted: Wed Mar 14, 2018 12:36 am
by faziz
Hi

I download plugin called "check_cisco_asr_cpu.pl" and copy to /usr/local/nagios/libexec directory
and I gave x permission plus assign to nagios user and group and when try to execute this command it show to me below error

[root@NAG01TSRUH libexec]# ./check_cisco_asr_cpu.pl -h
Can't locate Switch.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./check_cisco_asr_cpu.pl line 12.
BEGIN failed--compilation aborted at ./check_cisco_asr_cpu.pl line 12.

Thanks

Re: Nagios ASR Plugin

Posted: Wed Mar 14, 2018 10:45 am
by cdienger
Switch.pm is either not installed or not found in the right location. Run the following to find it:

sudo yum install mlocate
sudo updatedb
sudo locate Switch.pm


Run the following to install Switch.pm:

sudo yum install -y perl-Switch

Re: Nagios ASR Plugin

Posted: Thu Mar 15, 2018 2:20 am
by faziz
Thank you cdienger for your reply, but The command it looks response, but the result looks not suitable, is that mean there is bug in plugin
"Mod_0_1_CPU0Mod_0_RSP1_CPU0Mod_0_RSP0_CPU0Mod_0_1_0Mod_0_1_1Mod_0_1_CPU0Mod_0_RSP1_CPU0Mod_0_RSP0_CPU0CPU OK: Mod_0_RSP1_CPU0_5min_avg=1%, Mod_0_RSP0_CPU0_5min_avg=1%, Mod_0_1_CP"

and when I run on another asr device it show below result
"UNKNOWN: Unknonwn SNMP sysObjectID: 1.3.6.1.4.1.9.1.1861"

Re: Nagios ASR Plugin

Posted: Thu Mar 15, 2018 11:21 am
by cdienger
It looks like that the plugin isn't capable of handling that model/OID. Here is the code that generates the messages:

Code: Select all

my $systemOID = $result->{$sysObjectID};
my $model = '';

if ($systemOID eq '1.3.6.1.4.1.9.1.1041') {
    $model = '3945';
} elsif ( $systemOID eq '1.3.6.1.4.1.9.1.1054') {
    $model = 'sm';
} elsif ( $systemOID eq '1.3.6.1.4.1.9.1.1525' or $systemOID eq '1.3.6.1.4.1.9.1.2144') {
    $model = 'asr1k';
} elsif ( $systemOID eq '1.3.6.1.4.1.9.1.1017' or $systemOID eq '1.3.6.1.4.1.9.12.3.1.3.1507' or $systemOID eq '1.3.6.1.4.1.9.1.1018') {
    $model = 'asr9k';
} else {
    print "UNKNOWN: Unknonwn SNMP sysObjectID: $systemOID";
    exit $ERRORS{'UNKNOWN'};
}
There may be a plugin available on the exchange that works with the model or if you know which OIDs you want to monitor you can use the check_snmp check: https://www.monitoring-plugins.org/doc/ ... _snmp.html

Re: Nagios ASR Plugin

Posted: Sat Mar 17, 2018 11:51 pm
by faziz
Hi
these below are OID to give memory, it works when use snmpwalk, but when use with check_snmp i got error as clarify below
#snmpwalk -v 2c -c tscmnNT 10.1.10.1 1.3.6.1.4.1.9.9.221.1.1.1.1.18
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.18.7000.1 = Counter64: 424723672

# ./check_snmp -H 10.1.10.1 -C tscmnNT -o 1.3.6.1.4.1.9.9.221.1.1.1.1.18, 1.3.6.1.4.1.9.9.221.1.1.1.1.20
External command error: Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: iso.3.6.1.4.1.9.9.221.1.1.1.1.18

-How i can convert result to MB or G?


-1.3.6.1.4.1.9.9.221.1.1.1.1.20 gives free memory
-1.3.6.1.4.1.9.9.221.1.1.1.1.18 gives the used memory

Thank you in advanced

Re: Nagios ASR Plugin

Posted: Mon Mar 19, 2018 10:32 am
by cdienger
It looks like enterprises.9.9.221.1.1.1.1.18.7000.1 is the actual location of the used memory. Try:

# ./check_snmp -H 10.1.10.1 -C tscmnNT -o 1.3.6.1.4.9.9.221.1.1.1.1.18.7000.1

Converting the memory from bytes to MB or G would require additional logic not available in the command itself. You could however use the check in a custom script that performs the calculation.

https://exchange.nagios.org/directory/T ... pt/details
https://assets.nagios.com/downloads/nag ... inapi.html
https://assets.nagios.com/downloads/nag ... inapi.html
http://nagios-plugins.org/doc/guidelines.html

Are some useful documents to help get you started on creating custom plugins.

Re: Nagios ASR Plugin

Posted: Sun Mar 25, 2018 4:36 am
by faziz
Hi cdienger

I tried below command but still display to me same error
#./check_snmp -H 10.1.10.1 -C tscmnNT -o 1.3.6.1.4.1.9.9.221.1.1.1.1.18.7000.1

External command error: Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: iso.3.6.1.4.1.9.9.221.1.1.1.1.18.7000.1

Thanks

Re: Nagios ASR Plugin

Posted: Mon Mar 26, 2018 2:27 pm
by cdienger
Try specifying the protocol version with:

./check_snmp -H 10.1.10.1 -C tscmnNT -o 1.3.6.1.4.1.9.9.221.1.1.1.1.18.7000.1 -P 2c

Re: Nagios ASR Plugin

Posted: Sun Apr 01, 2018 1:58 am
by faziz
Hi cdienger

Yes it is working now, but I have minor thing if you can notice "c" that show end of result which could effect on threshold limit

./check_snmp -H 192.168.22.5 -C tally -o 1.3.6.1.4.1.9.9.221.1.1.1.1.18.7000.1 -P 2c
SNMP OK - 424723688 | iso.3.6.1.4.1.9.9.221.1.1.1.1.18.7000.1=424723688c

Re: Nagios ASR Plugin

Posted: Mon Apr 02, 2018 12:30 pm
by cdienger
Interesting. What version of check_snmp is being used(./check_snmp --version to see) ? I tested with 2.2.1 and wasn't able to reproduce. You can download the latest(along with install instructions in the README) from https://www.nagios.org/downloads/nagios-plugins/ .