相关文章推荐
忐忑的钢笔  ·  delphi ...·  1 年前    · 
深情的山寨机  ·  python jsonpath-ng ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

SNMP4J : Is it possible to create an OID in the agent (server) MIB from the manager (client)?

Ask Question

I am using SNMP4J Framework and it implements and makes possible the standard SET, GET, GET-NEXT, etc. messages.

For example, with a SET, I can update the value of the MIB OID "1.3.6.1.2.50.0". This works perfectly for me. I can do that using org.snmp4j.Snmp.set(PDU pdu, Target target)

What I want to do now is to CREATE a custom MIB OID (as "1.3.6.1.2.100.0") FROM the client and assign a value to it and not simply update an existing MIB OID value.

Is there any standard SNMP way to do that easily ?

But it doesn't make sense in the context of SNMP to "create" a new scalar out of thin air; normally you are setting one already defined with a pre-defined OID, and that OID will usually be shared agent -> manager via a MIB file. Its OID will be the 0th instance (e.g., sysDescr.0).

You can however add/remove rows in a SNMP table (its rows and cells will have OIDs at instance 1, instance 2, etc.); and that SNMP table may have zero rows. The cells in the table can have values.

Here is some background info on SNMP tables .

Thank you for your answer @k1eran. Do you think it is possible to append a custom OID (determined by the manager) in an SNMP table ? For example, the table will be at OID "1.3.6.1.2.1" and I want to append an IP address to this OID "1.3.6.1.2.1.vvv.xxx.yyy.zzz", then increment a statistic linked to this IP address in another column of the row. rBenks93 Oct 27, 2015 at 14:50 Yes, you can define a table where its rows have index of type = IpAddress (see tools.ietf.org/html/rfc1155 ) and other columns with whatever data, e.g. statistics, that you need. k1eran Oct 28, 2015 at 0:36 Do you have an idea which method can I use to add a row to the table ? I'm trying with PDU.addAll(VariableBinding[] vbs) but it doesn't work. rBenks93 Oct 28, 2015 at 16:19 Look at MOTable snmp4j.org/agent/doc/org/snmp4j/agent/mo/MOTable.html Also look at examples at jayway.com/2010/05/21/introduction-to-snmp4j k1eran Oct 29, 2015 at 17:52 "its rows and cells will have OIDs at instance 0, instance 1, etc" Although valid, recommended best practice is to avoid that - have your table indexes start at 1 to avoid confusion. See §7.7 in RFC 2578. Lightness Races in Orbit Oct 17, 2017 at 22:28

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .