Thursday, October 7, 2010

SNMPTT for Trap Monitoring with Nagios + Cacti Install

Install & Configure Prerequisites

CentOS 5.5


Install Net-SNMP for the perl Modules

yum install net-snmp net-snmp-utils net-snmp-devel -y

yum groupinstall 'Development Tools'

yum groupinstall 'Development Libraries'

yum install perl-Config-IniFiles-2.56-1.el5.rf.noarch

Install Apache

yum install httpd php gcc glibc glibc-common gd gd-devel 

Configure Apache to start on boot

/sbin/chkconfig --levels 345 httpd on 

Configure iptables to allow Apache traffic

/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT 

/etc/init.d/iptables save 

/etc/init.d/iptables restart 

Install & Configure Nagios

Install Nagios & Plugins

yum install nagios nagios-plugins nagios-plugins-setuid

Create the default Nagios web access user & set a password

htpasswd -c /etc/nagios/htpasswd.users nagiosadmin

Verify default config files

nagios -v /etc/nagios/nagios.cfg

Start Nagios

/etc/init.d/nagios start

Start Apache

/etc/init.d/httpd start

Download SNMPTT

wget http://downloads.sourceforge.net/project/snmptt/snmptt/snmptt_1.3/snmptt_1.3.tgz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fsnmptt%2Ffiles%2Fsnmptt%2Fsnmptt_1.3%2F&ts=1299457062&use_mirror=cdnetworks-us-2

Extract SNMPTT

tar xvzf snmptt_1.3.tgz

From the files it extracts

1. Copy snmptt to /usr/sbin/ and ensure it is executable (chmod +x snmptt)


2. Copy snmptthandler to /usr/sbin/ and ensure it is executable (chmod +x snmptthandler)


3. Copy snmptt.ini to /etc/snmp/ or /etc/ and edit the options inside the file.


4. Create the log folder /var/log/snmptt/.

Create the file snmptrapd.conf in /etc/snmp

nano snmptrapd.conf and add

traphandle default /usr/sbin/snmptt
disableAuthorization yes
donotlogtraps no

5. For daemon mode:

Modify the Net-SNMP snmptrapd.conf file by adding the following line:

traphandle default /usr/sbin/snmptthandler

Create the spool folder /var/spool/snmptt/:

mkdir /var/spool/snmptt/

A startup script is included which can be used to start and stop snmptt on Mandrake, RedHat and other systems. Copy the script to the init.d directory (renaming the file during the copy):

cp snmptt.init.d /etc/rc.d/init.d/snmptt

Add the service using chkconfig:

chkconfig --add snmptt

Configure the service to start at runlevel 2345:

chkconfig --level 2345 snmptt on

Snmptt will be started at the next reboot, or can be started immediately with:

service snmptt start

or

/etc/rc.d/init.d/snmptt start

To manually start snmptt, use:

snmptt --daemon

6. A log rotation script is included which can be used to rotate the log files on Mandrake, RedHat and other systems. Copy the file to the logrotate.d directory (renaming the file during the copy):

cp snmptt.logrotate /etc/logrotate.d/snmptt

Edit the /etc/logrotate.d/snmptt and update the paths and rotate frequency as needed.

7. Start snmptrapd using the command line: snmptrapd -On.


You should be able to edit the /etc/rc.d/init.d/snmptrapd script if you have one and change

the OPTIONS to "-On".

Note: The -On is recommended. This will make snmptrapd pass OIDs in numeric form and prevent SNMPTT from having to translate the symbolic name to numerical form. If the UCD-SNMP / Net-SNMP Perl module is not installed, then you MUST use the -On switch. Depending on the version of UCD-SNMP / Net-SNMP, some symbolic names may not translate correctly. See the FAQ for more info.

As an alternative, you can edit your snmp.conf file to include the line: printNumericOids 1. This setting will take effect no matter what is used on the command line.










Install instructions




http://xavier.dusart.free.fr/joomla/index.php/en/nagios/47-traps-snmp-dans-nagios




and




http://www.snmptt.org/docs/snmptt.shtml






For Testing enable







unknown_trap_log_enable = 1

log_system_enable = 1










Place holder










Useful Websites


http://xavier.dusart.free.fr/joomla/index.php/en/nagios/47-traps-snmp-dans-nagios


http://docstore.mik.ua/orelly/networking_2ndEd/snmp/appc_03.htm






Testing traps on Centos










snmptrap -v 1 -c public localhost UCD-SNMP-MIB::ucdStart "" 6 17 "" SNMPv2-MIB::sysLocation.0 s "HelloWorld"


1 comment:

  1. I would like your help to solve a problem.

    I'm new using snmptt and do not understand how you configure the file snmptt.conf, I could give an example and a way to prove it?

    thanks

    ReplyDelete