Opsview SNMP Trap Processing Setup

So.. you followed the steps in the previous post about enabling SNMP traps on ESX4. Now you probably want to pick those up by something useful.. like a monitoring software. We use Opsview Community Edition, which can be configured to handle the traps quite easily. Just follow the steps below and your server will be listening to those pesky traps. After that, you’ll need to write a couple of service check handlers in Opsview to make sense of the traps.. More on that later. This post is just about picking them up.

This was done on an Ubuntu 10.04 LTS server. The steps are probably the same on Debian systems.

1. Make sure you have snmpd installed. If you don’t, install it! Easy as pie

aptitude install snmpd

2. Edit /etc/snmp/snmpd.conf and uncomment “master agentx”.

3. Edit /etc/default/snmpd (or /etc/snmp/snmptrapd.conf on newer systems):

TRAPDOPTS='-t -m ALL -M /usr/share/snmp/mibs:/usr/local/nagios/snmp/load -p /var/run/snmptrapd.pid'
SNMPDOPTS='-u nagios -Lsd -Lf /dev/null -p/var/run/snmpd.pid'

4. Edit /etc/snmp/snmptrapd.conf and add the following lines:

traphandle default /usr/local/nagios/bin/snmptrap2nagios
disableAuthorization yes

Please note that this will make the server listen to and handle any SNMP traps it receives, regardless of source.

5. Restart snmpd and snmptrapd:

/etc/init.d/snmpd restart

6. Edit the /etc/sudoers file to allow Opsview to restart snmpd and snmptrapd:

nagios ALL=NOPASSWD:/usr/local/nagios/bin/snmpd reload

7. Test the permissions:

su - nagios
sudo /usr/local/nagios/bin/snmpd reload

8. Exit back to the root user and restart opsview-web:

/etc/init.d/opsview-web restart

That’s all. Your Opsview should now be able to handle traps sent to it. Next post: Adding SNMP watching to specific hosts in OpsView, and creating custom handlers.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s