sending traps

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, "...


Go Back   Usenet Forums > Networking and Network Related > SNMP Users

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-13-2008
dan anderson
 
Posts: n/a
Default sending traps

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

Reply With Quote
  #2 (permalink)  
Old 06-13-2008
Dave Shield
 
Posts: n/a
Default Re: sending traps

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

Reply With Quote
  #3 (permalink)  
Old 06-13-2008
dan anderson
 
Posts: n/a
Default Re: sending traps

> 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

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:06 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0