Nagios Installation


Today is the first day of my new job. I am currently working as a system/network administrator in a data center of a global organization.

The first task I got is something on Nagios. I did not use Nagois before. Instead, I am pretty familiar with a similar product named WhatsUp Gold. I believe the experience on WhatsUp Gold will help a litte bit.

OK, let me start from installing Nagios on a CentOS 5 box.

1)  Install some prerequisite packages.

yum install -y httpd php
yum install -y gcc glibc glibc-common
yum install -y gd gd-devel

2)  Create nagios user account, set the password and the membership.

useradd -m nagios
passwd nagios 

usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache

3)  Download Nagios and the plugins.

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz

4)  Compile and install Nagios.

tar xvzf nagios-3.2.3.tar.gz
cd nagios-3.2.3

./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode

5)  Replace the sample email address with yours in the contacts configuration file.

vi /usr/local/nagios/etc/objects/contacts.cfg

6)  Configure the web interface and set the password for nagiosadmin.

make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
service httpd restart

7)  Compile and install the Nagios plugins.

tar xvzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

8)  Add Nagios to startup service.

chkconfig --add nagios
chkconfig nagios on

9)  Verify with the following first command. If there are no errors, start Nagios.

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios start

10)  Congiure to run CGIs under SELinux enforcing mode or disable the SELinux then reboot.

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

or

vi /etc/selinux/config
SELINUX=disabled

11)  Verify the web works or not by going to http://server_IP/nagios. If you see the following page. Congratulations! You have finished the Nagios installation.

image

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s