Writing a custom trap handling daemon

2010-11-22 Thread Tsolakos Stavros
Hi all.

I have to write a custom SNMP trap handling service which will listen to
traps fired by some devices and generate new traps to a specific target.

So far, I have not found any example code about how this can be done.
Does any of you know of any similar tutorials? Could somebody provide
some sample code about how can this be done?

Thank you very much.

Stavros

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
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/listinfo/net-snmp-users


RE:SNMP Trap Handling

2009-01-19 Thread Sudhakaran, Sonu (STSD)
Hi

We can declare Asynchronous callback routine to be called while we create 
netsnmp session. Check the code given below.

static netsnmp_session *
snmptrapd_add_session(netsnmp_transport *t)
{
netsnmp_session sess, *session = sess, *rc = NULL;

snmp_sess_init(session);
session-peername = SNMP_DEFAULT_PEERNAME;  /* Original code had NULL here 
*/
session-version = SNMP_DEFAULT_VERSION;
session-community_len = SNMP_DEFAULT_COMMUNITY_LEN;
session-retries = SNMP_DEFAULT_RETRIES;
session-timeout = SNMP_DEFAULT_TIMEOUT;
session-callback = snmp_trapd_input;-- This 
is the trap handler which gets called.
session-callback_magic = (void *) t;
session-authenticator = NULL;
sess.isAuthoritative = SNMP_SESS_UNKNOWNAUTH;

rc = snmp_add(session, t, pre_parse, NULL);
}

Once you call this function, use the session returned to do all your trap 
administration. For more info, please have a look at - snmptrapd_handlers.c 
file under libnetsnmptrapd project files.

Cheers,
Sonu

-Original Message-
From: net-snmp-users-requ...@lists.sourceforge.net 
[mailto:net-snmp-users-requ...@lists.sourceforge.net]
Sent: Monday, January 19, 2009 2:35 PM
To: net-snmp-users@lists.sourceforge.net
Subject: Net-snmp-users Digest, Vol 32, Issue 32

Send Net-snmp-users mailing list submissions to
net-snmp-users@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
or, via email, send a message with subject or body 'help' to
net-snmp-users-requ...@lists.sourceforge.net

You can reach the person managing the list at
net-snmp-users-ow...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than Re: Contents of Net-snmp-users digest...


Today's Topics:

   1. SNMP trap handling (jayesh km)
   2. Re: SNMP trap handling (Dave Shield)
   3. Re: Table custom handlers (Nikos Balkanas)
   4. AW: net-snmp 5.4.1 writing to deprecated OIDs (Mohr James)
   5. snmpwalk not working (Shikhar Sachan)
   6. Re: snmpwalk not working (Dave Shield)
   7. could you please help me on this (ram k)


--

Message: 1
Date: Thu, 15 Jan 2009 15:03:33 +0530 (IST)
From: jayesh km km.jay...@yahoo.com
Subject: SNMP trap handling
To: net-snmp net-snmp-users@lists.sourceforge.net
Message-ID: 676314.79968...@web95004.mail.in2.yahoo.com
Content-Type: text/plain; charset=utf-8

Hi,

I was writing a program to convert SNMP traps to some proprietary trap format.
My requirement is to parse the SNMP trap PDU and get the trap and all variables 
associated with the trap and store it in a structure and pass it to some 
routine that will generate proprietary traps.

I looked into snmaptrapd.c file and could not make much from it. I don't know 
where exactly the trap PDU is parsed and how the OID in trap is matched to 
varibale name in MIB file. Can some one please point me how can I get sarted 
with this? How to get an application call back when a trap is received and how 
to match OID to actual name and extract variables from trap PDU

Thanks in advance,
Jayesh KM



  Unlimited freedom, unlimited storage. Get it now, on 
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/
-- next part --
An HTML attachment was scrubbed...

--

