Page 1 of 1

Configure a TRAP SNMP with a specific MIB

Posted: Tue Dec 13, 2016 10:38 am
by Nico31Nagios
Hello,

I have install snmpd on my server Nagios.
I have also install snmpdtrapd but this file doesn't existe /var/run/snmptrapd.pid why?

service snmptrapd status
● snmptrapd.service - LSB: SNMP Trap daemon
Loaded: loaded (/etc/init.d/snmptrapd)
Active: active (exited) since Tue 2016-12-13 15:20:03 UTC; 1min 0s ago
Process: 17660 ExecReload=/etc/init.d/snmptrapd reload (code=exited, status=0/SUCCESS)

Dec 13 15:20:03 SRV-NAGIOS-PROD systemd[1]: Stopping LSB: SNMP Trap daemon...
Dec 13 15:20:03 SRV-NAGIOS-PROD systemd[1]: Starting LSB: SNMP Trap daemon...
Dec 13 15:20:03 SRV-NAGIOS-PROD systemd[1]: Started LSB: SNMP Trap daemon.
Dec 13 15:20:03 SRV-NAGIOS-PROD snmptrapd[17583]: Stopping SNMP trap services:: snmptrapd
Dec 13 15:20:03 SRV-NAGIOS-PROD snmptrapd[17587]: Starting SNMP trap services::
Dec 13 15:20:31 SRV-NAGIOS-PROD systemd[1]: Reloading LSB: SNMP Trap daemon.
Dec 13 15:20:31 SRV-NAGIOS-PROD systemd[1]: Reloaded LSB: SNMP Trap daemon.
Dec 13 15:20:31 SRV-NAGIOS-PROD snmptrapd[17629]: Reloading SNMP trap services::
Dec 13 15:20:46 SRV-NAGIOS-PROD systemd[1]: Reloading LSB: SNMP Trap daemon.
Dec 13 15:20:46 SRV-NAGIOS-PROD snmptrapd[17660]: Reloading SNMP trap services::
Dec 13 15:20:46 SRV-NAGIOS-PROD systemd[1]: Reloaded LSB: SNMP Trap daemon.
Dec 13 15:20:59 SRV-NAGIOS-PROD systemd[1]: Started LSB: SNMP Trap daemon.

but no process found :
ps -ef | grep snmptrap*
root 18219 41325 0 15:27 pts/0 00:00:00 grep snmptrap*

I have convert a MIB with snmpttconvertmib and I have a file:
snmptt.conf like that:

EVENT ErrorInt .1.3.6.1.4.1.39015.13.990.0.1 "Status Events" Normal
FORMAT Trap erreur interface $*
EXEC /usr/local/nagios/libexec/eventhandlers/submit_check_result $r TRAP 1 "Trap erreur interface $*"
SDESC
Trap erreur interface
Variables:
1: Server_Number
2: Criticity
3: Timestamp
4: Code_Process
5: Return_Code
6: Desc
EDESC


but when I tried to test the OID .1.3.6.1.4.1.39015.13.990.0.1
The result is:
./check_snmp -H HOST_IP -P 2c -C 'public' -o ".1.3.6.1.4.1.39015.13.990.0.1"
SNMP OK - No Such Object available on this agent at this OID |

