Fedora 26: Install Nagios for web base system monitor tool

Table of Contents

1 Install Nagios

The following script will install Nagios.

  • NAGIOS_PASSWD is password of nagiosadmin user for Basic authentication.

#!/bin/sh[ -z “${NAGIOS_PASSWD}” ] && NAGIOS_PASSWD=nagiosnagios_install(){ sudo dnf install -y nagios nagios-plugins-all # https://bugzilla.redhat.com/show_bug.cgi?id=1291718 sudo mkdir /var/log/nagios/rw sudo chown nagios:nagios /var/log/nagios/rw sudo chmod 700 /var/log/nagios/rw # Apache2 sudo htpasswd -db /etc/nagios/passwd “nagiosadmin” ${NAGIOS_PASSWD} sudo systemctl enable httpd sudo systemctl restart httpd sudo firewall-cmd –add-service=http –permanent sudo firewall-cmd –reload # https://bugzilla.redhat.com/show_bug.cgi?id=1291734 cat <<EOF > my-nagios-socket.temodule my-nagios-socket 1.0;require { type nagios_t; type nagios_log_t; class sock_file { write create unlink }; class unix_stream_socket connectto;}allow nagios_t nagios_log_t:sock_file { write create unlink };allow nagios_t self:unix_stream_socket connectto;EOF checkmodule -M -m -o my-nagios-socket.mod my-nagios-socket.te semodule_package -m my-nagios-socket.mod -o my-nagios-socket.pp sudo semodule -i my-nagios-socket.pp rm -f my-nagios-socket.te my-nagios-socket.mod my-nagios-socket.pp # Fedora 26 needs other SELinux configuration. cat <<EOF > my-nagios.temodule my-nagios 1.0;require { type nagios_t; type nagios_exec_t; class file execute_no_trans;}allow nagios_t nagios_exec_t:file execute_no_trans;EOF checkmodule -M -m -o my-nagios.mod my-nagios.te semodule_package -m my-nagios.mod -o my-nagios.pp sudo semodule -i my-nagios.pp rm -f my-nagios.te my-nagios.mod my-nagios.pp cat <<EOF > my-nagios-script.temodule my-nagios-script 1.0;require { type nagios_spool_t; type nagios_script_t; class file { open read getattr };}allow nagios_script_t nagios_spool_t:file { open read getattr };EOF checkmodule -M -m -o my-nagios-script.mod my-nagios-script.te semodule_package -m my-nagios-script.mod -o my-nagios-script.pp sudo semodule -i my-nagios-script.pp rm -f my-nagios-script.te my-nagios-script.mod my-nagios-script.pp sudo systemctl enable nagios sudo systemctl restart nagios}nagios_install

Nagios configuration to Apache2 is written in the following file. You can change Nagios configuration like Digest authentication.


2 Access to Nagios

Access to Nagios via the following URL.


Input nagiosadmin user and NAGIOS_PASSWD.


Nagios is displayed.


Android | Linux | SDL - Narrow Escape