Reputation: 2220
I am fairly new to SNMP and i have created a SNMP Agent in java using the snmp4j library. In my code, i have added localhost as a trap destination. I therefore receive the notifications on the port 162 :
targetMIB.addTargetAddress(new OctetString("notification"),
TransportDomains.transportDomainUdpIpv4,
new OctetString(new UdpAddress("127.0.0.1/162").getValue()),
200, 1,
new OctetString("notify"),
new OctetString("v2c"),
StorageType.permanent);
What i am trying to do now is to receive traps from another ip address using a snmp browser such as iReasoning MIB Browser. But there i cannot manage to add an entry to the target mib.
Am i missing something ?
Thank you.
EDIT :
I want to add an entry using the mib browser to the target Address table. With iReasoning Mib browser i don't have the create row button and with ManageEngine's tool i have an add button but it does not seem to do anything.
I am therefore only trying here to change the row i have created with the code :
Here is a screen shot of the mib browser :
When i try to change the ip address i get an error :
I have tried to set the value using an OctetString with : 127.0.0.1:162 127.0.0.1/162 0700000100A2 0x0700000100A2
but nothing works
Upvotes: 1
Views: 1857
Reputation: 2220
For further info, i solved my problem using the NET-SNMP tools.
What i did was :
Try a snmpwalk :
snmpwalk -v2c -c [READ_COMMUNITY] 127.0.0.1 targetaddrtable
SNMP-TARGET-MIB::snmpTargetAddrTDomain.'test' = OID: SNMPv2-TM::snmpUDPDomain SNMP-TARGET-MIB::snmpTargetAddrTAddress.'test' = Hex-STRING: 00 00 00 00 00 A1 SNMP-TARGET-MIB::snmpTargetAddrTimeout.'test' = INTEGER: 1500 SNMP-TARGET-MIB::snmpTargetAddrRetryCount.'test' = INTEGER: 3 SNMP-TARGET-MIB::snmpTargetAddrTagList.'test' = STRING: v2c SNMP-TARGET-MIB::snmpTargetAddrParams.'test' = STRING: SNMP-TARGET-MIB::snmpTargetAddrStorageType.'test' = INTEGER: nonVolatile(3)
4) Do a set :
snmpset -v2c -c [COMMUNITY_WRITE] 127.0.0.1 snmpTargetAddrTAddress.'test' x 0000000000A1 snmpTargetAddrTDomain.'test' o 1.3.6.1.6.1.1 snmpTargetAddrTagList.'test' s notify snmpTargetAddrParams.'test' s v2c snmpTargetAddrRowStatus.'test' i 4
SNMP-TARGET-MIB::snmpTargetAddrTAddress.'test' = Hex-STRING: 00 00 00 00 00 A1
SNMP-TARGET-MIB::snmpTargetAddrTDomain.'test' = OID: SNMPv2-TM::snmpUDPDomain
SNMP-TARGET-MIB::snmpTargetAddrTagList.'test' = STRING: notify
SNMP-TARGET-MIB::snmpTargetAddrParams.'test' = STRING: v2c
SNMP-TARGET-MIB::snmpTargetAddrRowStatus.'test' = INTEGER: createAndGo(4)
the snmpTargetAddrTAddress is a test
Upvotes: 1