In the file /etc/default/snmpd, I have export all this MIBs:
export MIBS=CLIENTv4-MIB.txt => the Mibs file provided with the CLIENT that I have to supervise.
export MIBS=UCD-SNMP-MIB.txt
export MIBS=UCD-SNMP-MIB-OLD.txt
export MIBS=UCD-IPFWACC-MIB.txt
export MIBS=UCD-IPFILTER-MIB.txt
export MIBS=UCD-DLMOD-MIB.txt
export MIBS=UCD-DISKIO-MIB.txt
export MIBS=UCD-DEMO-MIB.txt
export MIBS=SNMP-TSM-MIB.txt
export MIBS=SNMP-TLS-TM-MIB.txt
export MIBS=NET-SNMP-VACM-MIB.txt
export MIBS=NET-SNMP-TC.txt
export MIBS=NET-SNMP-SYSTEM-MIB.txt
export MIBS=NET-SNMP-PERIODIC-NOTIFY-MIB.txt
export MIBS=NET-SNMP-PASS-MIB.txt
export MIBS=NET-SNMP-MONITOR-MIB.txt
export MIBS=NET-SNMP-MIB.txt
export MIBS=NET-SNMP-EXTEND-MIB.txt
export MIBS=NET-SNMP-EXAMPLES-MIB.txt
export MIBS=NET-SNMP-AGENT-MIB.txt
export MIBS=LM-SENSORS-MIB.txt
export MIBS=GNOME-SMI.txt

The question is why the ./check_snmp commande return this result ?

How can I do to supervise this mibs?

Regards

Re: Configure a TRAP SNMP with a specific MIB

