[SNMP4J] Network discovery usig snmp4j

Sudharani S Sudharani.S at infosys.com
Thu May 26 07:28:45 CEST 2016


Hi  Frank,
Can you please in this.
I am new SNMP protocol ,I have below requirement.Can anyone please help in 
this below requirement.


I need the guidance to start with this,I mean please let me know what all the 
  things I need to include to do this.
   And how to do snmp walk to pim neighbors table?,I have a snmp service enabled 
   in my system apart from this what all the jar files need to be include let me 
   know please.
 
  The requirement follows like this:
  1)To implement multicast network discovery using snmp in java 2)Create 
   CompletedRouterList (initially NULL) to store the routers for which discovery 
  was complete and a PendingRouterList containing the routers for which 
  discover is pending.
  3)At initialization time, statically populate the PendingRouterList with 
  initial set of routers from some config file.
  4)For each router in the PendingRouterList, if multicast is enabled then 
  query the pimInterfaceTable to obtain the list of interfaces on which PIM is 
  enabled. For example if R1 has PIM enabled and has interfaces 1/1 and 1/2/ on 
   which PIM is enabled then we will have:-
            1/2         1/1
      --------- R1 ----------
 5)For each router that has at least 1 interface that has PIM enabled on it, 
 query it's PIM Neighbor table to obtain the list of it's PIM neighbors. PIM 
 neighbor table also gives the interface index with which the router is 
 connected with it's neighbor. This information can be used to build the link 
 between the router and neighbor(s).
 For example if R1 has neighbors R2 connected to 1/1 and R3 connected to 1 / 2 
 then we can build the table as:-
                     1/2     1/1
         R3----------R1 ---------- R2
 
 
  Anyone please help ,Thanks in advance
 
 Regards,
 Sudha

-----Original Message-----
From: SNMP4J [mailto:snmp4j-bounces at agentpp.org] On Behalf Of Frank Fock
Sent: Friday, May 20, 2016 3:17 AM
To: snmp4j at agentpp.org
Subject: Re: [SNMP4J] Null Pointer Exception - MOSubTreeProxy snmp4jAgent v2.5.0


Hi Rushik,

The MOSubtreeProxy takes contextEngineID and contextName as parameters.
You can there specify the correct values to avoid the NPE.

Best regards,
Frank



