CentOS 7: Install Nagios

Table of Contents

1 Install Nagios

The following script will install Nagios. NAGIOS_PASSWD will be used for Basic authentication password of nagiosadmin user.

NAGIOS_PASSWD=nagiossudo yum install -y epel-releasesudo yum install -y nagios nagios-plugins-*# Apache2sudo htpasswd -db /etc/nagios/passwd “nagiosadmin” ${NAGIOS_PASSWD}sudo systemctl enable httpdsudo systemctl restart httpdsudo firewall-cmd –add-service=http –permanentsudo firewall-cmd –reload# https://bugzilla.redhat.com/show_bug.cgi?id=1291734cat <<EOF > nagios-socket.temodule 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;EOFcheckmodule -M -m -o nagios-socket.mod nagios-socket.tesemodule_package -m nagios-socket.mod -o nagios-socket.ppsudo semodule -i nagios-socket.pprm -f nagios-socket.te nagios-socket.mod nagios-socket.ppcat <<EOF > nagios-statusjsoncgi.temodule nagios-statusjsoncgi 1.0;require { type nagios_script_t; type nagios_spool_t; class file { getattr read open };}allow nagios_script_t nagios_spool_t:file { getattr read open };EOFcheckmodule -M -m -o nagios-statusjsoncgi.mod nagios-statusjsoncgi.tesemodule_package -m nagios-statusjsoncgi.mod -o nagios-statusjsoncgi.ppsudo semodule -i nagios-statusjsoncgi.pprm -f nagios-statusjsoncgi.te nagios-statusjsoncgi.mod nagios-statusjsoncgi.ppsudo setsebool -P daemons_enable_cluster_mode 1sudo systemctl enable nagiossudo systemctl restart nagios

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