Posted: Tue Dec 13, 2016 5:33 pm
by dwhitfield
What version of Core are you using? Was it compiled from source or installed from distro repos? On what OS/version is nagios running? cat /etc/*-release may be of use.

Re: Configure a TRAP SNMP with a specific MIB

Posted: Wed Dec 14, 2016 3:44 am
by Nico31Nagios
Hello,
The os version is:
cat /etc/*-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

I have install the core Version 4.1.1
with this package: wget https://assets.nagios.com/downloads/nag ... 1.1.tar.gz

Thanks

Re: Configure a TRAP SNMP with a specific MIB

Posted: Wed Dec 14, 2016 2:45 pm
by tgriep
Take a look at the link below for a how to setup a Nagios server to receive traps. It is geared towards Centos but you could look at it for reference.
http://askaralikhan.blogspot.ca/2010/12 ... agios.html

Can you run the following command and post the output so we can see the permissions of the /var/run folder?

Code: Select all

ls -l /var[/code

The check_snmp command output could be either the device is not responding to that OID or that the check command is not searching through all of the MIB files on the Nagios server.

To fix that, follow these instructions.
Create the file /etc/snmp/snmp.conf, and put into it:
[code]mibs +ALL
This tells the snmp commands that they should load ALL of the mibs when they are ran.
Save the file, quit.
Now retest the check_snmp command and see if it works.

Re: Configure a TRAP SNMP with a specific MIB

Posted: Thu Dec 15, 2016 6:34 am
by Nico31Nagios
ls -l /var/run
lrwxrwxrwx 1 root root 4 Nov 2 05:49 /var/run -> /run

I have adding "mibs +ALL" in the file /etc/snmp/snmp.conf

and the result is the same:
./check_snmp -H 10.9.3.69 -P 2c -C 'public' -o ".1.3.6.1.4.1.39015.13.990.0.1"
SNMP OK - No Such Object available on this agent at this OID |

When I have restarted the snmpd service after the file modification, I see this message.

service snmpd status
● snmpd.service - LSB: SNMP agents
Loaded: loaded (/etc/init.d/snmpd)
Active: active (running) since Thu 2016-12-15 11:29:39 UTC; 4s ago
Process: 1033 ExecStop=/etc/init.d/snmpd stop (code=exited, status=0/SUCCESS)
Process: 1038 ExecStart=/etc/init.d/snmpd start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/snmpd.service
└─1045 /usr/sbin/snmpd -Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd...

Dec 15 11:29:38 SRV-NAGIOS-PROD snmpd[1040]: trigger OID: laErrorFlag
Dec 15 11:29:38 SRV-NAGIOS-PROD snmpd[1040]: /etc/snmp/snmpd.conf: line 150: Error: unknown ...OID
Dec 15 11:29:38 SRV-NAGIOS-PROD snmpd[1040]: payload OID: fileName
Dec 15 11:29:38 SRV-NAGIOS-PROD snmpd[1040]: /etc/snmp/snmpd.conf: line 150: Error: unknown ...OID
Dec 15 11:29:38 SRV-NAGIOS-PROD snmpd[1040]: Unknown payload OID: fileName
Dec 15 11:29:38 SRV-NAGIOS-PROD snmpd[1040]: /etc/snmp/snmpd.conf: line 150: Error: Unknown ...OID
Dec 15 11:29:38 SRV-NAGIOS-PROD snmpd[1040]: payload OID: fileErrorMsg
Dec 15 11:29:38 SRV-NAGIOS-PROD snmpd[1040]: /etc/snmp/snmpd.conf: line 150: Error: unknown ...OID
Dec 15 11:29:39 SRV-NAGIOS-PROD snmpd[1038]: Starting SNMP services:: snmpd
Dec 15 11:29:39 SRV-NAGIOS-PROD systemd[1]: Started LSB: SNMP agents.
Dec 15 11:29:39 SRV-NAGIOS-PROD snmpd[1045]: NET-SNMP version 5.7.2.1


Thank for your help.

Re: Configure a TRAP SNMP with a specific MIB

Posted: Thu Dec 15, 2016 8:41 am
by Nico31Nagios
In this topic, it showing how to configure and running the snmptrapd demon

# vi /etc/sysconfig/snmptrapd.options
#OPTIONS="-On -Lsd -c /etc/snmp/snmptrapd.conf -p /var/run/snmptrapd.pid"
OPTIONS="-On -Lsd -p /var/run/snmptrapd.pid"

Which file can I update in debian 8 ? /etc/default/snmpd ?

In /var/run I have a symbolic link from /run
in /run I have not the file snmptrapd.pid

However the snmp packages are install.

dpkg-query -l "*snmp*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-================================-=====================-=====================-======================================================================
ii libnet-snmp-perl 6.0.1-2 all Script SNMP connections
ii libsnmp-base 5.7.2.1+dfsg-1 all SNMP configuration script, MIBs and documentation
un libsnmp-dev <none> <none> (no description available)
ii libsnmp-perl 5.7.2.1+dfsg-1 amd64 SNMP (Simple Network Management Protocol) Perl5 support
un libsnmp15 <none> <none> (no description available)
ii libsnmp30:amd64 5.7.2.1+dfsg-1 amd64 SNMP (Simple Network Management Protocol) library
un libsnmp9-dev <none> <none> (no description available)
ii snmp 5.7.2.1+dfsg-1 amd64 SNMP (Simple Network Management Protocol) applications
ii snmp-mibs-downloader 1.1 all Install and manage Management Information Base (MIB) files
ii snmpd 5.7.2.1+dfsg-1 amd64 SNMP (Simple Network Management Protocol) agents
ii snmptrapd 5.7.2.1+dfsg-1 amd64 Net-SNMP notification receiver

Re: Configure a TRAP SNMP with a specific MIB

Posted: Thu Dec 15, 2016 2:38 pm
by tgriep
My question to you is all you want it to get the Nagios system to receive SNMP Traps, correct?
If this is true, you will have to install the snmptrapd and the snmptt packages and get them to run without any errors.
If you did an apt-get to install the snmptrapd daemon, I would remove it and reinstall it as that daemon is not running and you may have to look in to the log files to get better information on why is it not working.

The snmpd daemon is only needed if you want to poll the nagios server but it is not needed for the server to receive traps so ignore that issue for now.

Re: Configure a TRAP SNMP with a specific MIB

Posted: Fri Dec 16, 2016 2:26 am
by Nico31Nagios
Hello,

My question to you is all you want it to get the Nagios system to receive SNMP Traps, correct?

=> YES I want.

If this is true, you will have to install the snmptrapd and the snmptt packages and get them to run without any errors.

=>

/usr/local/nagios/etc/servers# service snmptrapd status
● snmptrapd.service - LSB: SNMP Trap daemon
Loaded: loaded (/etc/init.d/snmptrapd)
Active: active (exited) since Tue 2016-12-13 15:20:03 UTC; 2 days ago

Dec 13 15:20:03 SRV-NAGIOS-PROD systemd[1]: Stopping LSB: SNMP Trap daemon...
Dec 13 15:20:03 SRV-NAGIOS-PROD systemd[1]: Starting LSB: SNMP Trap daemon...
Dec 13 15:20:03 SRV-NAGIOS-PROD systemd[1]: Started LSB: SNMP Trap daemon.
Dec 13 15:20:03 SRV-NAGIOS-PROD snmptrapd[17583]: Stopping SNMP trap services:: snmptrapd
Dec 13 15:20:03 SRV-NAGIOS-PROD snmptrapd[17587]: Starting SNMP trap services::
Dec 13 15:20:31 SRV-NAGIOS-PROD systemd[1]: Reloading LSB: SNMP Trap daemon.
Dec 13 15:20:31 SRV-NAGIOS-PROD systemd[1]: Reloaded LSB: SNMP Trap daemon.
Dec 13 15:20:31 SRV-NAGIOS-PROD snmptrapd[17629]: Reloading SNMP trap services::
Dec 13 15:20:46 SRV-NAGIOS-PROD systemd[1]: Reloading LSB: SNMP Trap daemon.
Dec 13 15:20:46 SRV-NAGIOS-PROD snmptrapd[17660]: Reloading SNMP trap services::
Dec 13 15:20:46 SRV-NAGIOS-PROD systemd[1]: Reloaded LSB: SNMP Trap daemon.
Dec 13 15:20:59 SRV-NAGIOS-PROD systemd[1]: Started LSB: SNMP Trap daemon.

/usr/local/nagios/etc/servers# service snmptt status
● snmptt.service - LSB: SNMP Trap Translator
Loaded: loaded (/etc/init.d/snmptt)
Active: active (running) since Thu 2016-12-15 15:07:07 UTC; 16h ago
Process: 21277 ExecStop=/etc/init.d/snmptt stop (code=exited, status=0/SUCCESS)
Process: 21284 ExecStart=/etc/init.d/snmptt start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/snmptt.service
├─21292 /usr/bin/perl /usr/sbin/snmptt --daemon
└─21293 /usr/bin/perl /usr/sbin/snmptt --daemon

Dec 15 15:07:06 SRV-NAGIOS-PROD systemd[1]: Starting LSB: SNMP Trap Translator...
Dec 15 15:07:07 SRV-NAGIOS-PROD snmptt-sys[21293]: Changing to UID: snmptt (109)
Dec 15 15:07:07 SRV-NAGIOS-PROD systemd[1]: Started LSB: SNMP Trap Translator.
root@SRV-NAGIOS-PROD:/usr/local/nagios/etc/servers#

I followed the reference : http://askaralikhan.blogspot.ca/2010/12 ... agios.html

But the check_snmp allways return :
/usr/local/nagios/libexec# ./check_snmp -H 10.9.3.69 -P 2c -C 'public' -o ".1.3.6.1.4.1.39015.13.990.0.1"
SNMP OK - No Such Object available on this agent at this OID |


This message let me think that there is nothing at this OID on this server agent. Is it possible?

Re: Configure a TRAP SNMP with a specific MIB

Posted: Fri Dec 16, 2016 10:26 am
by tgriep
When you run the check_snmp plugin, it is trying to poll the device for that OID and that device is not responding to the poll or that the MIB file is not installed on the system the check_snmp is run on.

The snmptrapd and the snmptt daemons are for traps only and are for receiving SNMP traps and cannot be polled by using the check_snmp command.

If you want to poll that device, you will need to enable the device to be polled.
It the device at IP address 10.9.3.69 is a linux system, you will need to install the snmpd daemon and configure it so it will respond the the check_snmp.

Setting up SNMP Traps is a separate process than the snmpd daemon with separate settings.

Can you provide more details about the device at IP address 10.9.3.69?