Docsity

articulos sobre nagios, Apuntes de Informática

Toggle sidebar
bg1
Na gios C or e - In s t a llin g Na g i os C o r e From S o u rceNa gios C or e - In s t a llin g Na g i os C o r e From S o u rce
Article Number: 9 6 | Rating: 4.4/5 from 38 votes | La st Upda ted: Thu, Jun 11, 2 020 a t 11:28 AM
I n s t al li n g Na g i o s C or e F r o m S ou r ceI n s t al li n g Na g i o s C or e F r o m S ou r ce
This d ocument de scrib es how to install Na gios C ore fro m sourc e.
This g uide is b roken up into s evera l sectio ns and c overs d ifferent op erating s ystem (OS ) distributio ns. If your OS Dis tribution is not inc luded in this g uide then ple ase contac t us to s ee if we can ge t it adde d. Some d istributions may be mis sing as we do n't have ac cess to a tes t
environme nt that allows us to de velop the d ocume ntation.
Nag ios Co re 4.4.5 and Nag ios Plug ins 2.2.1 are the versio ns used in this guide , however future versions should a lso wo rk fine with these steps .
This d ocumenta tion is bro ken up into two d istinct sec tions:
Insta ll Nagios Core
Insta ll Nagios Plugins
This s epar ation is to m ake a c lear di stinction as to what pre requis ite pac kages are re quired by the OS it is b eing insta lled on. For example the SNMP p ackag es are installe d as p art of the Na gios Plugins se ction, a s SNMP is not require d by Nag ios C ore.
Ple ase s elec t your OS :
Red H at Enterpris e Linux (RHEL)
Ce ntOS
Ora cle Linux
Ubuntu
SUS E SLES | op enSUSE Le ap
Deb ian
Ras pb ian
Fed ora
Arch Linux
Gento o
Free BS D
Sola ris
Apple OS X
RH E L | C e nt OS | O ra c le L inuxRH E L | C e nt OS | O ra c le L inux
Se cur it y-Enh anc ed Linu xSe cur it y-Enh anc ed Linu x
This g uide is b ase d on SELinux being d isab led or in p ermiss ive mode . Step s to do this are a s follow s.
sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
Pr e r e q uis i t e sPr e r e q uis i t e s
Pe rform these steps to install the pre- requisite packa ges.
===== RHEL 5/6/7 | C entOS 5/6 /7 | Orac le Linux 5/6/7 =====
yum install -y gcc glibc glibc-common wget unzip httpd php gd gd-devel perl postfix
===== RHEL 8 | Ce ntOS 8 =====
dnf install -y gcc glibc glibc-common perl httpd php wget gd gd-devel
dnf update -y
Do wnlo ad ing the S our c eD o wnl o ad ing the S o ur ce
cd /tmp
wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.5.tar.gz
tar xzf nagioscore.tar.gz
Co m p i leCo m p i le
cd /tmp/nagioscore-nagios-4.4.5/
./configure
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e

Vista previa parcial del texto

¡Descarga articulos sobre nagios y más Apuntes en PDF de Informática solo en Docsity!

Nagios Core - In s t allin g Nagios Core From Sou rceNagios Core - In s t allin g Nagios Core From Sou rce

Article Number: 96 | Rating: 4.4/5 from 38 votes | Last Updated: Thu, Jun 11, 2020 at 11:28 AM

I ns t a lling Na gio s C o r e Fr o m S o ur c eI ns t a lling Na g io s C o r e Fr o m S o ur c e

This document describes how to install Nagios Core from source. This guide is broken up into several sections and covers different operating system (OS) distributions. If your OS Distribution is not included in this guide then please contact us to see if we can environment that allows us to develop the documentation. Nagios Core 4.4.5 and Nagios Plugins 2.2.1 are the versions used in this guide, however future versions should also work fine with these steps. This documentation is broken up into two distinct sections: Install Nagios Core Install Nagios Plugins This separation is to make a clear distinction as to what prerequisite packages are required by the OS it is being installed on. For example the SNMP packages are installed as part of the Nagi Please select your OS: Red Hat Enterprise Linux (RHEL) CentOS Oracle Linux Ubuntu SUSE SLES | openSUSE Leap Debian Raspbian Fedora Arch Linux Gentoo FreeBSD Solaris Apple OS X

RHEL | C e nt O S | O r a c le L inuxRHEL | C e nt O S | O r a c le L inux

S e c ur it y- Enhanc e d LinuxS e c ur it y- Enhanc e d Linux

This guide is based on SELinux being disabled or in permissive mode. Steps to do this are as follows. sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config setenforce 0

P r e r e q uis it e sP r e r e q uis it e s

Perform these steps to install the pre-requisite packages. ===== RHEL 5/6/7 | CentOS 5/6/7 | Oracle Linux 5/6/7 ===== yum install -y gcc glibc glibc-common wget unzip httpd php gd gd-devel perl postfix ===== RHEL 8 | CentOS 8 ===== dnf install -y gcc glibc glibc-common perl httpd php wget gd gd-devel dnf update -y

Do wnlo ad ing t he S o ur c eDo wnlo ad ing t he S o ur c e

cd /tmp wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.5.tar.gz tar xzf nagioscore.tar.gz

C o mp ileC o mp ile

cd /tmp/nagioscore-nagios-4.4.5/ ./configure

./configure make all

C r e at e Us e r And G r o upC r e at e Us e r And G r o up

This creates the nagios user and group. The apache user is also added to the nagios group. make install-groups-users usermod -a -G nagios apache

Ins t all Binar ie sIns t all Binar ie s

This step installs the binary files, CGIs, and HTML files. make install

Ins t all S e r vic e / Dae mo nIns t all S e r vic e / Dae mo n

This installs the service or daemon files and also configures them to start on boot. The Apache httpd service is also configured at this point. ===== RHEL 5/6 | CentOS 5/6 | Oracle Linux 5/6 ===== make install-daemoninit chkconfig --level 2345 httpd on ===== RHEL 7/8 | CentOS 7/8 | Oracle Linux 7/8 ===== make install-daemoninit systemctl enable httpd.service Information on starting and stopping services will be explained further on.

Ins t all C o mmand Mo d eIns t all C o mmand Mo d e

This installs and configures the external command file. make install-commandmode

Ins t all C o nf ig ur at io n File sIns t all C o nf ig ur at io n File s

This installs the SAMPLE configuration files. These are required as Nagios needs some configuration files to allow it to start. make install-config

Ins t all Ap ac he C o nf ig File sIns t all Ap ac he C o nf ig File s

This installs the Apache web server configuration files. Also configure Apache settings if required. make install-webconf

C o nf ig ur e Fir e wallC o nf ig ur e Fir e wall

You need to allow port 80 inbound traffic on the local firewall so you can reach the Nagios Core web interface. ===== RHEL 5/6 | CentOS 5/6 | Oracle Linux 5/6 ===== iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT service iptables save ip6tables -I INPUT -p tcp --destination-port 80 -j ACCEPT service ip6tables save ===== RHEL 7/8 | CentOS 7/8 | Oracle Linux 7/8 ===== firewall-cmd --zone=public --add-port=80/tcp firewall-cmd --zone=public --add-port=80/tcp --permanent

C r e at e nag io s ad min Us e r Ac c o untC r e at e nag io s ad min Us e r Ac c o unt

You'll need to create an Apache user account to be able to log into Nagios. The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account. htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have a

