SNMP

From WIdocsKI
Share/Save/Bookmark
Jump to: navigation, search

Configuring SNMP Traps for Lotus Domino and Opsview 3.13.x

Configure Lotus Domino for sending SNMP traps

Installing NET-SNMPD on Linux

Log on as the root user and then install NET-SNMPD on Linux as follows:

Install the NET-SNMPD files. Enter this command, changing the Domino executable path if necessary:

cp /data/ibm/lotus/notes/latest/Linux/net-snmpd* /etc

Arrange for NET-SNMPD to be restarted after a reboot. Do one of these:

For UnitedLinux based releases, such as SLES, enter these commands:

ln –f –s /etc/net-snmpd.sh /etc/init.d/net-snmpd
insserv /etc/init.d/net-snmpd

Configuring the Domino SNMP Agent for Linux

Follow the steps below, once per platform, to configure the IBM® Lotus® Domino® SNMP Agent for Linux®.

Note The following commands should be executed as the root user.

Do one of these:

For UnitedLinux-based releases, such as SLES, enter these commands, changing the Domino executable path if necessary:

ln –f –s /data/ibm/lotus/notes/latest/linux/lnsnmp.sh /etc/init.d/lnsnmp 
insserv /etc/init.d/lnsnmp

Start the Master SNMP Agent. If you're using the NET-SNMP Master Agent provided, enter this command:

/etc/init.d/net-snmpd start

Start the LNSNMP process. Enter this command:

/etc/init.d/lnsnmp start

Enable SMTP Trap Sending – Linux

Edit file /etc/net-snmpd.conf

vi /etc/net-snmpd.conf

Pic1.png

Add following line by section "SECTION: Trap Destinations".

trapsink monitoring.alderlieste.nl

Pic2.png

Restart snmp task

/etc/init.d/net-snmpd restart

Pic3.png

Test SNMP trap sending from Lotus Domino to Monitoring server

Start a Listening command on your Lotus Domino Server and Monitoring server

tcpdump –s 0 -X udp port 162

Pic4.png

For example shutdown a Lotus Domino task and you will something like this.

Pic5.png

SNMP trap sending is working now.

Configure Opsview 3.13.x on Ubuntu 10.4

SNMP Trap Processing Setup - Linux

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.

Firstly, install snmpd and snmptrapd using:

aptitude install snmpd

Edit /etc/snmp/snmpd.conf and

uncomment "master agentx"

On Debian/Ubuntu also add in the following line:

mibdirs +/usr/local/nagios/snmp/load (\*)

(\*) For Ubuntu 10.4 Remove setting "mibdirs +/usr/local/nagios/snmp/load" from /etc/snmp/snmpd.conf to /etc/snmp/snmp.conf otherwise you will receive this error "unknown token: mibdirs"

On CentOS/RHEL the mibdirs change should be made in file /etc/snmp/snmp.conf instead.

Edit /etc/default/snmpd. Set:

TRAPDRUN=yes
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'

Note: If you want to restrict the interface that the snmpd daemon binds to, add it to the end of the SNMPDOPTS line, eg to only listen on the loopback interface:

SNMPDOPTS='-u nagios -Lsd -Lf /dev/null -p/var/run/snmpd.pid 127.0.0.1'

Edit /etc/snmp/snmptrapd.conf and ensure it contains only the following line:

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

Uncomment - "disableAuthorization yes" in /etc/snmp/snmptrapd.conf because you will receive this error "this receiver will not accept any incoming notifications"

Restart snmpd and snmptrapd:

/etc/init.d/snmpd restart

Add an entry into sudo 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

You may get errors such as:

NET-SNMP version 5.2.3 AgentX subagent connected registering pdu failed: 263! registering pdu failed: 263! registering pdu failed: 263!

These can be ignored (?).

If the test is successful, restart opsview as root using

/etc/init.d/opsview-web restart


Testing if Opsview is receiving traps

No traps Received?

If you are not seeing any traps being collected, there maybe an error with the interaction between snmptrapd and the Opsview script /usr/local/nagios/bin/snmptrap2nagios.

