Monitoring SNMP Traps

Get the trap definition mib

Suppose you get a definition file like:

trap-test-mib
TRAP-TEST-MIB DEFINITIONS ::= BEGIN
	IMPORTS ucdExperimental FROM UCD-SNMP-MIB;

demotraps OBJECT IDENTIFIER ::= { ucdExperimental 990 }

demo-trap1 TRAP-TYPE
	STATUS current
	ENTERPRISE demotraps
	VARIABLES { interfaceName }
	DESCRIPTION "Interface Down."
                        --#TYPE "Interface Status Change"
                        --#SUMMARY "Interface %s is down"
                        --#ARGUMENTS {0}
                        --#SEVERITY CRITICAL
                        --#STATE NONOPERATIONAL	
	::= 17

demo-trap2 TRAP-TYPE
	STATUS current
	ENTERPRISE demotraps
	VARIABLES { interfaceName }
	DESCRIPTION "Interface Up."
                        --#TYPE "Interface Status Change"
                        --#SUMMARY "Interface %s is Up"
                        --#ARGUMENTS {0}
                        --#SEVERITY INFORMATIONAL
                        --#STATE OPERATIONAL
	::= 18

END

Load the trap definitions to Centreon

Go to Configuration→Services→Manufacturer, create a vendor / manufacturer, like Example in this example.

Go to Configuration→Services→MIBs, import these traps from the file:

Edit the trap definition to your needs:

Go to confgiration→Nagios→SNMP traps, check Generate configuration files for SNMP Traps, click Generate.

A file /etc/snmp/centreon_traps/snmptt-Example.conf will be created:

EVENT demo-trap1 .1.3.6.1.4.1.2021.13.990.0.17 "Status Event" 2
FORMAT Interface Status Change: Interface $1 is down
EXEC /usr/local/centreon/bin/centTrapHandler-2.x $aA $A $o "Interface Status Change: Interface $1 is down"
SDESC
Interface Down.
Variables:
  1: interfaceName
EDESC

EVENT demo-trap2 .1.3.6.1.4.1.2021.13.990.0.18 "Status Event" 0
FORMAT Interface Status Change: Interface $1 is Up
EXEC /usr/local/centreon/bin/centTrapHandler-2.x $aA $A $o "Interface Status Change: Interface $1 is Up"
SDESC
Interface Up.
Variables:
  1: interfaceName
EDESC

Advanced matching mode

Use this to match one trap to different status, using the message content.

Define service check for Traps

Define a volatile service check for it:

Remember to link traps to this service:

Test

Test send some traps:

# eth1 Link Down:
snmptrap -v 2c -c public localhost \
 ""  .1.3.6.1.4.1.2021.13.990.0.17 .1.3.6.1.4.1.2021.13.990.0.17 s eth1

# wait a minute

# eth1 Link Up:
snmptrap -v 2c -c public localhost \
 ""  .1.3.6.1.4.1.2021.13.990.0.18 .1.3.6.1.4.1.2021.13.990.0.18 s eth1

Log:

Reference

nagios/centreon/monitoring_snmp_traps.txt · Last modified: 2012-01-04 17:01 by admin
Back to top
GNU Free Documentation License 1.3
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0