If I have an application running as non-root, can I still send out a snmp
trap? If so, how?
Here is what I have now:
std::cout << "Test sending traps." << std::endl;
netsnmp_ds_set_boolean( NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1
);
init_agent( "foo" );
init_snmp ( "foo" );
init_traps();
netsnmp_pdu *pdu = snmp_pdu_create( SNMP_MSG_TRAP2 );
snmp_add_var( pdu, 1.3.6.1.2.1.1.3.0 ...
snmp_add_var( pdu, 1.3.6.1.6.3.1.1.4.1.0 ... , 'o', "1.3.6.1.4.1.etc..." );
send_trap_pdu( pdu );
When I run it as root ("sudo test") then it works. Trap is sent out.
But when I run it as a normal user, then it fails to connect to snmpd and I
get the following:
Test sending traps.
No log handling enabled - turning on stderr logging
Warning: Failed to connect to the agentx master agent ([NIL]):
sending .1.3.6.1.4.1.38322.1.0.1
read_config_store open failure on /var/lib/snmp/foo.conf
read_config_store open failure on /var/lib/snmp/foo.conf
read_config_store open failure on /var/lib/snmp/foo.conf
Is there a way for non-root applications to send out traps?
Stéphane Charette
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders