Page 1 of 1

snmptt setup for centos 7?

Posted: Thu Mar 10, 2016 3:09 pm
by jriker1
I've found a number of SNMPTT setup docs for receiving remote SNMP traps, all around older versions of CentOS and all having references to modules that can't be installed the way they were documented, and in the end, service fails to start. Is there any current documentation on how to install/setup SNMPTT for Nagios on Centos 7?

Thanks.

JR

Re: snmptt setup for centos 7?

Posted: Thu Mar 10, 2016 5:11 pm
by tgriep
The link below are the instructions for integrating SNMP traps on Nagios XI but the install should work the same on your system. Try it out to see if this works.
https://assets.nagios.com/downloads/nag ... ios_XI.pdf

Re: snmptt setup for centos 7?

Posted: Fri Mar 11, 2016 8:40 am
by jriker1
Thanks. That didn't seem to work. I'm going to read thru the errors and see what can be adjusted if anything but script started, immediately said No packet smnptt available then continued to fail. Below is the complete output.

Code: Select all

[root@nagios tmp]# sh ./NagiosXI-SNMPTrap-setup.sh

========================================
Nagios XI SNMP Trap Support Installation
========================================


Installing Prerequisites

Loaded plugins: fastestmirror
base                                                                                                                                  | 3.6 kB  00:00:00
extras                                                                                                                                | 3.4 kB  00:00:00
updates                                                                                                                               | 3.4 kB  00:00:00
updates/7/x86_64/primary_db                                                                                                           | 3.1 MB  00:00:00
Determining fastest mirrors
 * base: mirror.team-cymru.org
 * extras: lug.mtu.edu
 * updates: mirror.steadfast.net
No package snmptt available.
Resolving Dependencies
--> Running transaction check
---> Package net-snmp-perl.x86_64 1:5.7.2-24.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                                  Arch                              Version                                    Repository                       Size
=============================================================================================================================================================
Installing:
 net-snmp-perl                            x86_64                            1:5.7.2-24.el7                             base                            335 k

Transaction Summary
=============================================================================================================================================================
Install  1 Package

Total download size: 335 k
Installed size: 1.1 M
Downloading packages:
net-snmp-perl-5.7.2-24.el7.x86_64.rpm                                                                                                 | 335 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:net-snmp-perl-5.7.2-24.el7.x86_64                                                                                                       1/1
  Verifying  : 1:net-snmp-perl-5.7.2-24.el7.x86_64                                                                                                       1/1

Installed:
  net-snmp-perl.x86_64 1:5.7.2-24.el7

Complete!
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.team-cymru.org
 * extras: lug.mtu.edu
 * updates: mirror.steadfast.net
Resolving Dependencies
--> Running transaction check
---> Package perl-Sys-Syslog.x86_64 0:0.33-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                                    Arch                              Version                                  Repository                       Size
=============================================================================================================================================================
Installing:
 perl-Sys-Syslog                            x86_64                            0.33-3.el7                               base                             42 k

Transaction Summary
=============================================================================================================================================================
Install  1 Package

Total download size: 42 k
Installed size: 93 k
Downloading packages:
perl-Sys-Syslog-0.33-3.el7.x86_64.rpm                                                                                                 |  42 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : perl-Sys-Syslog-0.33-3.el7.x86_64                                                                                                         1/1
  Verifying  : perl-Sys-Syslog-0.33-3.el7.x86_64                                                                                                         1/1

Installed:
  perl-Sys-Syslog.x86_64 0:0.33-3.el7

Complete!

Download & installing supporting files

--2016-03-11 07:36:35--  http://assets.nagios.com/downloads/support/snmptrap-bins.tar.bz2
Resolving assets.nagios.com (assets.nagios.com)... 72.14.181.71
Connecting to assets.nagios.com (assets.nagios.com)|72.14.181.71|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://assets.nagios.com/downloads/support/snmptrap-bins.tar.bz2 [following]
--2016-03-11 07:36:35--  https://assets.nagios.com/downloads/support/snmptrap-bins.tar.bz2
Connecting to assets.nagios.com (assets.nagios.com)|72.14.181.71|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8720 (8.5K) [application/x-bzip2]
Saving to: ‘snmptrap-bins.tar.bz2’