Message: 2
Date: Thu, 15 Jan 2009 09:44:28 +
From: Dave Shield d.t.shi...@liverpool.ac.uk
Subject: Re: SNMP trap handling
To: jayesh km km.jay...@yahoo.com
Cc: net-snmp net-snmp-users@lists.sourceforge.net
Message-ID:
c64ae3380901150144h257a7764s4dfe7c538bbc8...@mail.gmail.com
Content-Type: text/plain; charset=ISO-8859-1

2009/1/15 jayesh km km.jay...@yahoo.com:
   Can some one please point me how can I get
 sarted with this? How to get an application call back when a trap is
 received and how to match OID to actual name and extract variables from trap
 PDU

The simplest approach is probably to start with snmptrapd,
and then write your own trap handler, using something like
'print_handler' (in snmptrapd_handlers.c) as a template.

Then tweak the main routine (in snmptrapd.c) to add a call
to 'netsnmp_add_global_traphandler', specifying your new
handler.That will then invoke your code whenever a
trap is received, passing it the decoded trap PDU.

Dave



--

Message: 3
Date: Fri, 16 Jan 2009 01:44:48 +0200
From: Nikos Balkanas nbalka...@gmail.com
Subject: Re: Table custom handlers
To: Dave Shield d.t.shi...@liverpool.ac.uk
Cc: net-snmp-users@lists.sourceforge.net
Message-ID: 002401c9776b$412e5010$02b2a...@tardis
Content-Type: text/plain; format=flowed; charset=windows-1253;
reply-type=original

Thanx for the tip.

Changed code to point to *table_info-indexes-val.integer

BR,
Nikos
- Original Message -
From: Dave Shield d.t.shi

SNMP trap handling

2009-01-15 Thread jayesh km
Hi,

I was writing a program to convert SNMP traps to some proprietary trap format.
My requirement is to parse the SNMP trap PDU and get the trap and all variables 
associated with the trap and store it in a structure and pass it to some 
routine that will generate proprietary traps.

I looked into snmaptrapd.c file and could not make much from it. I don't know 
where exactly the trap PDU is parsed and how the OID in trap is matched to 
varibale name in MIB file. Can some one please point me how can I get sarted 
with this? How to get an application call back when a trap is received and how 
to match OID to actual name and extract variables from trap PDU

Thanks in advance,
Jayesh KM 



  Unlimited freedom, unlimited storage. Get it now, on 
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword___
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/listinfo/net-snmp-users


Re: SNMP trap handling

2009-01-15 Thread Dave Shield
2009/1/15 jayesh km km.jay...@yahoo.com:
   Can some one please point me how can I get
 sarted with this? How to get an application call back when a trap is
 received and how to match OID to actual name and extract variables from trap
 PDU

The simplest approach is probably to start with snmptrapd,
and then write your own trap handler, using something like
'print_handler' (in snmptrapd_handlers.c) as a template.

Then tweak the main routine (in snmptrapd.c) to add a call
to 'netsnmp_add_global_traphandler', specifying your new
handler.That will then invoke your code whenever a
trap is received, passing it the decoded trap PDU.

Dave

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
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/listinfo/net-snmp-users


Re: trap handling

2007-06-13 Thread Dave Shield
On 11/06/07, Daniel Coelho [EMAIL PROTECTED] wrote:
 I received this when unplugging the network cable:

 Sending 149 bytes to 172.18.50.92
 2007-06-11 11:46:31 .
06 09 2B 06 01 06 03  01 01 05 04

That's a linkDown trap all right.


 If so, can you suggest where to start looking on how to generate disk and
 memory usage traps?

Firstly, set up suitable disk and swap entries in the snmpd.conf file.
You can then try walking the dskTable and memory group to check they
are detecting error conditions correctly.

Then add the line defaultMonitors yes, and the event MIB should
do the rest.

Dave

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
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/listinfo/net-snmp-users


Re: trap handling

