Welcome to docs.opsview.com

Differences

This shows you the differences between two versions of the page.

opsview4.6:snmptrapsetup [2014/09/09 12:19] (current)
Line 1: Line 1:
 +====== SNMP Trap Processing Setup ======
 +
 +===== Overview =====
 +
 +Opsview supports SNMP Trap Processing using a perl-based rules engine, allowing you to match specific traps from devices on your network and generate appropriate alerts.  In order to do this, SNMP traps must be passed from the operating system to Opsview - this page details how to set this up for Debian and RedHat GNU/Linux distributions.
 +
 +===== Implementation =====
 +
 +==== Debian/Ubuntu ====
 +
 +Firstly, install snmpd and snmptrapd using:
 +
 +  aptitude install snmpd
 +
 +Edit /etc/snmp/snmpd.conf and uncomment "master agentx".
 +
 +Edit /etc/default/snmpd (or /etc/snmp/snmptrapd.conf on some later systems). Set:
 +
 +  TRAPDRUN=yes
 +  TRAPDOPTS='-t -m ALL -Oa -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'
 +
 +
 +Edit /etc/snmp/snmptrapd.conf and ensure it contains only the following line:
 +
 +  traphandle default /usr/local/nagios/bin/snmptrap2nagios
 +  # disableAuthorization yes ##  required for snmp release 5.3 and newer, i.e. on Lenny
 +
 +Edit /etc/default/snmpd and amend as follows:
 +
 +  SNMPDRUN=yes
 +  TRAPDRUN=yes
 +  SNMPDCOMPAT=yes
 +
 +Restart snmpd and snmptrapd:
 +
 +  /etc/init.d/snmpd restart
 +
 +Edit sudoers file to allow Opsview to restart snmpd and snmptrapd:
 +
 +  nagios ALL=NOPASSWD:/usr/local/nagios/bin/snmpd reload
 +
 +Test with:
 +  su - nagios
 +  sudo /usr/local/nagios/bin/snmpd reload
 +
 +If the test is successful, restart opsview as root using
 +  /etc/init.d/opsview-web restart
 +
 +
 +==== Red Hat Enterprise Linux ====
 +
 +Install the following RPMs:
 +
 +  * lm_sensors
 +  * 2:net-snmp-libs
 +  * 3:net-snmp
 +  * 4:net-snmp-devel
 +  * 5:net-snmp-perl
 +
 +Edit /etc/snmp/snmpd.conf and uncomment "master agentx"
 +
 +Edit /etc/sysconfig/snmptrapd:
 +
 +  OPTIONS="-t -m ALL -Oa -M /usr/share/snmp/mibs:/usr/local/nagios/snmp/load -p /var/run/snmptrapd.pid"
 +
 +Edit /etc/sysconfig/snmpd
 +
 +  OPTIONS="-u nagios -Lsd -Lf /dev/null -p /var/run/snmpd.pid"
 +
 +Edit /etc/snmp/snmptrapd.conf:
 +
 +  traphandle default /usr/local/nagios/bin/snmptrap2nagios
 +  # Uncomment the line below on net-snmp 5.3.1 and above,
 +  # e.g. Ubuntu Gutsy (or set up appropriate authorization)
 +  # disableAuthorization yes ## required for snmp release 5.3 and newer
 +
 +Start snmptrapd:
 +
 +  /etc/init.d/snmpd start
 +  /etc/init.d/snmptrapd start
 +
 +
 +Edit sudoers file to allow Opsview to restart snmpd and snmptrapd:
 +
 +  # Required for Opsview
 +  nagios ALL=NOPASSWD:/etc/init.d/snmpd reload
 +  nagios ALL=NOPASSWD:/etc/init.d/snmptrapd reload
 +
 +Test with:
 +  su - nagios
 +  sudo /etc/init.d/snmpd reload
 +  sudo /etc/init.d/snmptrapd reload
 +
 +If the test is successful, restart opsview as root using
 +  /etc/init.d/opsview-web restart
 +
 +==== Testing ====
 +
 +To prove traps can now be received, the following command will generate a dummy trap:
 +
 +  snmptrap -v 2c -c mycommunity localhost "" ucdStart sysContact.0 s "Hello World"
 +
 +This should also be logged within /var/log/daemon.log (or similar) log file.
Navigation
Print/export
Toolbox