This article will describe installing Nagios which is a 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 -e [ -z "${NAGIOS_PASSWD}" ] && NAGIOS_PASSWD=nagios nagios_install() { sudo dnf install -y nagios nagios-plugins-all 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 sudo dnf install -y checkpolicy cat <<EOF > my-nagios.te module my-nagios 1.0; require { type httpd_t; type nagios_spool_t; type nagios_script_t; type nagios_etc_t; class file { open read getattr map }; } allow httpd_t nagios_spool_t:file { open read getattr }; allow nagios_script_t nagios_spool_t:file { open read getattr map }; allow nagios_script_t nagios_etc_t:file { map }; 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 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.
/etc/apache2/conf-available/nagios3.conf
2 Access to Nagios
Access to Nagios via the following URL.
http://<server>/nagios
Input nagiosadmin user and NAGIOS_PASSWD.
Nagios is displayed.