Setup and Configuration guide for Nagios Core on any Fedora/Linux based OS (incl. CentOS & Red Hat). This guide would allow you to setup Nagios Monitoring Server up and running in roughly 15 mins. The process would involve installing yum packages and then compiling Nagios from source.
NOTE: You need to a be a ROOT user to compile and install Nagios Core.
Step-by-Step Install Procedure:
Become root user
# su -l
# sudo -i
Download required packages via YUM.
# yum -y install httpd php gcc glibc glibc-common gd gd-devel
*y – Is for saying “Yes” to any prompts while download and install.
Create Nagios User
# useradd nagios
Change “nagios” user password. Not required but optional
# passwd nagios
Now Create a group for allowing external comands via the WEB UI and then add both Nagios and Apache user to it.
# groupadd nagcmd
# usermod -a -G nagcmd nagios
# usermod -a -G nagcmd apache
Create a directory for Nagios downloads
# cd /tmp
# mkdir nagios_downloads
# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.8.tar.gz
# wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
Untar the downloaded files
# tar zxvf nagios-4.0.8.tar.gz
# tar zxvf nagios-plugins-2.0.3.tar.gz
And the you will get 2 folders with the name “nagios-4.0.8” & “nagios-plugins-2.0.3”
First we will start with Nagios Core Install.
Change directory to Nagios 4.0.8
# cd nagios-4.0.8
Compile the source and install it. All the files would go into “/usr/local/nagios/”
# ./configure --with-command-group=nagcmd
# make all
# make install
# make install-init
# make install-config
# make install-commandmode
# make install-webconf
Next would be to create a user for loggng into Nagios WEB UI.
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
*nagiosadmin is the user for WEB UI. You can user your preffered name.
Once that is done need to retstart the Apache Service
# service httpd restart
Now we need to install the Plugins for Nagios
Change dircetory to nagios-plugins-2.0.3
# cd nagios-plugins-2.0.3
Then compile & install the plugins
# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make install
Then Make sure that Nagios service starts up on runtime/ when the system boots up.
# chkconfig --add nagios
# chkconfig nagios on
Verify the install for any errors
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If any errors, please post your query via Contact Us and we will aim to get it resolved.
If no errors reported then start the Nagios service.
# service nagios start
There is one more security bit that you need to make sure is either tuned to work with Nagios OR set to permissive mode and i.e. SELinux which is included with all major versions of Linux/UNIX.
Check and see if its in enforcing mode
OUTPUT : # enforcing
If it is enforcing then change that to permissive mode
# setenforce 0
If you want to make this setting persistent then you need to edit /etc/selinux/config
# vi /etc/selinux/config
If you dont want to lower the Security or have got security restrictions you can allow running Nagios under SELinux targeted mode.
# chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
# chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
You are now ready to login to Nagios Web Interface via the browser (recommended would be Firefox)
*Use your host IP or the hostname follwed by /nagios.
If you encounter any errors during the process, let us know via Contact Us and will get it resolved promptly.