Wiki source code of How-to run NET-SNMP agent as a subagent of a SNMP4J-AgentX master agent?
Last modified by Frank Fock on 2024/05/25 13:03
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | === Run SNMP4J-AgentX Master Agent === |
| 2 | |||
| 3 | The following command line starts the SNMP4J-AgentX master agent for testing. The option **-X** binds the AgentX listen port to the local loop address on port **705**. | ||
| 4 | |||
| 5 | //Note: On UNIX systems, you will have to run the agent with root privileges in order to be able to bind ports below 1024.// | ||
| 6 | |||
| 7 | {{code}} | ||
| 8 | java -cp snmp4j-agentx-2.0.1.jar;snmp4j-agent-2.0.6.jar;snmp4j-2.1.jar org.snmp4j.agent.agentx.master.test.TestMasterAgent -X tcp:127.0.0.1/705 udp:0.0.0.0/161 | ||
| 9 | {{/code}} | ||
| 10 | |||
| 11 | === Run NET-SNMP Subagent === | ||
| 12 | |||
| 13 | When the master agent is running, you can start the NET-SNMP subagent: | ||
| 14 | |||
| 15 | {{code}} | ||
| 16 | cd net-snmp-5.5/agent/ | ||
| 17 | ./snmpd --X 705 | ||
| 18 | {{/code}} | ||
| 19 | |||
| 20 | The option **~-~-X** lets the NET-SNMP agent run as an AgentX sub-agent that connects to the port **705** on the local host. | ||
| 21 | |||
| 22 | Both agents can be stopped and restarted individually, because the subagent will try to reconnect periodically if it loses connection to the master agent. | ||
| 23 | |||
| 24 |