1
votes

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 : Mib Browser snmpTargetAddrTable

When i try to change the ip address i get an error : Set window

Error message

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

1
Isn't it simply a change of IP address to the SNMP browser machine?Lex Li
I am trying to add an entry from the mib browser and not from the code as the SNMP agent will be packaged as a standalone agent on a remote machine.Laurent B
Then this question does not belong to SO, as it is not programming related.Lex Li

1 Answers

1
votes

For further info, i solved my problem using the NET-SNMP tools.

What i did was :

  1. Download net-snmp binaries
  2. Make sure the mibs are located in the default folder (see readme)
  3. 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