Discussion:
logging traps - traphandle calling Perl scripts
Irving Barría
2006-04-12 18:31:06 UTC
Permalink
Hi all,

My name is Irving Barría, a panamanian student of electronics
engineering, in charge of a project regarding net-snmp. I have installed
net-SNMP 5.1.4 on a RHEL AS 3 system with kernel version 2.4.24 and I
can generate traps and also receive them in the same machine through the
loopback interface. As you can see, I’m just testing but there is a plan
to use net-snmp in a production system. First of all, I would like to
know how to log the traps that my machine receives. In my test I open a
terminal and type the following:

# snmptrapd -f –Lo

After this, I open another terminal and type:

# snmptrap -v 1 -c public localhost "" "" 0 0 ""

As long as I understand, the first command starts the trap receiver
while the later generates a ColdStart trap. In the terminal where
snmptrapd is running I can see the receipt of the trap but I can’t
figure out how to log them in some file of my preference.

=============================== One more question
=======================================

Previously, I successfully tested traptoemail in a Windows machine. I
just had to install ActiveState’s ActivePERL and everything worked fine.
Now that I’m testing on Linux I’ve found some problems. What I would
like to know is how to install Perl correctly. Here is what I typed
during the installation:

# ./configure --with-perl-modules --enable-embedded-perl --enable-shared
# make
# make install
# cd perl
# perl Makefile.PL
# make
# make install

I don’t know why traptoemail (neither any other Perl script) does not
work! For testing, I wrote a very simple Perl program like this:

#!/usr/local/bin/perl
print "This is a test";

And modified my snmptrapd.conf (located at /usr/local/etc/snmp) as
follows:

traphandle default usr/bin/perl /usr/local/bin/Hello

And ran my test again (forcing snmptrapd to use the recently created
configuration file):

# snmptrapd -f –Lo –c /usr/local/etc/snmp/snmptrad.conf

And I can see the trap in the Terminal but no output from my Perl
script.
I have to mention that I after a long time testing I ended up installing
ActivePERL for Linux but nothing got better.
Could somebody help?

Thanks in advance for your time and attention.

Regards,
IB
Thomas Anders
2006-04-12 19:56:07 UTC
Permalink
Post by Irving Barría
My name is Irving Barría, a panamanian student of electronics
engineering, in charge of a project regarding net-snmp. I have installed
net-SNMP 5.1.4 on a RHEL AS 3 system with kernel version 2.4.24 and I
can generate traps and also receive them in the same machine through the
loopback interface. As you can see, I’m just testing but there is a plan
to use net-snmp in a production system.
If you're starting from scratch, please start with our latest release
(5.3.0.1 plus the official patches from
http://www.net-snmp.org/official_patches) instead of 5.1.4, especially
if you have a later production use in mind.
Post by Irving Barría
First of all, I would like to
know how to log the traps that my machine receives.
I suggest starting with our notification tutorial at:

http://www.net-snmp.org/tutorial/tutorial-5/commands/snmptrap.html

It hasn't been updated yet to cover the authorization changes introduced
in net-snmp 5.3, so please make sure to read

http://www.net-snmp.org/docs/man/snmptrapd.conf.html

(especially the ACCESS CONTROL section) also.
Post by Irving Barría
Now that I’m testing on Linux I’ve found some problems. What I would
like to know is how to install Perl correctly. Here is what I typed
# ./configure --with-perl-modules --enable-embedded-perl --enable-shared
# make
# make install
Alright so far.
Post by Irving Barría
# cd perl
# perl Makefile.PL
# make
# make install
Omit this part.


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