How to install Nagios XI ?

It’s time to check your IT infrastructure’s performance again!

Today’s blog is the second blog post in the infrastructure performance monitoring series. To recap, in my first blog we looked in brief about how businesses can harness the capabilities of a cool open-source performance monitoring tool – Nagios XI. For those who haven’t read my first blog post in this series can find it here.

In this blog, I’ll be walking you through the installation of Nagios XI step-by-step.  Nagios XI is available under GNU license. A lot of plugins are available and its sizeable community makes Nagios XI the biggest open source performance monitoring tool.

Before we dive into the installation process, it is mandatory you have the latest version of the Linux distribution, CentOS, running on your machine. For those who don’t, you will have to download it from here, and then set it up on your machine before following the steps to install Nagios XI. Setting up CentOS on your machine is beyond the scope of this blog and demands a little space of its own. You can find a detailed instruction manual on installing CentOS server here.

After you have CentOS up and running on your machine, you can start working your way through the steps below to install Nagios XI. So, let’s get going!

If you follow the instructions correctly, you will end up with the following information.

  • Nagios XI and its plugins will be installed under /usr/local/nagios directory.
  • Nagios XI will be configured to monitor a few services of your local machine (Disk usage, CPU load etc)
  • Nagios web interface will be available at http://localhost/nagios

To start with, we need to install required dependencies like Apache, PHP, and libraries like gcc, glibc, glibc-common, GD and its development libraries before installing Nagios XI 4.0.6. To do so, we can use yum package installer.

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

Create a directory

# mkdir /root/nagios

Navigate to the ‘nagios’ directory you created above

# cd /root/nagios

Download nagios-core & plugin

# wget

# wget

Untar Nagios core

tar xvf nagios-4.0.6.tar.gz

Go to the nagios-4.0.6 directory

# cd nagios-4.0.6

Check all your Nagios XI core configuration settings

# ./configure

If the above configuration settings are as desired, then compile and install all necessary binary files for Nagios XI

# make all

Install all needed libraries in your machine

# make install

Install init scripts for Nagios XI

# make install-init

Install Nagios XI command line. This will enable you to operate Nagios XI from the command prompt.

# make install-commandmode

Install sample Nagios XI files

# make install-config

Install the cool web interface for Nagios XI. The following command will also create a web admin user- “nagiosadmin”

# make install-webconf

After this, we will create a new password for the newly created web admin user. You need to enter the admin password twice and also store it securely in a place for future reference as you will need it to login to the Nagios XI web interface.

# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Start the service and start it on boot

# chkconfig nagios on

# service nagios start

Now, compile and install Nagios XI plugins. We downloaded Nagios XI plugins in /root/nagios, so we will go to that location and install and configure it as below.

# cd /root/nagios

# cd nagios-plugins-2.0

# ./configure

# make

# make install

Start apache service and enable it on boot

# chkconfig httpd on

# service httpd start

That’s it! Now open your new Nagios XI web interface by typing http://localhost/nagios and provide the username “nagiosadmin” along with the password you created earlier in this process.

In my next blog, I’ll show you how you can use ‘bash-shell’ scripting to automate the rotation of performance logs from the CentOS server to your file server. Until then you can explore Nagios XI further and understand its basic configuration settings for start.

Let me know how you go with the Nagios XI installation. See you in my next blog!