100%[===================================================================================================================>] 8,720       --.-K/s   in 0s

2016-03-11 07:36:35 (89.5 MB/s) - ‘snmptrap-bins.tar.bz2’ saved [8720/8720]

tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
./NagiosXI-SNMPTrap-setup.sh: line 64: cd: snmptrap-bins/: No such file or directory
cp: omitting directory ‘./nagios-4.1.1’
cp: omitting directory ‘./sendEmail-v1.56’
cp: omitting directory ‘./systemd-private-051cba023f894dbebc001519a6e4259c-httpd.service-G87RqJ’
cp: omitting directory ‘./systemd-private-051cba023f894dbebc001519a6e4259c-vmtoolsd.service-EJMj3V’
cp: omitting directory ‘./systemd-private-0eb0627db69b43019032b8516166c170-httpd.service-UvLeEl’
cp: omitting directory ‘./systemd-private-0eb0627db69b43019032b8516166c170-vmtoolsd.service-3R7Vvk’

Updating snmptt.ini

sed: can't read /etc/snmp/snmptt.ini: No such file or directory
sed: can't read /etc/snmp/snmptt.ini: No such file or directory
sed: can't read /etc/snmp/snmptt.ini: No such file or directory
sed: can't read /etc/snmp/snmptt.ini: No such file or directory
sed: can't read /etc/snmp/snmptt.ini: No such file or directory
sed: can't read /etc/snmp/snmptt.ini: No such file or directory
sed: can't read /etc/snmp/snmptt.ini: No such file or directory
sed: can't read /etc/snmp/snmptt.ini: No such file or directory

Creating snmptrapd.conf


Adding the snmptt user to the nagios and nagcmd groups

usermod: user 'snmptt' does not exist
usermod: user 'snmptt' does not exist

Modifying permissions

chown: cannot access ‘/etc/snmp/snmptt.ini’: No such file or directory
chown: cannot access ‘/etc/snmp/snmptt.conf’: No such file or directory
chown: cannot access ‘/usr/local/bin/addmib’: No such file or directory
chmod: cannot access ‘/usr/local/bin/addmib’: No such file or directory
chown: invalid user: ‘snmptt:snmptt’
chmod: cannot access ‘/var/spool/snmptt’: No such file or directory
chmod: cannot access ‘/var/log/snmptt’: No such file or directory

Adding firewall rules

grep: /etc/sysconfig/iptables: No such file or directory
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

Set up the snmptt daemon to start automatically on boot
as well as starting it now

Failed to execute operation: Access denied
Failed to start snmptt.service: Unit snmptt.service failed to load: No such file or directory.

Set up the snmptrapd daemon to start automatically on boot
as well as starting it now

Created symlink from /etc/systemd/system/multi-user.target.wants/snmptrapd.service to /usr/lib/systemd/system/snmptrapd.service.

========================================
SNMP Trap Support Installation Complete!
========================================

Re: snmptt setup for centos 7?

Posted: Fri Mar 11, 2016 9:42 am
by jriker1
So I think I manually figured it out this time. It's running at least and think it's a nice minimal way to do it. Think the key was the epel support. See what I did below:
  • yum -y install net-snmp net-snmp-perl
  • yum install epel-release
  • yum -y install snmptt
  • vi /etc/sysconfig/snmptrapd and add OPTIONS="-On -Lsd -p /var/run/snmptrapd.pid"
  • vi /etc/snmp/snmptrapd.conf add the next two lines:
  • traphandle default /usr/sbin/snmptthandler
  • disableAuthorization yes
  • service snmptrapd start
  • chkconfig snmptrapd on
  • vi /etc/snmp/snmptt.ini
  • Change #date_time_format = to date_time_format = %H:%M:%S %Y/%m/%d
  • Change syslog_enable = 1 to syslog_enable = 0
  • yum install perl-Sys-Syslog
  • service snmptt start
  • chkconfig snmptt on
At this point snmptrapd and snmptt is running. Now to figure out what to do next.

Re: snmptt setup for centos 7?

Posted: Fri Mar 11, 2016 12:01 pm
by tgriep
The tar file is compressed with bzip2 and it wasn't installed on your system. If it was, it should of worked.
You can run this to install it.

Code: Select all

yum install bzip2