Search code examples
snmpnet-snmp

c++ How to write value to OID with snmp-net


I follow this tutorial. I success to do all , but i cannot figure out how to change the MIB scalar value from my application.

I want to write values from my application to these OID in order to have the ability to monitor my application by SNMP.

the tutorial show you how to register an OID and set value to it, but how do i change the value from my application based on application state?

My goal: I have my own application (simple business application) that run on Ubuntu machine. I monitor the hosting machine from a remote client by SNMP . I monitor things like CPU , RAM .. I do this by send snmp-get to these OID.

As part of the hosting monitoring i want to monitor my application too (for example request_quoue_size), so i tought that the way to do this is by write my own MIB module and write call to set from my app on this OID, i am looking now how to call set (c++) and if this is the way.


Solution

  • First of all MIB is only an interface (it specifies all the OIDs accessible from the MIB module). Is your application the SNMP agent or SNMP consumer?

    If you are within SNMP agent then I assume you have a direct access to the memory, where OID is located. So, what is your problem exactly?

    If you are within SNMP client then you need to send snmp-set request to the agent using proper UDP packet...

    Please add some details on what you are trying to achieve.