[SNMP4J] Sending V3 Informs
Frank Fock
fock at agentpp.com
Mon Jun 28 19:12:55 CEST 2010
Hi,
engine ID, engine boots and time are of course discovered
for informs (as for GET/SET requests), if discovery is
activated globally.
You just have to use the correct user name (the target
is authoritative!)...
Best regards,
Frank
On 28.06.2010 19:08, Elise Atkins wrote:
> Anybody tried sending a V3 inform? A V3 inform requires the target's
> engine id, engine reboots and time. This information is not
> automatically discovered for informs. I have tried using
> Snmp.discoverAuthoritativeEngineID which does discover the engine id and
> it is put into the inform pdu. But the engine reboots and engine time
> are both set to 0, not the values returned from the
> discoverAuthoritativeEngineID response PDU.
>
> The code looks like:
> MessageDispatcherImpl dispatcher = new MessageDispatcherImpl();
> _snmp = new Snmp(dispatcher, new DefaultUdpTransportMapping());
> USM usm = new USM(SecurityProtocols.getInstance(),
> new OctetString(MPv3.createLocalEngineID()), 0);
> SecurityModels.getInstance().addSecurityModel(usm);
>
> MPv3 mp3 = new MPv3(usm);
>
> dispatcher.addMessageProcessingModel(new MPv1());
> dispatcher.addMessageProcessingModel(new MPv2c());
> dispatcher.addMessageProcessingModel(mp3);
> _snmp.listen();
>
> UdpAddress address = new UdpAddress("10.254.1.45" + "/162");
> UserTarget target = new UserTarget();
> target.setTimeout(2000);
> target.setAddress(address);
> target.setSecurityLevel(SecurityLevel.NOAUTH_NOPRIV);
> OctetString user = new OctetString("user1");
> _snmp.getUSM().addUser(user,
> new UsmUser(user, null, null, null, null));
> ((UserTarget)target).setSecurityName(user);
> ScopedPDU pdu = new ScopedPDU();
> pdu.setType(PDU.INFORM);
> ResponseEvent response = _snmp.send(pdu, target);
>
> _snmp.close();
>
> The wireshark looks like:
> No. Time Source Destination Protocol
> Info
> 1 0.000000 10.254.1.64 10.254.1.45 SNMP
> get-request
>
> Frame 1 (103 bytes on wire, 103 bytes captured)
> Ethernet II, Src: HewlettP_cd:2f:42 (00:24:81:cd:2f:42), Dst:
> Supermic_43:f4:88 (00:30:48:43:f4:88)
> Internet Protocol, Src: 10.254.1.64 (10.254.1.64), Dst: 10.254.1.45
> (10.254.1.45)
> User Datagram Protocol, Src Port: 53112 (53112), Dst Port: snmptrap (162)
> Simple Network Management Protocol
> msgVersion: snmpv3 (3)
> msgGlobalData
> msgAuthoritativeEngineID:<MISSING>
> msgAuthoritativeEngineBoots: 0
> msgAuthoritativeEngineTime: 0
> msgUserName:
> msgAuthenticationParameters:<MISSING>
> msgPrivacyParameters:<MISSING>
> msgData: plaintext (0)
> plaintext
> contextEngineID:<MISSING>
> contextName:<MISSING>
> data: get-request (0)
> get-request
> request-id: 0
> error-status: noError (0)
> error-index: 0
> variable-bindings: 0 items
>
> No. Time Source Destination Protocol
> Info
> 2 0.000685 10.254.1.45 10.254.1.64 SNMP
> report SNMP-USER-BASED-SM-MIB::usmStatsUnknownEngineIDs.0
>
> Frame 2 (147 bytes on wire, 147 bytes captured)
> Ethernet II, Src: Supermic_43:f4:88 (00:30:48:43:f4:88), Dst:
> HewlettP_cd:2f:42 (00:24:81:cd:2f:42)
> Internet Protocol, Src: 10.254.1.45 (10.254.1.45), Dst: 10.254.1.64
> (10.254.1.64)
> User Datagram Protocol, Src Port: snmptrap (162), Dst Port: 53112 (53112)
> Simple Network Management Protocol
> msgVersion: snmpv3 (3)
> msgGlobalData
> msgAuthoritativeEngineID: 80001F8880EF44283BEFC8284C
> msgAuthoritativeEngineBoots: 1
> msgAuthoritativeEngineTime: 3322
> msgUserName:
> msgAuthenticationParameters:<MISSING>
> msgPrivacyParameters:<MISSING>
> msgData: plaintext (0)
> plaintext
> contextEngineID: 80001F8880EF44283BEFC8284C
> contextName:<MISSING>
> data: report (8)
> report
> request-id: 0
> error-status: noError (0)
> error-index: 0
> variable-bindings: 1 item
>
> SNMP-USER-BASED-SM-MIB::usmStatsUnknownEngineIDs.0
> (1.3.6.1.6.3.15.1.1.4.0): 11
> Object Name: 1.3.6.1.6.3.15.1.1.4.0
> (SNMP-USER-BASED-SM-MIB::usmStatsUnknownEngineIDs.0)
> Scalar Instance Index: 0
>
> SNMP-USER-BASED-SM-MIB::usmStatsUnknownEngineIDs: 11
>
> No. Time Source Destination Protocol
> Info
> 3 0.016482 10.254.1.64 10.254.1.45 SNMP
> informRequest
>
> Frame 3 (137 bytes on wire, 137 bytes captured)
> Ethernet II, Src: HewlettP_cd:2f:42 (00:24:81:cd:2f:42), Dst:
> Supermic_43:f4:88 (00:30:48:43:f4:88)
> Internet Protocol, Src: 10.254.1.64 (10.254.1.64), Dst: 10.254.1.45
> (10.254.1.45)
> User Datagram Protocol, Src Port: 53112 (53112), Dst Port: snmptrap (162)
> Simple Network Management Protocol
> msgVersion: snmpv3 (3)
> msgGlobalData
> msgAuthoritativeEngineID: 80001F8880EF44283BEFC8284C
> msgAuthoritativeEngineBoots: 0
> msgAuthoritativeEngineTime: 0
> msgUserName: user1
> msgAuthenticationParameters:<MISSING>
> msgPrivacyParameters:<MISSING>
> msgData: plaintext (0)
> plaintext
> contextEngineID: 80001F8880EF44283BEFC8284C
> contextName:<MISSING>
> data: informRequest (6)
> informRequest
> request-id: 550721570
> error-status: noError (0)
> error-index: 0
> variable-bindings: 0 items
>
> No. Time Source Destination Protocol
> Info
> 4 0.017038 10.254.1.45 10.254.1.64 SNMP
> report SNMP-USER-BASED-SM-MIB::usmStatsUnknownUserNames.0
>
> Frame 4 (155 bytes on wire, 155 bytes captured)
> Ethernet II, Src: Supermic_43:f4:88 (00:30:48:43:f4:88), Dst:
> HewlettP_cd:2f:42 (00:24:81:cd:2f:42)
> Internet Protocol, Src: 10.254.1.45 (10.254.1.45), Dst: 10.254.1.64
> (10.254.1.64)
> User Datagram Protocol, Src Port: snmptrap (162), Dst Port: 53112 (53112)
> Simple Network Management Protocol
> msgVersion: snmpv3 (3)
> msgGlobalData
> msgAuthoritativeEngineID: 80001F8880EF44283BEFC8284C
> msgAuthoritativeEngineBoots: 1
> msgAuthoritativeEngineTime: 3322
> msgUserName: user1
> msgAuthenticationParameters:<MISSING>
> msgPrivacyParameters:<MISSING>
> msgData: plaintext (0)
> plaintext
> contextEngineID: 80001F8880EF44283BEFC8284C
> contextName:<MISSING>
> data: report (8)
> report
> request-id: 550721570
> error-status: noError (0)
> error-index: 0
> variable-bindings: 1 item
>
> SNMP-USER-BASED-SM-MIB::usmStatsUnknownUserNames.0
> (1.3.6.1.6.3.15.1.1.3.0): 8
> Object Name: 1.3.6.1.6.3.15.1.1.3.0
> (SNMP-USER-BASED-SM-MIB::usmStatsUnknownUserNames.0)
> Scalar Instance Index: 0
>
> SNMP-USER-BASED-SM-MIB::usmStatsUnknownUserNames: 8
>
>
> Elise Atkins
--
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list