Setting up Nagios Core

see also nagios xi

tested on focal

requirements

apt install apache2 php php-gd php-imap php-curl libapache2-mod-php
# php-mcrypt

apt install libxml-libxml-perl libnet-snmp-perl libperl-dev libnumber-format-perl libconfig-inifiles-perl libdatetime-perl libnet-dns-perl

apt install libgd-dev libjpeg-dev libpng-dev
# libpnglite-dev

groupadd nagios
useradd --system -s /sbin/nologin -d /var/nagios -g nagios nagios
# setgid in da place, we need same group
useradd --system -s /sbin/nologin -d /var/nagios -g nagios nagioscmd

mkdir /etc/nagios/
# no need to change ownerships, make install-config will handle it more precisely
mkdir /var/nagios/

grab the latest Core release

wget https://github.com/NagiosEnterprises/nagioscore/archive/refs/tags/nagios-4.4.6.tar.gz
tar xzf nagios-4.4.6.tar.gz
cd nagioscore-nagios-4.4.6/
./configure \
    --sysconfdir=/etc/nagios --localstatedir=/var/nagios \
    --with-gd-lib --with-gd-inc \
    --with-nagios-user=nagios --with-nagios-group=nagios \
    --with-command-user=nagioscmd --with-command-group=nagioscmd \
    --with-httpd-conf=/etc/apache2/sites-enabled \
    --with-mail=/usr/sbin/sendmail
echo $MAKEFLAGS
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf

a2enmod rewrite
a2enmod cgi
systemctl restart apache2

htpasswd -c /etc/nagios/htpasswd.users nagios
ls -lF /etc/nagios/htpasswd.users

systemctl restart nagios
systemctl status nagios
systemctl enable nagios

Ready to go

http://localhost/nagios/

Troubles

Unable to write to check_result_path ('/var/nagios/spool/checkresults') - Permission denied

Failed to init socket '/var/nagios/rw/nagios.qh'. bind() failed: Permission denied

==> nagios and nagioscmd users belong to the same group and those folders are setgid

Resources

https://www.howtoforge.com/tutorial/how-to-install-nagios-on-ubuntu-2004/

https://linuxhint.com/install_nagios_ubuntu/

https://linuxize.com/post/how-to-install-nagios-on-ubuntu-20-04/

https://linoxide.com/how-to-install-nagios-on-ubuntu-20-04/

https://www.centlinux.com/2021/04/install-nagios-core-on-ubuntu-lts.html

https://kifarunix.com/install-and-setup-nagios-core-on-ubuntu-20-04/

more

https://subscription.packtpub.com/book/application_development/9781783288649/12/ch12lvl1sec77/introducing-nagios-event-radio-dispatcher

https://computingforgeeks.com/install-php-mcrypt-extension-on-ubuntu/

https://askubuntu.com/questions/1031921/php-mcrypt-package-missing-in-ubuntu-server-18-04-lts


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5
Copyright © 2022 Pierre-Philipp Braun