This is a discussion on sending traps within the SNMP Users forums, part of the Networking and Network Related category; In an attempt to send traps from a standalone, I've done the following: create_trap_session("localhost", 0, "...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
In an attempt to send traps from a standalone, I've done the following:
create_trap_session("localhost", 0, "public", 1, SNMP_MSG_TRAP2); init_traps(); [ populate notification_vars ] send_v2trap(notification_vars); But without success. When I step through in gdb, the sinks list is empty. I've tried using netsnmp_config("trap2sink localhost"); as well. (Also, snmpd_parse_config_trap2sink("", "localhost");, but that segfaults in a tokenizer - even when there's whitespace around localhost - and I can't really see why.) Am I doing something ludicriously wrong somewhere? Does anyone happen to have sample code (I've searched!) for sending a trap from a standalone? Or even for create_trap_session? Cheers, -Dan ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ 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/...net-snmp-users |
|
|||
|
2008/6/13 dan anderson <dan.j.anderson@gmail.com>:
> In an attempt to send traps from a standalone, I've done the following: > > create_trap_session("localhost", 0, "public", 1, SNMP_MSG_TRAP2); > init_traps(); > [ populate notification_vars ] > send_v2trap(notification_vars); It's not clear what you mean by "a standalone". The 'send_v2trap' routine is part of the agent API. If you're working with a standalone application, then this won't work. You'll need to use 'snmptrap.c' as a template in this case. But from the rest of your post, it sounds as if you are working with some sort of agent. > When I step through in gdb, the sinks list is empty. That's normal. This list is a left-over from the early days of the project. Now, traps are handled by the Notification MIB module. That's the purpose of the SNMPD_CALLBACK_SEND_TRAP[12] calls towards the end of netsnmp_send_traps. > Does anyone happen to have sample code (I've searched!) > for sending a trap from a standalone? What do you mean by "a standalone"? Dave ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ 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/...net-snmp-users |
|
|||
|
> It's not clear what you mean by "a standalone".
> > The 'send_v2trap' routine is part of the agent API. > If you're working with a standalone application, then > this won't work. You'll need to use 'snmptrap.c' as > a template in this case. Ah, thanks. I didn't realize that API calls would require a running agent, which I don't have the luxury of. I was hoping to be able to avoid working with netsnmp_session objects directly. > That's normal. > This list is a left-over from the early days of the project. Ah, good to know. Thanks for the help, -Dan ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ 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/...net-snmp-users |
![]() |
| Thread Tools | |
| Display Modes | |
|
|