===== RHEL 5 | Oracle Linux 5 ===== cd /tmp wget http://archives.fedoraproject.org/pub/archive/epel/epel-release-latest-5.noarch.rpm rpm -ihv epel-release-latest-5.noarch.rpm yum install -y gcc glibc glibc-common make gettext automake wget openssl-devel net-snmp net-snmp-utils yum install -y perl-Net-SNMP wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz tar xzf autoconf-2.60.tar.gz cd /tmp/autoconf-2. ./configure make make install ===== RHEL 6 | Oracle Linux 6 ===== cd /tmp wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm rpm -ihv epel-release-latest-6.noarch.rpm yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils yum install -y perl-Net-SNMP ===== RHEL 7 ===== cd /tmp wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -ihv epel-release-latest-7.noarch.rpm subscription-manager repos --enable=rhel-7-server-optional-rpms yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils yum install -y perl-Net-SNMP ===== RHEL 8 ===== At the time of writing this EPEL for RHEL 8 was not released, affected commands are struck out but should work if EPEL 8 was available. cd /tmp wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm rpm -ihv epel-release-latest-8.noarch.rpm subscription-manager repos --enable=rhel-8-server-optional-rpms yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils yum install -y perl-Net-SNMP ===== Oracle Linux 7 ===== yum install -y yum-utils yum-config-manager --enable ol7_optional_latest cd /tmp wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -ihv epel-release-latest-7.noarch.rpm yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils yum install -y perl-Net-SNMP ===== Oracle Linux 8 ===== yum install -y yum-utils yum-config-manager --enable ol8_optional_latest cd /tmp wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm rpm -ihv epel-release-latest-8.noarch.rpm yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils yum install -y perl-Net-SNMP

Do wnlo ad ing The S o ur c eDo wnlo ad ing The S o ur c e

cd /tmp wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz tar zxf nagios-plugins.tar.gz

C o mp ile + Ins t allC o mp ile + Ins t all

cd /tmp/nagios-plugins-release-2.2.1/ ./tools/setup ./configure make make install

Te s tTe s t P lug insP lug ins

Point your web browser to the ip address or FQDN of your Nagios Core server, for example: http://10.25.5.143/nagios

http://10.25.5.143/nagios http://core-013.domain.local/nagios Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the sc

S e r vic e / Dae mo n C o mmand sS e r vic e / Dae mo n C o mmand s

Different Linux distributions have different methods of starting / stopping / restarting / status Nagios. ===== RHEL 5/6 | CentOS 5/6 | Oracle Linux 5/6 ===== service nagios start service nagios stop service nagios restart service nagios status ===== RHEL 7/8 | CentOS 7/8 | Oracle Linux 7/8 ===== systemctl start nagios.service systemctl stop nagios.service systemctl restart nagios.service systemctl status nagios.service Ubunt uUb unt u

S e c ur it y- Enhanc e d LinuxS e c ur it y- Enhanc e d Linux

This guide is based on SELinux being disabled or in permissive mode. SELinux is not enabled by default on Ubuntu. If you would like to see if it is installed run the following command: sudo dpkg -l selinux*

P r e r e q uis it e sP r e r e q uis it e s

Perform these steps to install the pre-requisite packages. ===== Ubuntu 14.x / 15.x ===== sudo apt-get update sudo apt-get install -y autoconf gcc libc6 make wget unzip apache2 apache2-utils php5 libgd2-xpm-dev ===== Ubuntu 16.x / 17.x ===== sudo apt-get update sudo apt-get install -y autoconf gcc libc6 make wget unzip apache2 php libapache2-mod-php7.0 libgd2-xpm-dev ===== Ubuntu 18.x ===== sudo apt-get update sudo apt-get install -y autoconf gcc libc6 make wget unzip apache2 php libapache2-mod-php7.2 libgd-dev ===== Ubuntu 20.x ===== sudo apt-get update sudo apt-get install -y autoconf gcc libc6 make wget unzip apache2 php libapache2-mod-php7.4 libgd-dev

Do wnlo ad ing t he S o ur c eDo wnlo ad ing t he S o ur c e

cd /tmp wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.5.tar.gz tar xzf nagioscore.tar.gz

C o mp ileC o mp ile

cd /tmp/nagioscore-nagios-4.4.5/ sudo ./configure --with-httpd-conf=/etc/apache2/sites-enabled sudo make all

C r e at e Us e r And G r o upC r e at e Us e r And G r o up

This creates the nagios user and group. The www-data user is also added to the nagios group. sudo make install-groups-users sudo usermod -a -G nagios www-data

Ins t all Binar ie sIns t all Binar ie s

Te s tTe s t Nag io sNag io s

