Page 1 of 4

Monitor Netapp device which is using SNMP V3

Posted: Sat Apr 02, 2016 2:02 am
by arunkrishnan.tvm
I would like to monitor Netapp device which is using SNMP V3. I have tried use some plugins (Perl script) from Nagios Exchange but it is not supporting SNMP V3.
Is there any Nagios Xi plugin can I use to monitor Netapp with following options.

SNMP version: v3
Host
User Name
Authentication Method (usm)
Engine Id
Authentication Protocol
Privacy Protocol
Security Group
Password

Re: Monitor Netapp device which is using SNMP V3

Posted: Mon Apr 04, 2016 1:25 am
by Box293
Is there a particular plugin that you have found that you would like to get working with SNMP v3?

If there is, provide us a link to it, as it shouldn't be very hard to make it work.

Re: Monitor Netapp device which is using SNMP V3

Posted: Mon Apr 04, 2016 7:19 am
by arunkrishnan.tvm
Yes, I have already configured the plugin check-netapp-ng.pl
Following is the Nagios Exchange link for this plugin:

https://exchange.nagios.org/directory/P ... NG/details

Re: Monitor Netapp device which is using SNMP V3

Posted: Mon Apr 04, 2016 3:49 pm
by rkennedy
Looking at the plugin, it's establishing a connection here -

Code: Select all

 my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => $version, -community => $comm, -timeout => $timeout);
The help menu indicates -

Code: Select all

    -V <1|2c>               SNMP version (default 1), some checks run only 2c
With that said, you might be able to modify -V to be equal to '3' as suggested by cpan.
The -version argument controls which other arguments are expected or required by the session() constructor. The Net::SNMP module supports SNMPv1, SNMPv2c, and SNMPv3. The module defaults to SNMPv1 if no -version argument is specified. The -version argument expects either a digit (i.e. '1', '2', or '3') or a string specifying the version (i.e. 'snmpv1', 'snmpv2c', or 'snmpv3') to define the SNMP version.
Can you try to run the plugin with the -V 3 flag and post the full input / output?

Additionally, if this does not work, other netapp plugins can be found at our Exchange, located here - https://exchange.nagios.org/index.php?o ... ord=netapp

Re: Monitor Netapp device which is using SNMP V3

Posted: Mon Apr 04, 2016 4:56 pm
by Box293
If what @rkennedy has suggested doesn't work, he has pointed to the line I was going to.

There's no reason why you (for testing purposes originally) hard code the required parameters.

For example:

Code: Select all

my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => '3', -username => 'the_user_name', -authprotocol => 'SHA', -authpassword => 'the_SHA_string', -privprotocol => 'AES', -privpassword => 'the_SHA_string', -timeout => $timeout);
Have a look at the plugin /user/local/nagios/libexec/check_snmp_process.pl as it has all the parameters.

Keep in mind, this all assumes the device supports SNMP v3.

Re: Monitor Netapp device which is using SNMP V3

Posted: Tue Apr 05, 2016 1:32 pm
by arunkrishnan.tvm
I have ran the plugin using -V 3 flag. Also edited the Perl script and added the below line with correct details. But when I executing the check command I am getting the error message "Missing -C".

Code: Select all

my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => '3', -username => 'the_user_name', -authprotocol => 'SHA', -authpassword => 'the_SHA_string', -privprotocol => 'AES', -privpassword => 'the_SHA_string', -timeout => $timeout);

I have found one another plugin which is already supporting SNMP V3. When I executed the the check command I am getting some error message. Am I missing anything in the below command ? Is the command format correct ?

https://nerhood.wordpress.com/2006/06/1 ... giosgraph/

Code: Select all

 [root@TCVNG01 libexec]# ./check_netapp.pl -H 192.168.23.45 -v DISKUSED -w 60 -c 70 -t 60 -P 3 -L authPriv -U myuser -a sha -A mypassword -X mypassword -o /vol/vol0/

Missing arguments!

check_netapp -H <ip_address> -v variable [-w warn_range] [-c crit_range]
             [-C community] [-t timeout] [-p port-number]
             [-P snmp version] [-L seclevel] [-U secname] [-a authproto]
             [-A authpasswd] [-X privpasswd] [-o volume]
Please help me on this.

Re: Monitor Netapp device which is using SNMP V3

Posted: Tue Apr 05, 2016 1:44 pm
by rkennedy
arunkrishnan.tvm wrote:I have ran the plugin using -V 3 flag. Also edited the Perl script and added the below line with correct details. But when I executing the check command I am getting the error message "Missing -C".

Code: Select all

my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => '3', -username => 'the_user_name', -authprotocol => 'SHA', -authpassword => 'the_SHA_string', -privprotocol => 'AES', -privpassword => 'the_SHA_string', -timeout => $timeout);

I have found one another plugin which is already supporting SNMP V3. When I executed the the check command I am getting some error message. Am I missing anything in the below command ? Is the command format correct ?

https://nerhood.wordpress.com/2006/06/1 ... giosgraph/

Code: Select all

 [root@TCVNG01 libexec]# ./check_netapp.pl -H 192.168.23.45 -v DISKUSED -w 60 -c 70 -t 60 -P 3 -L authPriv -U myuser -a sha -A mypassword -X mypassword -o /vol/vol0/

Missing arguments!

check_netapp -H <ip_address> -v variable [-w warn_range] [-c crit_range]
             [-C community] [-t timeout] [-p port-number]
             [-P snmp version] [-L seclevel] [-U secname] [-a authproto]
             [-A authpasswd] [-X privpasswd] [-o volume]
Please help me on this.
Try executing the new plugin you downloaded and add the -C parameter, this represents the community string which will be required.

Based off of Troy's modifications, it looks to be missing the community string which may be needed -

Code: Select all

my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => '3', -community => $comm, -username => 'the_user_name', -authprotocol => 'SHA', -authpassword => 'the_SHA_string', -privprotocol => 'AES', -privpassword => 'the_SHA_string', -timeout => $timeout);
Both of those should work, preferably the plugin you downloaded since we're just 'making it work' at this point with the initial one.

Re: Monitor Netapp device which is using SNMP V3

Posted: Tue Apr 05, 2016 3:05 pm
by arunkrishnan.tvm
Thank you very much rkennedy and Box293 :) . I can see the details when I execute the check now.

Code: Select all

[root@TCVNG01 libexec]# ./check-netapp-ng.pl -H 192.168.23.45 -C  -V 3c -T DISKUSED -v n3_sata -w 60 -c 70 -t 60
CRIT: DISKUSED n3_sata 86% | n3_sata=109821806579KB;0;0;; n3_sata:perc=86%;60;70;;100

[root@TCVNG01 libexec]# ./check-netapp-ng.pl -H 192.168.23.45 -C  -V 3c -T CPULOAD -w 60 -c 70 -t 60
OK: CPULOAD 30% | cpuload=30%;60;70;;

But if I configure another Netapp device with different SNMP parameters (different password and security protocol), then should I change the SNMP settings directly in the Perl script ? because right now below SNMP details are hard coded in the script.

Is there any way to use the same script to monitor multiple Netapp devices and which using different SNMP values ?

my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => '3', -username => 'the_user_name', -authprotocol => 'SHA', -authpassword => 'the_SHA_string', -privprotocol => 'AES', -privpassword => 'the_SHA_string', -timeout => $timeout);


About the new Perl script, when I added the -C parameter I am getting the following result:

Code: Select all

[root@TCVNG01 libexec]# ./check_netapp.pl -H 192.168.23.45 -C -P 3 -L authPriv -U myuser -a sha -A mypassword -X mypassword -v DISKUSED -o /vol/vol0/ -w 60 -c 70 -t 60
CRITICAL:No response from remote host '192.168.23.45' for .1.3.6.1.4.1.789.1.5.4.1 with snmp version 1

Re: Monitor Netapp device which is using SNMP V3

Posted: Tue Apr 05, 2016 3:12 pm
by rkennedy
Yeah, you'll need to modify them to use the variables, but possibly only hard code in the -version => '3' part. You could use all of the dynamic variables in the script still, just have to ignore the version part. Essentially this script should be rewritten for SNMPv3 support.
[root@TCVNG01 libexec]# ./check_netapp.pl -H 192.168.23.45 -C -P 3 -L authPriv -U myuser -a sha -A mypassword -X mypassword -v DISKUSED -o /vol/vol0/ -w 60 -c 70 -t 60
You'll need to specify something after the -C for community, to represent the community string. ./check_netapp.pl -H 192.168.23.45 -C public -P 3 -L authPriv -U myuser -a sha -A mypassword -X mypassword -v DISKUSED -o /vol/vol0/ -w 60 -c 70 -t 60 should work. (provided your community string is the word 'public' - adjust as needed)

Re: Monitor Netapp device which is using SNMP V3

Posted: Tue Apr 05, 2016 3:55 pm
by arunkrishnan.tvm
So I have to modify the script like below, right ? Is there any more changes needed ?

Code: Select all

my ($server, $comm, $version, $username, $authprotocol, $authpassword, $privprotocol, $privpassword, $timeout) = @_;
        my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => '3', -username => $username,  authprotocol => $authprotocol, -authpassword => $authpassword, -privprotocol => $privprotocol, -privpassword => $privpassword, -timeout => $timeout);
Also how should I call the check command after this changes in the script ? What letters should I give for (username, authprotocol, authpassword, privprotocol, privpassword) Like we used V - volume, w - warning, c- critical ?


About another script, I have tried to change the community string to public and private but that time I am getting the old error "Missing arguments!"

Code: Select all

[root@TCVNG01 libexec]# ./check_netapp.pl -H 192.168.23.45 -C public -P 3 -L authPriv -U myuser -a sha -A mypassword -X mypassword -v DISKUSED -o /vol/vol0/ -w 60 -c 70 -t 60

Missing arguments!

check_netapp -H <ip_address> -v variable [-w warn_range] [-c crit_range]
             [-C community] [-t timeout] [-p port-number]
             [-P snmp version] [-L seclevel] [-U secname] [-a authproto]
             [-A authpasswd] [-X privpasswd] [-o volume]