Am 18.05.2016 um 15:19 schrieb ru_44 at hotmail.com:
>
> Hi Frank,I recently upgraded to snmp4j 2.5.0 and snmp4j agent v2.5.0. 
> There’s a bugfix in SNMP4J v2.5.0 which causes a Null Pointer 
> Exception when we use the MOSubtreeProxy in SNMP4J-Agent v2.5.0
>
> http://www.snmp4j.org/CHANGES.txt
>
> * Fixed [SFJ-121]:
> DefaultPDUFactory.createPDU does not set contextName and 
> contextEngineID on ScopedPDU
>
>    instances.
>
>   
>
>   
>
> The MOSubtreeProxy class needs to set (or initialize) the 
> contextEngineID & contextEngineName in the DefaultPDUFactory inside 
> its constructor.  Currently when the
> DefaultPDUFactory.applyContextInfoToScopedPDU() is called via 
> DefaultPDUFactory.createPDU(), both fields are NULL.
>
>   
>
> 22767 [DefaultUDPTransportMapping_192.168.1.90/161]
> DEBUG org.snmp4j.agent.mo.snmp.VacmMIB  - Access allowed for view 
> 'fullReadView2' by subtree 1.3 for OID 1.3.6.1.2.1.1.1.0
>
> java.lang.NullPointerException: Context engine ID must not be null
>
>          at
> org.snmp4j.ScopedPDU.setContextEngineID(ScopedPDU.java:69)
>
>          at
> org.snmp4j.util.DefaultPDUFactory.applyContextInfoToScopedPDU(DefaultP
> DUFactory.java:114)
>
>          at
> org.snmp4j.util.DefaultPDUFactory.createPDU(DefaultPDUFactory.java:99)
>
>          at
> org.snmp4j.agent.mo.snmp4j.MOSubtreeProxy.get(MOSubtreeProxy.java:139)
>
>          at
> org.snmp4j.agent.CommandProcessor$GetHandler.processPdu(CommandProcess
> or.java:1074)
>
>          at
> org.snmp4j.agent.CommandProcessor$GetHandler.processPdu(CommandProcess
> or.java:1041)
>
>          at
> org.snmp4j.agent.CommandProcessor.processRequest(CommandProcessor.java
> :422)
>
>          at
> org.snmp4j.agent.CommandProcessor.processRequest(CommandProcessor.java
> :384)
>
>          at
> org.snmp4j.agent.CommandProcessor.dispatchCommand(CommandProcessor.jav
> a:340)
>
>          at
> org.snmp4j.agent.CommandProcessor$Command.run(CommandProcessor.java:56
> 0)
>
>          at
> org.snmp4j.agent.CommandProcessor.processPdu(CommandProcessor.java:163
> )
>
>          at
> com.mibadapter.snmpagent.Processor.processPdu(Processor.java:73)
>
>          at
> org.snmp4j.MessageDispatcherImpl.fireProcessPdu(MessageDispatcherImpl.
> java:689)
>
>          at
> org.snmp4j.MessageDispatcherImpl.dispatchMessage(MessageDispatcherImpl
> .java:308)
>
>          at
> org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.
> java:385)
>
>          at
> org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.
> java:345)
>
>          at
> org.snmp4j.transport.AbstractTransportMapping.fireProcessMessage(Abstr
> actTransportMapping.java:76)
>
>          at
> org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(Defau
> ltUdpTransportMapping.java:423)
>
>          at
> java.lang.Thread.run(Thread.java:745)
>
> 22773 [DefaultUDPTransportMapping_192.168.1.90/161]
> WARN org.snmp4j.agent.CommandProcessor  - java.lang.NullPointerException:
> Context engine ID must not be null
>
> java.lang.Exception: Error 'General variable binding error' generated 
> at: 1.3.6.1.2.1.1.1.0 = Null
>
>          at
> org.snmp4j.agent.request.SnmpRequest$SnmpSubRequest.requestStatusChang
> ed(SnmpRequest.java:621)
>
>          at
> org.snmp4j.agent.request.RequestStatus.fireRequestStatusChanged(Reques
> tStatus.java:89)
>
>          at
> org.snmp4j.agent.request.RequestStatus.setErrorStatus(RequestStatus.ja
> va:52)
>
>          at
> org.snmp4j.agent.CommandProcessor$GetHandler.processPdu(CommandProcess
> or.java:1087)
>
>          at
> org.snmp4j.agent.CommandProcessor$GetHandler.processPdu(CommandProcess
> or.java:1041)
>
>          at
> org.snmp4j.agent.CommandProcessor.processRequest(CommandProcessor.java
> :422)
>
>          at
> org.snmp4j.agent.CommandProcessor.processRequest(CommandProcessor.java
> :384)
>
>          at
> org.snmp4j.agent.CommandProcessor.dispatchCommand(CommandProcessor.jav
> a:340)
>
>          at
> org.snmp4j.agent.CommandProcessor$Command.run(CommandProcessor.java:56
> 0)
>
>          at
> org.snmp4j.agent.CommandProcessor.processPdu(CommandProcessor.java:163
> )
>
>          at
> com.mibadapter.snmpagent.Processor.processPdu(Processor.java:73)
>
>          at
> org.snmp4j.MessageDispatcherImpl.fireProcessPdu(MessageDispatcherImpl.
> java:689)
>
>          at
> org.snmp4j.MessageDispatcherImpl.dispatchMessage(MessageDispatcherImpl
> .java:308)
>
>          at
> org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.
> java:385)
>
>          at
> org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.
> java:345)
>
>          at
> org.snmp4j.transport.AbstractTransportMapping.fireProcessMessage(Abstr
> actTransportMapping.java:76)
>
>          at
> org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(Defau
> ltUdpTransportMapping.java:423)
>
>          at
> java.lang.Thread.run(Thread.java:745)
>
>   ThanksRushik
>
>    		 	   		
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> https://oosnmp.net/mailman/listinfo/snmp4j

--
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231

_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
https://oosnmp.net/mailman/listinfo/snmp4j


More information about the SNMP4J mailing list