2007-06-06 Thread Dave Shield
On 29/05/07, Daniel Coelho [EMAIL PROTECTED] wrote:
 I have configured net-snmp this way:

 /etc/snmp/snmpd.conf:
 trap2sink  127.0.0.1 public 162
 createUser  danielcoelho MD5 danielcoelho
 rouser  danielcoelho
 rwuser  danielcoelho
 agentSecNamedanielcoelho
 defaultMonitors yes
 linkUpDownNotifications yes

Well, you don't need both rouser and rwuser with the same name.
But that shouldn't affect linkUp/Down trap generation.


Try running the agent using
   snmpd -f -Le -d

What do you see if you unplug a network interface, and wait?

It might also be worth running the agent with '-Ddisman:event'
to see more detailed debugging info.

Dave

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
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/listinfo/net-snmp-users


trap handling

2007-05-30 Thread Daniel Coelho

I have configured net-snmp this way:

/etc/snmp/snmp.conf:
logtimestamp  1
defaultport  161
defversion  2c
defcommunity  public
dodebugging  0
dumppacket  1
printNumericOids true

/etc/snmp/snmpd.conf:
trapcommunity  public
trap2sink  127.0.0.1 public 162
authtrapenable  1
syscontact  [EMAIL PROTECTED]
rocommunity  public
rwcommunity  private
procnagios
procfix nagios  /sbin/service nagios restart
prochttpd
procfix httpd   /sbin/service httpd restart
procsnmpd   1 1
procsnmptrapd   1 1
includeAllDisks 10%
disk / 10%
load  0.08 0.08 0.08
file  /var/log/snmpd.log 1
createUser  danielcoelho MD5 danielcoelho
rouser  danielcoelho
rwuser  danielcoelho
agentSecNamedanielcoelho
defaultMonitors yes
linkUpDownNotifications yes

/usr/share/snmp/snmptrapd.conf:
authcommunity  log,execute,net  public
traphandle default /home/ent/exemplos_cpp/teste3.sh default
# the generic traps
traphandle SNMPv2-MIB::coldStart/home/ent/exemplos_cpp/teste3.sh cold
traphandle SNMPv2-MIB::warmStart/home/ent/exemplos_cpp/teste3.sh warm
traphandle IF-MIB::linkDown /home/ent/exemplos_cpp/teste3.sh down
traphandle IF-MIB::linkUp   /home/ent/exemplos_cpp/teste3.sh up
traphandle SNMPv2-MIB::authenticationFailure
/home/ent/exemplos_cpp/teste3.sh auth
# this one is deprecated
traphandle .1.3.6.1.6.3.1.1.5.6 /home/ent/exemplos_cpp/teste3.sh
egp-neighbor-loss
# enterprise specific traps
traphandle TRAP-TEST-MIB::demo-trap /home/ent/exemplos_cpp/teste3.sh
demo-trap
traphandle NOTIFICATION-TEST-MIB::demo-notif
/home/ent/exemplos_cpp/teste3.sh demo-notif
forward default 172.18.50.77:162
forward SNMPv2-MIB::coldStart   172.18.50.77:162
forward SNMPv2-MIB::warmStart   172.18.50.77:162
forward IF-MIB::linkDown172.18.50.77:162
forward IF-MIB::linkUp  172.18.50.77:162
forward SNMPv2-MIB::authenticationFailure   172.18.50.77:162
forward .1.3.6.1.6.3.1.1.5.6172.18.50.77:162
forward TRAP-TEST-MIB::demo-trap172.18.50.77:162
forward NOTIFICATION-TEST-MIB::demo-notif   172.18.50.77:162
forward default 172.18.50.161:162
forward SNMPv2-MIB::coldStart   172.18.50.161:162
forward SNMPv2-MIB::warmStart   172.18.50.161:162
forward IF-MIB::linkDown172.18.50.161:162
forward IF-MIB::linkUp  172.18.50.161:162
forward SNMPv2-MIB::authenticationFailure   172.18.50.161:162
forward .1.3.6.1.6.3.1.1.5.6172.18.50.161:162
forward TRAP-TEST-MIB::demo-trap172.18.50.161:162
forward NOTIFICATION-TEST-MIB::demo-notif   172.18.50.161:162
ignoreauthfailure  no
donotlogtraps  no
logOption o

