this is what I searched! But it doesnt work :-(
I write down this code:
>>
void do_nothing(const char *word, char *cptr)
{
gnRun++;
printf("run");
return;
}
int main(void)
{
netsnmp_session session, *ss;
struct config_line cl;
netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE,
"snmpd");
register_app_config_handler("trapsink", do_nothing, NULL, NULL);
init_snmp("snmpd");
return 1;
}
<<
and I expected, that the "do_nothing" function will be called three or four
time, but it was not called at all!
Am I doing the right things?
Thank you for help!
>>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
_________________________________________________________________________
Mit der Gruppen-SMS von WEB.DE FreeMail k�nnen Sie eine SMS an alle
Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179
-------------------------------------------------------
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
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders