I am working on extending net-snmp to write a subagent with agentX. Now I use the example codes from net-snmp, and compiled to a subagent. Below is the codes I get from: http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_MIB_Module
And I succeed to perform snmpget and snmpset to my subagent using agentX.
My questions:
I think the subagent and master agent are listening on a port, how can I find which port they are listening? I have been told the default port is 705, but when I use "netstat", I can't find any process listening on port 705.
How to change the listening port of subagent? Do I need to change in the example code to set the port?
By default, actually, on "anything but windows" the default is to listen to a unix socket located at /var/agentx/master
.
You can change the listening address using the API suggested by the other poster, or even using the snmpd.conf configuration file:
agentXSocket tcp:localhost:705
When you create a subagent, it'll read your FOO.conf
file where FOO
is what you passed to init_snmp("FOO");