Care to comment please?

Daniel Coelho

On 5/29/07, Dave Shield [EMAIL PROTECTED] wrote:


On 29/05/07, Daniel Coelho [EMAIL PROTECTED] wrote:
 I thought I needed the DisMan Event Handling
 to receive traps...

No.
The DisMan Event handling is used to *generate* traps.



 I want to send a trap to an IP when it occurs.
 For example, when I unplug the network cable,
 I want a trap to be sent to an IP automaticaly.
 The same goes for other kinds of traps that I
 will define, like traps for disk space, raid disks
 and memory usage...

That's exactly what the DisMan Event MIB is
designed to do.

 I have configured the snmp.conf, snmpd.conf
 and snmptrapd.conf files.

But *how* have you configured these files?

Dave

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
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/listinfo/net-snmp-users


trap handling

2007-05-29 Thread Daniel Coelho

I thought I needed the DisMan Event Handling
to receive traps...
I'm a bit confused. Let me explain again my aim.
I want to send a trap to an IP when it occurs.
For example, when I unplug the network cable,
I want a trap to be sent to an IP automaticaly.
The same goes for other kinds of traps that I
will define, like traps for disk space, raid disks
and memory usage...
I have configured the snmp.conf, snmpd.conf
and snmptrapd.conf files.
What am I missing?

I apreciate your help.

Daniel Coelho


On 5/29/07, Dave Shield [EMAIL PROTECTED] wrote:


On 29/05/07, Daniel Coelho [EMAIL PROTECTED] wrote:
I used a agentSecName equal to my rocommunity.

No.  That's not correct.

The DisMan event handling uses SNMPv3 requests internally,
so you *must* create an SNMPv3 user, and specify this as the
agentSecName.  See the documentation for details.

You can't just use a community string - this doesn't work with
the DisMan stuff.

Dave

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
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/listinfo/net-snmp-users


Re: trap handling

2007-05-29 Thread Dave Shield
On 29/05/07, Daniel Coelho [EMAIL PROTECTED] wrote:
 I thought I needed the DisMan Event Handling
 to receive traps...

No.
The DisMan Event handling is used to *generate* traps.



 I want to send a trap to an IP when it occurs.
 For example, when I unplug the network cable,
 I want a trap to be sent to an IP automaticaly.
 The same goes for other kinds of traps that I
 will define, like traps for disk space, raid disks
 and memory usage...

That's exactly what the DisMan Event MIB is
designed to do.

 I have configured the snmp.conf, snmpd.conf
 and snmptrapd.conf files.

But *how* have you configured these files?

Dave

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
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/listinfo/net-snmp-users


Re: trap handling

2007-05-29 Thread Daniel Coelho

I have configured net-snmp this way:

/etc/snmp/snmp.conf:
logtimestamp  1
defaultport  161
defversion  2c
defcommunity  public
dodebugging  0
dumppacket  1
printNumericOids true

/etc/snmp/snmpd.conf:
trapcommunity  public
trap2sink  127.0.0.1 public 162
authtrapenable  1
syscontact  [EMAIL PROTECTED]
rocommunity  public
rwcommunity  private
procnagios
procfix nagios  /sbin/service nagios restart
prochttpd
procfix httpd   /sbin/service httpd restart
procsnmpd   1 1
procsnmptrapd   1 1
includeAllDisks 10%
disk / 10%
load  0.08 0.08 0.08
file  /var/log/snmpd.log 1
createUser  danielcoelho MD5 danielcoelho
rouser  danielcoelho
rwuser  danielcoelho
agentSecNamedanielcoelho
defaultMonitors yes
linkUpDownNotifications yes