You can enable a log of all traps in snmptrapd. Add the option: -Lf /tmp/snmptrapd.log to snmptrapd to log all traps to the file.

vi /etc/default/snmpd

Change "TRAPDOPTS to"

TRAPDOPTS='-t -m ALL -M /usr/share/snmp/mibs:/usr/local/nagios/snmp/load -Lf /tmp/snmptrapd.log -p /var/run/snmptrapd.pid'

Pic6.png

Restart snmpd to take effect.

/etc/init.d/snmp restart

When traps arrive, you should see something like this in /tmp/snmptrapd.log:

2008-10-23 18:17:09 192.168.10.20(via UDP:
[192.168.10.20\]:3606) TRAP, SNMP v1, community public
SNMPv2-SMI::enterprises.7367 Link Up Trap (0) Uptime:
0:21:54.14 RFC1213-MIB::ifIndex.4 = INTEGER: 4
RFC1213-MIB::ifDescr.4 = STRING: "eth0"

If the traps are being received in the file, check that snmptrap2nagios has been invoked:

ls –lu /usr/local/nagios/bin/snmptrap2nagios

The update time should be at the time of the trap reception in the log file.

Send a test trap to snmptrap2nagios. Put the following into a temporary file, say /tmp/testtrap:

192.168.10.20 192.168.10.20 SNMPv2-MIB::sysUpTime.0
4:20:49:47.73 SNMPv2-MIB::snmpTrapOID.0 SNMPv2-SMI::enterprises.9.9.43.2.0.1 SNMPv2-
SMI::enterprises.9.9.43.1.1.6.1.3.45 1 SNMPv2-
SMI::enterprises.9.9.43.1.1.6.1.4.45 2 SNMPv2-
SMI::enterprises.9.9.43.1.1.6.1.5.45 3 SNMP-COMMUNITY-
MIB::snmpTrapAddress.0 192.168.10.20 SNMP-COMMUNITY-
MIB::snmpTrapCommunity.0 "public"

Then send this to snmptrap2nagios:

cat /tmp/testtrap \| /usr/local/nagios/bin/snmptrap2nagios -d -e /tmp/snmptrap.exception

Unless you happen to have a configuration with this IP address, you should get an exception file in /tmp/snmptrap.exception. This will have the contents of:

1224785290 5 192.168.10.20 192.168.10.20 SNMPv2-
MIB::sysUpTime.0 4:20:49:47.73 SNMPv2-MIB::snmpTrapOID.0
SNMPv2-SMI::enterprises.9.9.43.2.0.1 SNMPv2-
SMI::enterprises.9.9.43.1.1.6.1.3.45 1 SNMPv2-
SMI::enterprises.9.9.43.1.1.6.1.4.45 2 SNMPv2-
SMI::enterprises.9.9.43.1.1.6.1.5.45 3 SNMP-COMMUNITY-
MIB::snmpTrapAddress.0 192.168.10.20 SNMP-COMMUNITY-
MIB::snmpTrapCommunity.0 "public"\#---next trap---\#

The first line is a timestamp, so could be different. The 2nd line is an error code - 5 means not defined. If all these pass, then snmptrap2nagios is saving its information correctly.


Create Service Check in Opsview

Log on to the Opsview webpage.


10.png

Create a new Service Check.

Click "Configuration" -> "Service Checks".
Click "Action" -> "Create new Service Check".

11.png

Fill the Fields
Click "Submit Changes"

12.png

Now we need to create SNMP Trap Rules.

Click "Actions" -> "Create new rule for Lotus Domino Agent Manager"

13.png

Please understand this is an example.


First we make a OK trap.

Fill in all Fields, see example and click "Submit Changes"

14.png


Click "Actions" -> "Create new rule for Lotus Domino Agent Manager"

15.png

Second we make a Critical trap.

Fill in all Fields, see example and click "Submit Changes"

Add your new Service Check to a Host of Host Template and reload Opsview.