[jboss-user] [Installation, Configuration & Deployment] - Net-SNMP, community !~ public, JBOSS-4.0.4.GA

pako do-not-reply at jboss.com
Wed Aug 30 11:48:19 EDT 2006


Hi all,
I'm writing a perl-script to monitor JBOSS-4.0.4.GA 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:


  | #!/usr/bin/perl
  | 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);
  | $session->close;
  | print "OID requested: ".$result->{"$ARGV[2]"}."\n";
  | 
### myscript.pl 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 at wi064111 ~]# snmpget -c public -v 1 10.102.64.111:161 .1.3.6.1.2.1.4.1.0
IP-MIB::ipForwarding.0 = INTEGER: notForwarding(2)

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

[root at wi064111 ~]# snmpget -c public -v 1 10.102.64.111:11112 1.2.3.4.1.2
iso.2.3.4.1.2 = Gauge32: 92686392

[root at wi064111 ~]# snmpget -c q3lrcdjb -v 1 10.102.64.111:11212
1.2.3.4.1.2
iso.2.3.4.1.2 = Gauge32: 94004080

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

[root at wi064111 ~]# ./myscript.pl wi064111:161 public 1.3.6.1.2.1.4.1.0
Hostname: wi064111:161  Community: public  OID: 1.3.6.1.2.1.4.1.0
OID requested: 2

[root at wi064111 ~]# ./myscript.pl wi064111:161 q3lrcdjb 1.3.6.1.2.1.4.1.0
Hostname: wi064111:161  Community: q3lrcdjb  OID: 1.3.6.1.2.1.4.1.0
OID requested: 2

3) myscript.pl queries on JBOSS snmp-agent work only with community
'public':

[root at wi064111 ~]# ./myscript.pl wi064111:11112 public 1.2.3.4.1.2
Hostname: wi064111:11112  Community: public  OID: 1.2.3.4.1.2
OID requested: 91884232

[root at wi064111 ~]# ./myscript.pl wi064111:11212 q3lrcdjb 1.2.3.4.1.2
Hostname: wi064111:11212  Community: q3lrcdjb  OID: 1.2.3.4.1.2
request error: Bad incoming community [public] at ./myscript.pl line 10.
************************************************************************
THIS IS THE ERROR I GET.

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,
pako


  | ######## Listing of /jboss/admjboss-4.0.4.GA/jboss-4.0.4.GA/server/part02node01/deploy/snmp-adaptor.sar/META-INF/jboss-service.xml ##########
  | 
  | <?xml version="1.0" encoding="UTF-8"?>
  | <service>
  |   <mbean code="org.jboss.jmx.adaptor.snmp.trapd.TrapdService"
  |          name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger">
  |     <attribute name="Port">1162</attribute>
  |   </mbean>
  |   <!-- The SNMP adaptor MBean -->
  |   <mbean code="org.jboss.jmx.adaptor.snmp.agent.SnmpAgentService"
  |          name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor">
  |     <attribute name="RequestHandlerClassName">org.jboss.jmx.adaptor.snmp.agent.RequestHandlerImpl</attribute>
  |     <attribute name="RequestHandlerResName">/attributes.xml</attribute>
  |     <attribute name="TrapFactoryClassName">org.jboss.jmx.adaptor.snmp.agent.TrapFactorySupport</attribute>
  |     <attribute name="NotificationMapResName">/notifications.xml</attribute>
  |     <attribute name="ManagersResName">/managers.xml</attribute>
  |     <attribute name="HeartBeatPeriod">0</attribute>
  |     <attribute name="Port">1161</attribute>
  |     <attribute name="DynamicSubscriptions">false</attribute>
  |     <attribute name="WriteCommunity">q3lwcdjb</attribute>
  |     <attribute name="ReadCommunity">q3lrcdjb</attribute>
  |     <attribute name="SubscriptionList">
  |       <subscription-list>
  |         <!-- Monitor events from SNMP adaptor itself -->
  |         <mbean name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor">
  |           <notification type="jboss.snmp.agent.coldstart"/>
  |         </mbean>
  |         <!-- Monitor timer for heartbeat events -->
  |         <mbean name="jboss.jmx:name=SnmpAgent,service=timer,type=heartbeat">
  |           <notification type="jboss.snmp.agent.heartbeat"/>
  |         </mbean>
  |       </subscription-list>
  |     </attribute>
  |     <depends optional-attribute-name="TimerName">
  |       <mbean code="javax.management.timer.Timer"
  |              name="jboss.jmx:name=SnmpAgent,service=timer,type=heartbeat"/>
  |     </depends>
  |   </mbean>
  |   <!-- Defines the system information as specified in rfc-1213
  |        iso.org.dod.internet.mgmt.mib-2.system.* -->
  |   <mbean code="org.jboss.jmx.adaptor.snmp.system.MIB2SystemGroupService"
  |              name="jboss.jmx:name=SnmpAgent,service=MIB2SystemGroup">
  |     <attribute name="SysLocation">In The Matrix</attribute>
  |     <attribute name="SysDescr">Central Computer</attribute>
  |     <attribute name="SysContact">Agent Smith</attribute>
  |     <depends optional-attribute-name="SnmpAgent">
  |            jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor
  |     </depends>
  |   </mbean>
  | </service>
  | 

