Skip to end of banner
Go to start of banner

Configuring opEvents to send SNMP Traps

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This page will describe the steps to configure opEvents to send SNMP traps as a proof of concept, using the SNMPTRAP commandline tool.

Pre-requisites

A copy of the OPMANTEK-MIB.mib has been obtained, this is currently in DRAFT state and is in the NMIS8 GIT source in /usr/local/nmis8/mibs/traps.

opEvents has been installed and licensed.

opEvents is already processing events and "working".

NET-SNMP is installed on the target server and the snmptrap command should be /usr/bin/snmptrap

Configure the Script Action in EventActions.nmis

Where opEvents is installed, edit the file /usr/local/omk/conf/EventActions.nmis, locate the section called scripts.  The default configuration file from /usr/local/omk/install includes this section:

	'script' => {
		'traceroute_node' => {
			arguments => '--max-hops=20 node.host',
			exec => 'traceroute',			# traceroute commonly isn't in /bin
			output => 'save'
		},
		'ping_node' => {
			arguments => '-c 5 node.host',
			exec => '/bin/ping',			# but ping usually is
			output => 'save'
		},
		'ping_neighbor' => {
			arguments => '-c 5 event.element',
			exec => '/bin/ping',
			output => 'save'
		}
	},

 

We are going to be inserting the content below into that section.

In the output below, IP_ADDRESS_OF_TEMIP needs to be replaced with the IP Address of the actual server.

		'send_snmptrap_poc' => {
			arguments => '-v 2c -Ci -c OPMANTEK IP_ADDRESS_OF_TEMIP "" 1.3.6.1.4.1.4818.1.1 1.3.6.1.4.1.4818.2.1.1 s event._id 1.3.6.1.4.1.4818.2.1.2 s event.time 1.3.6.1.4.1.4818.2.1.3 s event.date 1.3.6.1.4.1.4818.2.1.4 s event.node 1.3.6.1.4.1.4818.2.1.5 s event.host 1.3.6.1.4.1.4818.2.1.6 s event.event 1.3.6.1.4.1.4818.2.1.7 s event.element 1.3.6.1.4.1.4818.2.1.8 s event.state 1.3.6.1.4.1.4818.2.1.9 s event.stateful 1.3.6.1.4.1.4818.2.1.10 s event.details 1.3.6.1.4.1.4818.2.1.11 s event.type 1.3.6.1.4.1.4818.2.1.12 s event.priority 1.3.6.1.4.1.4818.2.1.13 s event.level',
			exec => '/usr/bin/snmptrap',
			output => 'save'
		},

Once finished you will have a script section which looks like:

	'script' => {
		'send_snmptrap_poc' => {
			arguments => '-v 2c -Ci -c OPMANTEK IP_ADDRESS_OF_TEMIP "" 1.3.6.1.4.1.4818.1.1 1.3.6.1.4.1.4818.2.1.1 s event._id 1.3.6.1.4.1.4818.2.1.2 s event.time 1.3.6.1.4.1.4818.2.1.3 s event.date 1.3.6.1.4.1.4818.2.1.4 s event.node 1.3.6.1.4.1.4818.2.1.5 s event.host 1.3.6.1.4.1.4818.2.1.6 s event.event 1.3.6.1.4.1.4818.2.1.7 s event.element 1.3.6.1.4.1.4818.2.1.8 s event.state 1.3.6.1.4.1.4818.2.1.9 s event.stateful 1.3.6.1.4.1.4818.2.1.10 s event.details 1.3.6.1.4.1.4818.2.1.11 s event.type 1.3.6.1.4.1.4818.2.1.12 s event.priority 1.3.6.1.4.1.4818.2.1.13 s event.level',
			exec => '/usr/bin/snmptrap',
			output => 'save'
		},
		'traceroute_node' => {
			arguments => '--max-hops=20 node.host',
			exec => 'traceroute',			# traceroute commonly isn't in /bin
			output => 'save'
		},
		'ping_node' => {
			arguments => '-c 5 node.host',
			exec => '/bin/ping',			# but ping usually is
			output => 'save'
		},
		'ping_neighbor' => {
			arguments => '-c 5 event.element',
			exec => '/bin/ping',
			output => 'save'
		}
	},

Configure an Action to Send SNMP Traps

Test the EventActions.nmis file

You can check the file by running the command perl -c EventActions.nmis, the result should be "syntax OK"

[keiths@nmisdev64 conf]$ perl -c EventActions.nmis
EventActions.nmis syntax OK
  • No labels