Nagios is now running, to confirm this you need to log into the Nagios Web Interface. Point your web browser to the ip address or FQDN of your Nagios Core server, for example: http://10.25.5.143/nagios http://core-013.domain.local/nagios You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier. Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.

BUT W AIT ...BUT W AIT ...

Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of: (No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.

Ins t alling The Nag io s P lug insIns t alling The Nag io s P lug ins

Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins. These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on Git Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in th instructions: Documentation - Installing Nagios Plugins From Source

P r e r e q uis it e sP r e r e q uis it e s

Make sure that you have the following packages installed. sudo apt-get install -y autoconf gcc libc6 libmcrypt-dev make libssl-dev wget bc gawk dc build-essential snmp libnet-snmp-perl gettext

Do wnlo ad ing The S o ur c eDo wnlo ad ing The S o ur c e

cd /tmp wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz tar zxf nagios-plugins.tar.gz

C o mp ile + Ins t allC o mp ile + Ins t all

cd /tmp/nagios-plugins-release-2.2.1/ sudo ./tools/setup sudo ./configure sudo make sudo make install

Te s tTe s t P lug insP lug ins

Point your web browser to the ip address or FQDN of your Nagios Core server, for example: http://10.25.5.143/nagios http://core-013.domain.local/nagios Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the sc

S e r vic e / Dae mo n C o mmand sS e r vic e / Dae mo n C o mmand s

Different Linux distributions have different methods of starting / stopping / restarting / status Nagios. ===== Ubuntu 14.x ===== sudo start nagios sudo stop nagios sudo restart nagios sudo status nagios ===== Ubuntu 15.x / 16.x / 17.x / 18.x / 20.x ===== sudo systemctl start nagios.service sudo systemctl stop nagios.service sudo systemctl restart nagios.service sudo systemctl status nagios.service

S US E S L ES | o pe nS US E L e a pS US E S L ES | o pe nS US E L e a p

S e c ur it y- Enhanc e d LinuxS e c ur it y- Enhanc e d Linux

This guide is based on SELinux being disabled or in permissive mode. SELinux is not enabled by default on SUSE. If you would like to see if it is enabled run the following command: ls -la /etc/selinux/config If the file does not exist, SELinux is not enabled.

P r e r e q uis it e sP r e r e q uis it e s

Perform these steps to install the pre-requisite packages. ===== SUSE SLES 11.3 ===== cd /tmp wget 'https://nu.novell.com/repo/$RCE/SLE11-SDK-SP3-Pool/sle-11-x86_64/rpm/x86_64/sle-sdk-release-11.3-1.69.x86_64.rpm' wget 'https://nu.novell.com/repo/$RCE/SLE11-SDK-SP3-Pool/sle-11-x86_64/rpm/x86_64/sle-sdk-release-SDK-11.3-1.69.x86_64.rpm' sudo rpm -ivh sle-sdk-release-* sudo suse_register sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php53 apache2-mod_php53 gd gd-devel ===== SUSE SLES 11.4 ===== cd /tmp wget 'https://nu.novell.com/repo/$RCE/SLE11-SDK-SP4-Pool/sle-11-x86_64/rpm/x86_64/sle-sdk-release-11.4-1.55.x86_64.rpm' wget 'https://nu.novell.com/repo/$RCE/SLE11-SDK-SP4-Pool/sle-11-x86_64/rpm/x86_64/sle-sdk-release-SDK-11.4-1.55.x86_64.rpm' sudo rpm -ivh sle-sdk-release-* sudo suse_register sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php53 apache2-mod_php53 gd gd-devel ===== SUSE SLES 12 ===== sudo SUSEConnect -p sle-sdk/12/x86_ sudo SUSEConnect -p sle-module-web-scripting/12/x86_ sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel ===== SUSE SLES 12.1 ===== sudo SUSEConnect -p sle-sdk/12.1/x86_ sudo SUSEConnect -p sle-module-web-scripting/12/x86_ sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel ===== SUSE SLES 12.2 ===== sudo SUSEConnect -p sle-sdk/12.2/x86_ sudo SUSEConnect -p sle-module-web-scripting/12/x86_ sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel ===== SUSE SLES 12.3 ===== sudo SUSEConnect -p sle-sdk/12.3/x86_ sudo SUSEConnect -p sle-module-web-scripting/12/x86_ sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel ===== openSUSE Leap 42.x ===== sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel ===== openSUSE Leap 15.x ===== sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php7 apache2-mod_php7 gd gd-devel

Do wnlo ad ing t he S o ur c eDo wnlo ad ing t he S o ur c e

cd /tmp wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.5.tar.gz tar xzf nagioscore.tar.gz

C o mp ileC o mp ile

cd /tmp/nagioscore-nagios-4.4.5/ sudo ./configure --with-httpd-conf=/etc/apache2/vhosts.d

===== SUSE SLES 11.x ===== sudo sed -i '/FW_SERVICES_EXT_TCP=/s/"$/\ 80"/' /etc/sysconfig/SuSEfirewall sudo /sbin/service SuSEfirewall2_init restart sudo /sbin/service SuSEfirewall2_setup restart ===== SUSE SLES 12.x ===== sudo /usr/sbin/SuSEfirewall2 open EXT TCP 80 sudo systemctl restart SuSEfirewall ===== openSUSE Leap 42.x ===== Port 80 is enabled when Apache is installed, nothing needs to be done. ===== openSUSE Leap 15.x ===== sudo firewall-cmd --zone=public --add-port=80/tcp sudo firewall-cmd --zone=public --add-port=80/tcp --permanent

C r e at e nag io s ad min Us e r Ac c o untC r e at e nag io s ad min Us e r Ac c o unt

You'll need to create an Apache user account to be able to log into Nagios. The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account. sudo htpasswd2 -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have a

S t ar tS t ar t Ap ac he W e b S e r ve rAp ac he W e b S e r ve r

===== SUSE SLES 11.x ===== sudo /sbin/service apache2 start ===== SUSE SLES 12.x | openSUSE Leap 42.x / 15.x ===== sudo systemctl start apache2.service

S t ar tS t ar t S e r vic e / Dae mo nS e r vic e / Dae mo n

This command starts Nagios Core. ===== SUSE SLES 11.x ===== sudo /sbin/service nagios start ===== SUSE SLES 12.x | openSUSE Leap 42.x / 15.x ===== sudo systemctl start nagios.service

Te s tTe s t Nag io sNag io s

Nagios is now running, to confirm this you need to log into the Nagios Web Interface. Point your web browser to the ip address or FQDN of your Nagios Core server, for example: http://10.25.5.143/nagios http://core-013.domain.local/nagios You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier. Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.

BUT W AIT ...BUT W AIT ...

Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of: (No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.

Ins t alling The Nag io s P lug insIns t alling The Nag io s P lug ins

Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins. These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on Git

These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on Git Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in th instructions: Documentation - Installing Nagios Plugins From Source

P r e r e q uis it e sP r e r e q uis it e s

Make sure that you have the following packages installed. ===== SUSE SLES 11.x / 12.x | openSUSE Leap 42.x ===== sudo zypper --non-interactive install autoconf gcc glibc libmcrypt-devel make libopenssl-devel wget gettext gettext-runtime automake net-snmp p ===== openSUSE Leap 15.x ===== sudo zypper --non-interactive install autoconf gcc glibc libgcrypt-devel make libopenssl-devel wget gettext gettext-runtime automake net-snmp p

Do wnlo ad ing The S o ur c eDo wnlo ad ing The S o ur c e

cd /tmp wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz tar zxf nagios-plugins.tar.gz

C o mp ile + Ins t allC o mp ile + Ins t all

cd /tmp/nagios-plugins-release-2.2.1/ sudo ./tools/setup sudo ./configure sudo make sudo make install

Te s tTe s t P lug insP lug ins

Point your web browser to the ip address or FQDN of your Nagios Core server, for example: http://10.25.5.143/nagios http://core-013.domain.local/nagios Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the sc

S e r vic e / Dae mo n C o mmand sS e r vic e / Dae mo n C o mmand s

Different Linux distributions have different methods of starting / stopping / restarting / status Nagios. ===== SUSE SLES 11.x ===== sudo /sbin/service nagios start sudo /sbin/service nagios stop sudo /sbin/service nagios restart sudo /sbin/service nagios status ===== SUSE SLES 12.x | openSUSE Leap 42.x / 15.x ===== sudo systemctl start nagios.service sudo systemctl stop nagios.service sudo systemctl restart nagios.service sudo systemctl status nagios.service De bia n | Ra s pbia nDe b ia n | Ra s pbia n All steps on Debian require to run as root. To become root simply run: Debian: su Raspbian: sudo -i All commands from this point onwards will be as root.

iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT apt-get install -y iptables-persistent Answer yes to saving existing rules

C r e at e nag io s ad min Us e r Ac c o untC r e at e nag io s ad min Us e r Ac c o unt

You'll need to create an Apache user account to be able to log into Nagios. The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account. htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have a

S t ar tS t ar t Ap ac he W e b S e r ve rAp ac he W e b S e r ve r

===== 7.x ===== Need to restart it because it is already running. service apache2 restart ===== 8.x / 9.x ===== Need to restart it because it is already running. systemctl restart apache2.service

S t ar tS t ar t S e r vic e / Dae mo nS e r vic e / Dae mo n

This command starts Nagios Core. ===== 7.x ===== service nagios start ===== 8.x / 9.x ===== systemctl start nagios.service

Te s tTe s t Nag io sNag io s

Nagios is now running, to confirm this you need to log into the Nagios Web Interface. Point your web browser to the ip address or FQDN of your Nagios Core server, for example: http://10.25.5.143/nagios http://core-013.domain.local/nagios You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier. Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.

BUT W AIT ...BUT W AIT ...

Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of: (No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.

Ins t alling The Nag io s P lug insIns t alling The Nag io s P lug ins

Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins. These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on Git Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in th instructions: Documentation - Installing Nagios Plugins From Source

P r e r e q uis it e sP r e r e q uis it e s

Make sure that you have the following packages installed. apt-get install -y autoconf gcc libc6 libmcrypt-dev make libssl-dev wget bc gawk dc build-essential snmp libnet-snmp-perl gettext

Do wnlo ad ing The S o ur c eDo wnlo ad ing The S o ur c e

cd /tmp wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz tar zxf nagios-plugins.tar.gz

C o mp ile + Ins t allC o mp ile + Ins t all

cd /tmp/nagios-plugins-release-2.2.1/ ./tools/setup ./configure make make install

Te s tTe s t P lug insP lug ins

Point your web browser to the ip address or FQDN of your Nagios Core server, for example: http://10.25.5.143/nagios http://core-013.domain.local/nagios Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the sc

S e r vic e / Dae mo n C o mmand sS e r vic e / Dae mo n C o mmand s

Different Linux distributions have different methods of starting / stopping / restarting / status Nagios. ===== 7.x ===== service nagios start service nagios stop service nagios restart service nagios status ===== 8.x / 9.x ===== systemctl start nagios.service systemctl stop nagios.service systemctl restart nagios.service systemctl status nagios.service Fe d o r aFe do r a

S e c ur it y- Enhanc e d LinuxS e c ur it y- Enhanc e d Linux

This guide is based on SELinux being disabled or in permissive mode. Steps to do this are as follows. sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config setenforce 0

P r e r e q uis it e sP r e r e q uis it e s

Perform these steps to install the pre-requisite packages. dnf install -y gcc glibc glibc-common perl httpd php wget gd gd-devel dnf update -y

Do wnlo ad ing t he S o ur c eDo wnlo ad ing t he S o ur c e

cd /tmp wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.5.tar.gz tar xzf nagioscore.tar.gz

C o mp ileC o mp ile

cd /tmp/nagioscore-nagios-4.4.5/ ./configure make all

C r e at e Us e r And G r o upC r e at e Us e r And G r o up

This creates the nagios user and group. The apache user is also added to the nagios group. make install-groups-users usermod -a -G nagios apache

BUT W AIT ...BUT W AIT ...

Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of: (No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.

Ins t alling The Nag io s P lug insIns t alling The Nag io s P lug ins

Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins. These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on Git Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in th instructions: Documentation - Installing Nagios Plugins From Source

P r e r e q uis it e sP r e r e q uis it e s

Make sure that you have the following packages installed. dnf install -y gcc glibc glibc-common openssl-devel perl wget gettext make net-snmp net-snmp-utils perl-Net-SNMP automake autoconf

Do wnlo ad ing The S o ur c eDo wnlo ad ing The S o ur c e

cd /tmp wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz tar zxf nagios-plugins.tar.gz

C o mp ile + Ins t allC o mp ile + Ins t all

cd /tmp/nagios-plugins-release-2.2.1/ ./tools/setup ./configure make make install

Te s tTe s t P lug insP lug ins

Point your web browser to the ip address or FQDN of your Nagios Core server, for example: http://10.25.5.143/nagios http://core-013.domain.local/nagios Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the sc

S e r vic e / Dae mo n C o mmand sS e r vic e / Dae mo n C o mmand s

These commands are for starting / stopping / restarting / status Nagios. systemctl start nagios.service systemctl stop nagios.service systemctl restart nagios.service systemctl status nagios.service A r c h L inuxA r c h L inux

S e c ur it y- Enhanc e d LinuxS e c ur it y- Enhanc e d Linux

This guide is based on SELinux being disabled or in permissive mode. SELinux is not installed on a base build of Arch Linux. If you would like to see if it is enabled run the following command: ls -la /etc/selinux/config If the file does not exist, SELinux is not enabled.

P r e r e q uis it e sP r e r e q uis it e s

Perform these steps to install the pre-requisite packages. pacman --noconfirm -Syyu pacman --noconfirm -S gcc glibc make wget unzip apache php gd traceroute php-apache

Do wnlo ad ing t he S o ur c eDo wnlo ad ing t he S o ur c e

cd /tmp wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.5.tar.gz

wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.5.tar.gz tar xzf nagioscore.tar.gz

C o mp ileC o mp ile

cd /tmp/nagioscore-nagios-4.4.5/ ./configure --with-httpd-conf=/etc/httpd/conf/extra make all

C r e at e Us e r And G r o upC r e at e Us e r And G r o up

This creates the nagios user and group. The http user is also added to the nagios group. make install-groups-users usermod -a -G nagios http

Ins t all Binar ie sIns t all Binar ie s

This step installs the binary files, CGIs, and HTML files. make install

Ins t all S e r vic e / Dae mo nIns t all S e r vic e / Dae mo n

This installs the service or daemon files and also configures them to start on boot. The Apache httpd service is also configured at this point. make install-daemoninit systemctl enable httpd.service

Ins t all C o mmand Mo d eIns t all C o mmand Mo d e

This installs and configures the external command file. make install-commandmode

Ins t all C o nf ig ur at io n File sIns t all C o nf ig ur at io n File s

This installs the SAMPLE configuration files. These are required as Nagios needs some configuration files to allow it to start. make install-config

Ins t all Ap ac he C o nf ig File sIns t all Ap ac he C o nf ig File s

This installs the Apache web server configuration files. make install-webconf As well as installing the Apache web server configuration files, there are additional changes required to the Apache config file httpd.conf to enable modules. Commands that do all of these changes are below, but first is a list of the changes being made. Change this: LoadModule mpm_event_module modules/mod_mpm_event.so To this: #LoadModule mpm_event_module modules/mod_mpm_event.so Change this: #LoadModule mpm_prefork_module modules/mod_mpm_prefork.so To this: LoadModule mpm_prefork_module modules/mod_mpm_prefork.so Change this: <IfModule !mpm_prefork_module> #LoadModule cgid_module libexec/apache24/mod_cgid.so #LoadModule cgi_module libexec/apache24/mod_cgi.so To this: <IfModule !mpm_prefork_module> LoadModule cgid_module libexec/apache24/mod_cgid.so

Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.

BUT W AIT ...BUT W AIT ...

Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of: (No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.

Ins t alling The Nag io s P lug insIns t alling The Nag io s P lug ins

Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins. These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on Git Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in th instructions: Documentation - Installing Nagios Plugins From Source

P r e r e q uis it e sP r e r e q uis it e s

Make sure that you have the following packages installed. pacman --noconfirm -S autoconf gcc glibc make openssl wget perl gettext net-snmp perl-net-snmp automake autoconf

Do wnlo ad ing The S o ur c eDo wnlo ad ing The S o ur c e

cd /tmp wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz tar zxf nagios-plugins.tar.gz

C o mp ile + Ins t allC o mp ile + Ins t all

cd /tmp/nagios-plugins-release-2.2.1/ ./tools/setup ./configure make make install

Te s tTe s t P lug insP lug ins

Point your web browser to the ip address or FQDN of your Nagios Core server, for example: http://10.25.5.143/nagios http://core-013.domain.local/nagios Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the sc

S e r vic e / Dae mo n C o mmand sS e r vic e / Dae mo n C o mmand s

Different Linux distributions have different methods of starting / stopping / restarting / status Nagios. systemctl start nagios.service systemctl stop nagios.service systemctl status nagios.service G e nt o oG e nt o o

S e c ur it y- Enhanc e d LinuxS e c ur it y- Enhanc e d Linux

This guide is based on SELinux being disabled or in permissive mode. SELinux is not installed on a base build of Gentoo. If you would like to see if it is enabled run the following command: ls -la /etc/selinux/config If the file does not exist, SELinux is not enabled.

P r e r e q uis it e sP r e r e q uis it e s

Perform these steps to install the pre-requisite packages. emerge --sync mkdir -p /etc/portage/package.use echo "www-servers/apache dir cgi cgid event prefork apache2_modules_version" >> /etc/portage/package.use/apache echo "dev-lang/php apache2" >> /etc/portage/package.use/php echo "app-eselect/eselect-php apache2" >> /etc/portage/package.use/eselect-php echo "media-libs/gd gd png jpeg" >> /etc/portage/package.use/gd

echo "media-libs/gd gd png jpeg" >> /etc/portage/package.use/gd emerge --noreplace sys-devel/gcc sys-libs/glibc net-misc/wget app-arch/unzip www-servers/apache dev-lang/php media-libs/gd

Do wnlo ad ing t he S o ur c eDo wnlo ad ing t he S o ur c e

cd /tmp wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.5.tar.gz tar xzf nagioscore.tar.gz

C o mp ileC o mp ile

cd /tmp/nagioscore-nagios-4.4.5/ ./configure --with-httpd-conf=/etc/apache2/vhosts.d --sysconfdir=/usr/local/nagios/etc make all

C r e at e Us e r And G r o upC r e at e Us e r And G r o up

This creates the nagios user and group. The http user is also added to the nagios group. make install-groups-users usermod -a -G nagios apache

Ins t all Binar ie sIns t all Binar ie s

This step installs the binary files, CGIs, and HTML files. make install

Ins t all S e r vic e / Dae mo nIns t all S e r vic e / Dae mo n

This installs the service or daemon files and also configures them to start on boot. The apache2 service also needs to be configured to start at boot. ===== openrc ===== make install-daemoninit rc-update add apache2 default ===== systemd ===== make install-daemoninit systemctl enable apache2.service

Ins t all C o mmand Mo d eIns t all C o mmand Mo d e

This installs and configures the external command file. make install-commandmode

Ins t all C o nf ig ur at io n File sIns t all C o nf ig ur at io n File s

This installs the SAMPLE configuration files. These are required as Nagios needs some configuration files to allow it to start. make install-config

Ins t all Ap ac he C o nf ig File sIns t all Ap ac he C o nf ig File s

This installs the Apache web server configuration files. make install-webconf As well as installing the Apache web server configuration files, there are additional changes required to the Apache config file apache2 to enable modules. Commands that do all of these changes are below, but first is a list of the changes being made. In the file /etc/conf.d/apache2 change this: APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE" To this: APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP" The /run/apache_ssl_mutex directory also needs to be created. Execute the following commands to make the change described above: sed -i '/^APACHE2_OPTS=/s/([^"]*)"$/\1 '"-D PHP"'"/' /etc/conf.d/apache