/usr/share/snmp/snmptrapd.conf:
authcommunity  log,execute,net  public
traphandle default /home/ent/exemplos_cpp/teste3.sh default
# the generic traps
traphandle SNMPv2-MIB::coldStart/home/ent/exemplos_cpp/teste3.sh cold
traphandle SNMPv2-MIB::warmStart/home/ent/exemplos_cpp/teste3.sh warm
traphandle IF-MIB::linkDown /home/ent/exemplos_cpp/teste3.sh down
traphandle IF-MIB::linkUp   /home/ent/exemplos_cpp/teste3.sh up
traphandle SNMPv2-MIB::authenticationFailure
/home/ent/exemplos_cpp/teste3.sh auth
# this one is deprecated
traphandle .1.3.6.1.6.3.1.1.5.6 /home/ent/exemplos_cpp/teste3.sh
egp-neighbor-loss
# enterprise specific traps
traphandle TRAP-TEST-MIB::demo-trap /home/ent/exemplos_cpp/teste3.sh
demo-trap
traphandle NOTIFICATION-TEST-MIB::demo-notif
/home/ent/exemplos_cpp/teste3.sh demo-notif
forward default 172.18.50.77:162
forward SNMPv2-MIB::coldStart   172.18.50.77:162
forward SNMPv2-MIB::warmStart   172.18.50.77:162
forward IF-MIB::linkDown172.18.50.77:162
forward IF-MIB::linkUp  172.18.50.77:162
forward SNMPv2-MIB::authenticationFailure   172.18.50.77:162
forward .1.3.6.1.6.3.1.1.5.6172.18.50.77:162
forward TRAP-TEST-MIB::demo-trap172.18.50.77:162
forward NOTIFICATION-TEST-MIB::demo-notif   172.18.50.77:162
forward default 172.18.50.161:162
forward SNMPv2-MIB::coldStart   172.18.50.161:162
forward SNMPv2-MIB::warmStart   172.18.50.161:162
forward IF-MIB::linkDown172.18.50.161:162
forward IF-MIB::linkUp  172.18.50.161:162
forward SNMPv2-MIB::authenticationFailure   172.18.50.161:162
forward .1.3.6.1.6.3.1.1.5.6172.18.50.161:162
forward TRAP-TEST-MIB::demo-trap172.18.50.161:162
forward NOTIFICATION-TEST-MIB::demo-notif   172.18.50.161:162
ignoreauthfailure  no
donotlogtraps  no
logOption o

Care to comment please?

Daniel Coelho

On 5/29/07, Dave Shield [EMAIL PROTECTED] wrote:


On 29/05/07, Daniel Coelho [EMAIL PROTECTED] wrote:
 I thought I needed the DisMan Event Handling
 to receive traps...

No.
The DisMan Event handling is used to *generate* traps.



 I want to send a trap to an IP when it occurs.
 For example, when I unplug the network cable,
 I want a trap to be sent to an IP automaticaly.
 The same goes for other kinds of traps that I
 will define, like traps for disk space, raid disks
 and memory usage...

That's exactly what the DisMan Event MIB is
designed to do.

 I have configured the snmp.conf, snmpd.conf
 and snmptrapd.conf files.

But *how* have you configured these files?

Dave

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
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/listinfo/net-snmp-users


Re: Trap handling

2006-03-02 Thread Dave Shield
On Thu, 2006-03-02 at 12:22 +0530, vishakha s wrote:
 I just want some guidance in how to handle Traps and
 which file will handle trap .

The command 'snmptrapd' is used for handling traps.
It's impossible to be more precise without more details
about exactly what you want to do.

Dave


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
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/listinfo/net-snmp-users


Trap handling

2006-03-01 Thread vishakha s
Hi

I just want some guidance in how to handle Traps and which file will handle
trap .



Thanks
Vishakha

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s)and may 
contain confidential or privileged information. If you are not the intended 
recipient, please notify the sender or [EMAIL PROTECTED]


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
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/listinfo/net-snmp-users