########### listing of /jboss/admjboss-4.0.4.GA/jboss-4.0.4.GA/server/part02node01/deploy/snmp-adaptor.sar/attributes.xml ###########


  | <?xml version="1.0"?>
  | <attribute-mappings>
  |    <mbean name="jboss.system:type=ServerInfo" oid-prefix=".1.2.3.4.1">
  |       <attribute name="ActiveThreadCount" oid=".1"/>
  |       <attribute name="FreeMemory" oid=".2"/>
  |       <attribute name="MaxMemory" oid=".3"/>
  |       <attribute name="TotalMemory" oid=".10"/>
  |    </mbean>
  |    <mbean name="jboss.system:service=ThreadPool">
  |       <attribute name="QueueSize" oid=".1.2.3.4.1.4"/>
  |       <attribute name="MaximumQueueSize" oid=".1.2.3.4.1.11"/>
  |    </mbean>
  |    <mbean name="jboss.web:name=http-0.0.0.0-8080,type=GlobalRequestProcessor">
  |       <attribute name="requestCount" oid=".1.2.3.4.1.5"/>
  |    </mbean>
  |    <mbean name="jboss:service=TransactionManager">
  |       <attribute name="CommitCount" oid=".1.2.3.4.1.6"/>
  |       <attribute name="RollbackCount" oid=".1.2.3.4.1.7"/>
  |       <attribute name="TransactionCount" oid=".1.2.3.4.1.8"/>
  |    </mbean>
  |    <mbean name="jboss.jca:name=DefaultDS,service=ManagedConnectionPool" oid-prefix=".1.2.3.4.1">
  |       <attribute name="InUseConnectionCount" oid=".9"/>
  |    </mbean>
  |    <mbean name="jboss.jmx:name=SnmpAgent,service=MIB2SystemGroup" oid-prefix=".1.3.6.1.2.1.1">
  |       <attribute name="SysDescr" oid=".1" mode="rw"/> <!-- can be modified over snmp -->
  |       <attribute name="SysObjectId" oid=".2"/>
  |       <attribute name="SysUpTime" oid=".3"/>
  |       <attribute name="SysContact" oid=".4"/>
  |       <attribute name="SysName" oid=".5"/>
  |       <attribute name="SysLocation" oid=".6"/>
  |       <attribute name="SysServices" oid=".7"/>
  |    </mbean>
  | </attribute-mappings>
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968410#3968410

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968410



More information about the jboss-user mailing list