How to use SNMP++ and AGENT++

Hello,
I am a newbie to snmp++ and trying to evaluate the SNMP++ library for use. I do not have a clear idea how to compile and use the libraries to create a SNMP agent that can reply to snmp requests. And going through the documents and articles I am confused between SNMP++ and AGENT++ that we see in the downloads section. This question might sound silly but what is the difference between SNMP++ and AGENT++. If I am trying to implement an agent will I need to use both SNMP++ and AGENT++ or using any one is sufficient.
Any Input is appreciated to move forward with this, Thanks in advance.

For an agent, you need both AGENT++ and SNMP++. In the AGENT++ package you will find readme for building with autoconf.
In the examples directory there ate sample agents.

I have an embedded application running in a PPC Linux based controller and I want to enable my application to respond to the snmp requests made by the manager. I am unable to find any documentation that can guide the steps to use AGENT++ to perform this task. Any suggestions for this?

Hi,
I have been able to generate sample code using AgenPro for some scalar OID’s. How can I use it with the agent so that it can respond to the snmp requests with the values generated by the application?
The flow is not very clear from the documentations. Please suggest steps to move forward.
Thanks.

Do you have compiled and running the agent with your generated sources already?

If not, then please copy the generated files to the agenpro/agent/src and AgenPro/agent/include directories of the AGENT++ distribution (or AgentX++).

If yes, then please follow the examples/documentation available in the AGENT++v2.x documentation PDF: https://www.agentpp.com/download/agent++2.pdf
Although the API does not 100% match to what is available with AGENT++v4.x but the basics are still valid.
For implementing correct multi-threading protection see also:
What is the lock order for Mib objects to protected them multi-threaded agent? - AGENT++ - AGENTPP

Hope this helps.

Best regards,
Frank

Yes I got the steps and generated the code was also able t compile it. After comipling the agent++ how can we run the agent on any system?
Thank you.

Run the ./agent executable from build directory.

I cannot find any build or bin directory in the agent++ - 4.5.1 package?

There is no bin directory created. The binaries are generated into the src directory by default.

After I run the ./agent. I can see that it is running but while doing snmpget I do not get any response from the agent. I get output as follows :-
root@Manager_44:/home/administrator/SNMP++_test/agent+±4.5.1/agenpro/agent/src# 20211206.16:32:41: 140517185693504: (1)EVENT : main: SNMP listen port: (4700)
20211206.16:32:41: 140517185693504: (5)INFO : saveBootCounter: Saved counter (file) (engine id) (boot): (snmpv3_boot_counter), ( 80 00 13 70 05 4D 61 6E 61 67 65 72 5F 34 34 12 …p.Manager_44.
5C
), (4)
20211206.16:32:41: 140517185693504: (3)INFO : AuthPriv: Added default Auth and Priv protocols.
20211206.16:32:42: 140517185693504: (1)ERROR : UsmUserTable: Unsupported privProtocol: (9)
20211206.16:32:42: 140517185693504: (1)ERROR : UsmUserTable: Unsupported privProtocol: (9)
20211206.16:32:42: 140517185693504: (1)WARNING: MibContext: duplicate MibGroup registration (context)(oid): (), (1)
20211206.16:32:42: 140517185693504: (1)WARNING: MibContext: duplicate MibGroup registration (context)(oid): (), (0)

The agent listens on UDP port 4700. Do you send the requests to port 4700? If the port is ok, what parameters (SNMP version, user,…) are you using in the snmpget tool?

Yes I have changed the Port number to 161 in agent.cpp. But what does Error : UsmUserTable: Unsupported privProtocol: (9) represents and how to fix it?

The error for unsupported privProtocol 9 is not important: You did not enable support for the non standard IDEA privacy protocol, but the example agent tries to add a user with this protocol and fails. To “fix” the example agent, just disable the code that adds/configures the users SHAIDEA and MD5IDEA.

To be sure: After changing the port to 161, you are now able to get the responses from the agent?

Yes After changing the Port to 161 I am getting the response.
But I am sending the request using snmp v1. If I want to use snmpv2c and v3 how/where can I set the auth and priv related configurations?

Thanks.

The example agents have some SNMPv3 users that are added through the UsmUserTable. The access control is done through the VACM. The SNMPv1 and SNMPv2c community string is mapped to the VACM configuration through the snmpCommunityEntry.