I have embedded a net-snmp agentx subagent in my c++ application code on Ubuntu 
Linux. I want to disable the agentx subagent once it is working and then 
re-enable it again. I am successfully able to setup the agent, poll the mib 
using snmpget from the command line and disable agentx socket connection by 
using snmp_shutdown but I am unable to re-enable the socket connection again 
once I disable it. 


Appreciate any help/pointers.

I use the following code to initialise the SNMP library and the agentx socket 
connection.

In the beginning, initialise the AgentX subagent -

netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1);
        netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 120);
        netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, 
NETSNMP_DS_AGENT_X_SOCKET, m_agentx_socket.c_str());
        

/* initialize the agent library */
init_agent("MyApp");
// initialise MIB module
init_snmp("MyApp");

The poll the MIB using snmpget and disable the connection using the function 
below -
snmp_shutdown("MyApp");
SOCK_CLEANUP;

Works fine so far.

Then I re-enable the connection using the code below but this does not work.
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1);
        netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 120);
        netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, 
NETSNMP_DS_AGENT_X_SOCKET, m_agentx_socket.c_str());
        

/* initialize the agent library */
init_agent("MyApp");
init_snmp("MyApp");
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to