Net-SNMP, community !~ public, JBOSS-4.0.4.GA

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi all,
sorry for mistakes I did in previous posting. I hope to do better now,
starting from the subject :-)
Since the last JBOSS version (4.0.4.GA), a SNMP-agent has been added to
the application server.
I'm writing a perl-script to monitor JBOSS via snmp, by using Net::SNMP
5.20 perl module.
The problem is that if I set a community different from 'public',
snmp-queries done via NET::SNMP module on JBOSS snmp-agent don't work.
While snmp-queries done via 'snmpget' command (from command line) on JBOSS
snmp-agent work perfecty with any community.
I worte a little script to isolate the problem:

use strict;
use warnings;
use Net::SNMP;
my ($session,$error) = Net::SNMP->session(Hostname => $ARGV[0],
                                       Community => $ARGV[1]);
die "session error: $error" unless ($session);
printf("Hostname: %s  Community: %s  OID: %s\n", $ARGV[0], $ARGV[1], $ARGV[2]);
my $result = $session->get_request("$ARGV[2]");
die "request error: ".$session->error unless (defined $result);
print "OID requested: ".$result->."\n";
### end ###

I tested the problem in this scenario:
- host wi064111 running CentOS 4.3
-- JBOSS running snmp-adaptor.sar with community 'public' on port 11112
-- JBOSS running snmp-adaptor.sar with community 'q3lrcdjb' on port 11212
-- snmpd daemon running on port 161 (tested with both previous communities)

The result of my tests is:

1) 'snmpget' command works perfectly quering both snmpd daemon and JBOSS
snmp-agent, with any community:

[root@wi064111 ~]# snmpget -c public -v 1 .
IP-MIB::ipForwarding.0 = INTEGER: notForwarding(2)

[root@wi064111 ~]# snmpget -c q3lrcdjb -v 1
IP-MIB::ipForwarding.0 = INTEGER: notForwarding(2)

[root@wi064111 ~]# snmpget -c public -v 1
iso. = Gauge32: 92686392

[root@wi064111 ~]# snmpget -c q3lrcdjb -v 1
iso. = Gauge32: 94004080

2) works perfectly quering snmpd daemon, with any community:

[root@wi064111 ~]# ./ wi064111:161 public
Hostname: wi064111:161  Community: public  OID:
OID requested: 2

[root@wi064111 ~]# ./ wi064111:161 q3lrcdjb
Hostname: wi064111:161  Community: q3lrcdjb  OID:
OID requested: 2

3) queries on JBOSS snmp-agent work only with community

[root@wi064111 ~]# ./ wi064111:11112 public
Hostname: wi064111:11112  Community: public  OID:
OID requested: 91884232

[root@wi064111 ~]# ./ wi064111:11212 q3lrcdjb
Hostname: wi064111:11212  Community: q3lrcdjb  OID:
request error: Bad incoming community [public] at ./ line 10.

Now, NET::SNMP module seems to be ok because works perfectly with snmpd
daemon. On the other side, JBOSS snmp-agent seems to be ok because answers
perfectly to snmpget queries.
But NET::SNMP module with JBOSS snmp-agent doesn'work correctly. Moreover
the error is caused by $session->get_request line, and not by
Net::SNMP->session line. It seems like JBOSS snmp-agent would expect a new
authentication every request.

Could the error be in NET::SNMP module implementation?

Thanks to everyone who just read the whole post,

Re: Net-SNMP, community !~ public, JBOSS-4.0.4.GA

On Wed, 30 Aug 2006 15:35:35 +0200, milaus wrote:
Quoted text here. Click to load it
Do you get the community transfered from the command line to the Net::SNMP
Try: ./ wi064111:11112 anythingButPublic

The examples I found at CPAN has a somewhat other syntax than you uses.

Have you considered use the perlmodule from net-snmp. Net-snmp might be
what you are using through you command line utilities.
( /)
Net::SNMP is not at all the same as net-snmp!!

Site Timeline