Re: Trap handling

2005-11-10 Thread Dave Shield
On Thu, 2005-11-10 at 10:33 +0530, [EMAIL PROTECTED] wrote:

 We have a requirement to support trap handling in our project. 
 Requirement is whenever a trap is received a function should be called
 which extracts the community string and performs some operation. 

 How can the same functionality be achieved using net-snmp

Have a look at 'snmptrapd' - in particular the routines
   netsnmp_add_traphandler()  and
   netsnmp_add_global_traphandler()


These can be used to invoke a specified routine when
either a particular trap arrives (1st form), or *any*
trap arrives (2nd form)

 
 I read about snmptrapd and snmptrapd.conf

Unfortunately, snmptrapd.conf won't help you here.
That can be used to configure various standard trap
handler routines, but not to add new ones.  If you
need to add this extra functionality, you're going
to have to start tweaking the snmptrapd code itself.


Have a look at some of the existing trap handlers
(in 'snmptrapd_handler.c'), and how they are registered
(in 'snmptrapd.c').

Any questions, just ask on the list.

Dave
 


---
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42 plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.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/listinfo/net-snmp-users


Re: Trap handling

2005-11-10 Thread Thomas Anders

Dave Shield wrote:

On Thu, 2005-11-10 at 10:33 +0530, [EMAIL PROTECTED] wrote:

We have a requirement to support trap handling in our project. 
Requirement is whenever a trap is received a function should be called
which extracts the community string and performs some operation. 


Unfortunately, snmptrapd.conf won't help you here.
That can be used to configure various standard trap
handler routines, but not to add new ones.  If you
need to add this extra functionality, you're going
to have to start tweaking the snmptrapd code itself.


Not necessarily. If your installation has been configured with 
--enable-embedded-perl (check net-snmp-config --configure-options if 
you're unsure), you can register your own *Perl* function via 
snmptrapd.conf:


  perl NetSNMP::TrapReceiver::register(trapOID, \myfunc);

Check the NetSNMP::TrapReceiver(3pm) manual page for details.


+Thomas

--
Thomas Anders (thomas.anders at blue-cable.de)


---
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42 plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.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/listinfo/net-snmp-users


Trap handling

2005-11-09 Thread sushma.sangameswaran



Hi,

We have a requirementto support trap 
handling in our project.

Requirement is whenever a trap is received a 
function should be called which extracts the community string and performs some 
operation. 

With were able to do it with 
scotty(opening a listener session and binding it with a callback function. 
Please see the code below). 

set session 
[Tnm::snmp listener -port 162 -version SNMPv1 -transport udp -tags 
{}]$sessionbind trap { set pdu "%V" set community 
"%C"}

How can the same functionality be achieved 
using net-snmp(a callback function should be called whenever a trap is 
received).

I read about snmptrapd and snmptrapd.conf, 
but I am not sure how to use it to achieve the above functionality.

Can anybody help me with this 
problem?


Thanks in advance 
Regards,Sushma






Re: Problem with trap handling

2004-09-09 Thread Dave Shield

 1) I created a  MIB file
 

 demotraps OBJECT IDENTIFIER ::= { ucdExperimental 990 }
 
 demo-trap TRAP-TYPE
  ENTERPRISE demotraps
  ::= 17


 traphandle TRAP-TEST-MIB::demo-trap /home/nba/bin/traps demo-trap

I would *strongly* suggest that you define your MIBs using SMIv2
rather than SMIv1.

SMIv1 used a different approach to defining traps, so
TRAP-TEST-MIB::demo-trap is not strictly speaking an OID at all.

I'm not at all sure how snmptrapd would interpret this.


Try translating TRAP-TEST-MIB into SMIv2 (i.e. use NOTIFICATION-TYPE)
and see if that's any better.

Dave

PS: Please - no HTML mail.  Thanks



---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
___
Net-snmp-users mailing list
[EMAIL PROTECTED]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users