You are hereBlogs / hutcho's blog / Setup SNMPTT in Ubuntu 8.10 for traps to go to MySQL

Setup SNMPTT in Ubuntu 8.10 for traps to go to MySQL


By hutcho - Posted on 14 December 2009

Download from here:
http://sourceforge.net/projects/snmptt/files/

Basic installing from here (with exceptions below):
http://snmptt.sourceforge.net/docs/snmptt.shtml#Installation-Unix

Found some of the paths not right for Ubuntu such as:
cp snmptt.init.d to /etc/rc.d/init.d/snmptt
should be
cp snmptt.init.d to /etc/init.d/snmptt

9.4. I see following error: Can't locate Config/IniFiles.pm in @INC ...What should I do?
It's likely that you don't have required Perl modules installed. In this case it's Config::IniFiles that is missing. The easiest way to install Perl modules is to use CPAN extension, eg. perl -MCPAN -e 'install Config::IniFiles'.

From here: http://www.secit.at/doc/snmptt-1.0/html/faqs.html
Q: Why doesn't the snmptt-init.d script work with Debian?

The snmptt-init.d script provided with SNMPTT was written for Mandrake and RedHat. To make the script work with Debian without requiring any re-writing of the script, copy /etc/init.d/skeleton to /etc/init.d/functions.

Database setup here:
http://snmptt.sourceforge.net/docs/snmptt.shtml#LoggingDatabase-MySQL

Put this line in your /etc/rc.local file:
/usr/sbin/snmptrapd -f -Lo -On
Whenever system starts, rc.local is the last file which system checks before loading.

Testing

Get this going in a terminal window so you can see the raw UDP data.
tcpdump -i tun0 port 162

Add this to /etc/snmp/snmptrapd.conf
disableAuthorization yes

Run this
snmptrapd -P -F "%02.2h:%02.2j TRAP%w.%q from %A\n"

And then this:
snmptrap -v 1 -c public localhost 1.2.3.4 localhost 3 0 ’’ 1.2.3.4 i 1

You should see some output.