How To Install Nagios On RedHat Linux
If you’re looking for computer/network monitoring system on Linux, then i believe Nagios should be your ultimate choice. Nagios is an open source computer/network monitoring system, can monitor remote servers actively or passively.
Unless there is no internal resources to support this open source IT infrastructure monitoring system, Nagios Core is free for everyone and “easy” to use by average system administrators who willing to look for reference from the Net.
This guide, for example, is done with reference from the official Fedora Quickstart documentation.
Step 1: Login as root (forget about sudo for simplicity).
Make sure you’ve these required software (GCC compiler, GD libraries, httpd, PHP) prior to compile and install Nagios.
rpm -qa | grep -e ^httpd -e ^php -e ^gcc -e ^gd- | sort
Step 2: Create user account and group ID for running Nagios:
useradd -m nagios passwd nagios groupadd nagcmd usermod -a -G nagcmd nagios usermod -a -G nagcmd apache
Step 3: Download the latest Nagios Core and Nagios Plugins source files. If the server can access to Internet directly, just uses wget to download (the latest versions at this time of writing):
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
Step 4: Now, we are going to compile and install the Nagios core. Firstly, extract the source files from the gzipped tarball:
tar -zxvf nagios-3.2.3.tar.gz cd nagios-3.2.3
From next execution onwards, you may use tee command to duplicate output to a file for examination, which could be useful to trace errors that triggered when compiling source code.
Step 6: Run the Nagios configure script to use nagcmd group explicitly:
./configure --with-command-group=nagcmd
Step 7: Compile the Nagios source code (piping to tee command is optional, as said earlier):
make all | tee make_all.nagios_core.log
Step 8: Install the compiled binaries of Nagios Core, init script, sample config files and set permissions on the external command directory:
make install make install-init make install-config make install-commandmode
Step 9: Edit contact.cfg file to update email address of nagiosadmin for receiving alerts
vi /usr/local/nagios/etc/objects/contacts.cfg
Step 10: Install Nagios web config file to Apache conf.d directory:
make install-webconf
Step 11: Create an user account for logging into the Nagios web interface:
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Step 12: Restart Apache (httpd) to make the new settings take effect:
service httpd restart
Step 13: Add Nagios to Redhat Linux system services and configure it to start up automatically when RHEL boots into runlevel 3, 4, and 5:
chkconfig --add nagios chkconfig --level 345 nagios on
Step 14: Now, you need to install standard Nagios plugins which are used to monitor various computer/network status. So, let’s unpack the compressed Nagios Plugins tarball file:
tar -zxvf nagios-plugins-1.4.15.tar.gz cd nagios-plugins-1.4.15
Step 15: Run configure file to explicitly set ownership to nagios:nagios respectively:
./configure --with-nagios-user=nagios --with-nagios-group=nagios
Step 16: Ready to compile and install Nagios Plugins binary files:
make make install
Step 17: Verify the sample Nagios configuration files (the files used to define how and what services or hosts to monitor by Nagios Core via the various plugins):
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Step 18: No error found and thus should be OK to start up Nagios for the first time:
service nagios start
Step 19: Nagios server is up and running to monitor the local computer system status. Try to access the Nagios web interface via this URL (using nagiosadmin ID and password created in earlier step):
http://<nagios_server_ip>/nagios
(by WN)
You night also like:
- How To Create Ext3 Filesystem And Mount It To Linux
- How To Disable Linux Console Screen Blank Out Feature
- How to open a tar file in Unix or Linux
Make sure to follow us on Twitter and join our Facebook page for latest updates and tutorials/How to guides.









