On Thu, 2005-06-09 at 11:55, Thorsten Freimann wrote:
> I want to write a simple application to send traps (similar to the
> snmptrap app from net-snmp). The idea is, that the application
> takes all trapsinks from the snmpd.conf file and send the trap
> to all defined trapsinks.
>
> Is there another (easier) way than to call
> get_configuration_directory() to get the snmp-configuration dirs,
> get the right file and to parse it?
How about (untested):
netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_APPTYPE, "snmpd");
register_app_config_handler("trapsink", my_parse_trapsink,
NULL, NULL);
init_snmp( "snmpd" );
That (or something along those lines) should call your routine
"my_parse_trapsink" for each entry in the various snmpd.conf files.
You'd also need to handle "trap2sink", "informsink" and "trapsess"
directives, but that gives you the basic idea.
Dave
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders