I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2010-03-09 23:28:39.489066-08 by liege
Wierd session init problem
Hi all,

Any help with this little Net::SNMP module problem would be appreciated. I'm not super strong with code like this, but I can normally muddle my way through it.

This is running on a Windows/Cygwin install, and I've made sure that Net::SNMP, and all of the required dependencies are installed. Perl recognizes all of the modules, attempting an upgrade with CPAN says that everything is up to date, and I can use almost exactly the same code below in a different context (details below).

The code:

---------------

#!/usr/bin/perl -w
use strict;
use Net::SNMP;

my $snmp = ""; #SNMP object variable
my $err = ""; #SNMP error var

($snmp, $err) = Net::SNMP->session(
-hostname => '<hidden>',
-version => 'snmpv3',
-username => '<hidden>',
-authpassword => '<hidden>',
-authprotocol => 'md5',
-privpassword => '<hidden>',
-privprotocol => 'des',
);

exit 1;

---------------

So, obviously the stuff that you shouldn't be seeing has been cleaned out. My problem APPEARS to be with the -authprotocol and -privprotocol options. I know that the hidden data is all OK though, because using the same host/user/passwords on a different device works just fine if I use different protocols.

Trying to be short and sweet:

If I use any option BUT the above auth and priv protocols, the creation of the object seems to succeed. As I understand, the above options are the default settings for the Net::SNMP module. I get the same problem whether I define them explicitly or take them both out. This is the error that I get:

---
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.10/Net/SNMP.pm line 2618.
---

As suggested, if I change even ONE of the protocol options, that error goes away. I'm assuming this means that I get a good object creation since using the same setup on the other device, but using SHA/AES works without a hitch (I can continue with get_request type stuff and retrieve appropriate responses). So, if I change this to be MD5/AES or SHA/DES, or SHA/AES, it works fine (at least...no error).

Why can't I just set up my device to use one of these other settings? It doesn't support it apparently. I'm trying to get into an APC UPS AP9617 card, which doesn't seem to support anything except MD5/DES.

So...any ideas why this might be happening? Any/all help is appreciated.

Thanks.
Direct Responses: 12534 | Write a response
Posted on 2010-03-12 19:31:08.520352-08 by dtown in response to 12520
Re: Wierd session init problem
What error is contained in the $err variable? My guess is that the agent is not sending back a usmStatsNotInTimeWindows Report-PDU during the time synchronization process.
Direct Responses: Write a response