Javatpoint Logo
Javatpoint Logo

Nagios Tutorial

Nagios Tutorial

What is Nagios?

Nagios is a free and open-source software application for computer systems. It is used for monitoring the systems, networks and infrastructure.

Its original name was NetSaint developed by Ethan Galstad with the group of some developers in the year 1999.

This software application mainly provides the services of monitoring and alerting for switches, applications, and servers inside the DevOps culture.

It is also used to notify the users when the things go bad, and also alerts them when the things become better.

This software application is written in C language, which was mainly designed to run under the Linux operating systems. But it can also run under Unix and Windows operating system.

This software application is available in its following two variants:

  1. Nagios Core: The Nagios is also known as a Nagios Core. It is an open-source product. It is released on 1st March in the year 2002.
  2. Nagios XI: It is an extended version of Nagios. It provides advanced components and tools for monitoring. This variant needs a software license.

Why Nagios?

Following are some reasons for using the Nagios software application:

  1. It is used for monitoring the performance issues of servers.
  2. It helps the users of this software application to easily find the root cause of any problem.
  3. It is also used to detect all the possible networks.
  4. We can easily maintain the issues of security and also detect the availability of the services.
  5. This application automatically fix the problems or issues when occurs.
  6. Users can easily run it on any operating system.
  7. Before the failure of a system, it helps you to update the infrastructure.
  8. Using this application, user can quickly detect any type of infrastructure issues.
  9. It also monitors the various servers of database such as SQL Server, MySQL.

History of Nagios

1996:

In this year, Ethan Galstad creates a new application using the third-party application which is used for creating the Nagios.

1998:

In this year, Ethan starts to build a new application using the ideas and architecture which is designed to run under Linux.

1999:

He releases his work which is done in the year of 1998 as a free and open-source project under the name "NetSaint". He hopes that there are one dozen people who are interested in this application.

2002:

In this year, he decided to rename the project name as Nagios, because there was the trademark issue with the "NetSaint" name. And, the plugins project of 'NetSaint' is also moved to 'Nagios' plugins project.

2005:

In the June month of this year, the Nagios project becomes the SourceForge.Net project.

2007:

In this year, LinuxWorld.com rates the Nagios project in the enterprise as one of the top 5 open security tools.

2009:

In this year, Nagios is renamed as Nagios Core, and the enterprises of Nagios release the first commercial version of Nagios as Nagios XI.

2011:

In this year, Nagios BPI is released for monitoring the process of a business. And, the WebHostingSearch.com awarded Nagios as a "best web tool".

2013:

In this year, the 4th version of Nagios Core is released.

2016:

In this year, Nagios Core cross the 7,500,000 downloads from the SourceForge.Net website.

Features of Nagios

Following are the various features or characteristics of Nagios application:

  1. This application provides an attractive web interface.
  2. It is highly secure and scalable.
  3. Users can easily manage it.
  4. This software application perfectly stores the data, because there is a log management system.
  5. Plugins of data graphing are available in this application.
  6. It defines the event handlers which are running during the services.
  7. It supports for backend database.
  8. It also supports to implement the unnecessary monitoring hosts.
  9. It has an optional web interface for viewing the notifications, log files, etc.
  10. Users can also set up this application in 'distribute' system, if they require to have a monitoring system in multiple locations for monitoring.
  11. It helps the users for defining the hierarchy of networks hosts using parent hosts.
  12. It monitors the various services of a network such as SMTP, HTTP, FTP, SSH.
  13. It also monitors the various resources of a server such as memory, processor, and disk drives, system logs.
  14. Users can easily monitor or detect the whole infrastructure of IT and business process with a single pass.
  15. It provides the remote monitoring through SSL and SSH encrypted tunnels.

Architecture of Nagios

The architecture of Nagios is built on the basis of server-client architecture.

The server of Nagios usually run on a host and the plugins run on the remote server/ or remote host which are to be monitored.

The plugins of Nagios collect the useful data and send them to the process scheduler, which displays the information over the graphical user interface (GUI).

Following are the three main components in the architecture of Nagios application:

  1. Scheduler
  2. GUI
  3. Plugin.
Nagios Tutorial

Scheduler

The scheduler is the server part of the Nagios system. This component checks the plugins at regular interval and according to their results perform some action.

GUI

It is a user interface of the Nagios system, which is displayed on the web pages generated by the CGI. GUI can be a button to red or green, graph, sound, etc.

The button of green color becomes red color on GUI, when the plugins returns an error or warning.

Plugins

Plugins is a component of the Nagios system, which is configurable by the users. This component detects the services and return the results to the server of Nagios.

Installation of Nagios Core

In this section, we will learn how to install the Nagios on Linux platform. So, follow the given steps for installing the Nagios:

Step 1: In this step, we have to install the packages Apache and Php which are required to be available on your ubuntu system.

So, firstly type the following command in the Linux terminal, which checks the latest updates:

Now, after the completion of the above command, run the following two commands one by one:

Step 2: In this step, we have to create a new user and group for Nagios in the system.

So, firstly type the following command to create a new user for Nagios:

After that, we have to create a new group and add the Nagios user to the Apache group.

Step 3: In this step, we have to download the latest package of Nagios Core from the official site.

But we will first change the directory to /opt/ using the following cd command:

Now, download the latest package of Nagios using the command which is given below:

Now, type the following command for extracting the tar file.

After extracting, again change the directory to nagios-4.4.5 by using the cd command:

After that, run the given command for compiling the Nagios from the source code:

Now, we have to install the Nagios with additional requirements using the make command:

After the successful execution of above commands, now, we will require to copy the scripts of event handler under the libexec directory using the following two commands.

Step 4: In this step, we have to set up an authentication gateway for preventing the unauthorized access to Nagios system:

So, firstly we have to create a configuration file of Apache for our Nagios server using the following command:

When the file is opened in terminal, then you have to type or paste the following code into your file, and then save and close the file.:

Now, we need to set up an authentication gateway of apache for the default user nagiosadmin, by executing the following command.

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

Now, we have to enable the configuration of Apache and restart the Apache using the following three commands:

Step 5: After the installation and configuration of Nagios core services, we have to download and install the plugins of Nagios using the following commands. Firstly, we have to change the directory to /opt.

Cd /opt

Now, download the plugins and extract the tar file :

Now, we have to compile and install the plugins using the following commands:

After the execution of above command, also run the following two commands on terminal:

Step 6: Now, we have to verify the installation and configuration file of Nagios using the following commands:

Now, type the following command for starting the Nagios service:

Now, enable the Nagios to start automatically on system boot:

Step 7: It is the last step, in this we have access to the web interface of Nagios using the IP address of a system. If you do not know the Ip address of your system, then you check by running the following command on terminal:

This command gives the following output. Here, below we specify the ip address:

After then, we have to type the following URL on a browser. The URL uses the IP address followed by /nagios like:

After pressing the enter key, browser takes us to the Apache authentication, here we have to enter the username and password, which are specified by us in the above steps:

Nagios Tutorial

After the successful login, you will get the home page of Nagios Core as shown in the following screenshot:

Nagios Tutorial

Advantages of Nagios Application

Following are the benefits or advantages of Nagios:

  1. This application is an open-source software, so we can use and edit it freely.
  2. It provides various plugins, which are free to download and develop.
  3. You can easily understand the plugin architecture.
  4. The main advantage of this application software is that, it quickly detects the failed services, servers, and the batch jobs.
  5. It also monitors or detects the failures of network and protocols quickly.
  6. This software application also handles the warnings and critical situations.
  7. We can also set up a monitoring system on various machines across multiple locations, so that they communicate all their outputs to the central Nagios server.

Disadvantages of Nagios

Following are the limitations or disadvantages of Nagios:

  1. If we want to add the advance features of Nagios, then these features are not available in its free version, but only available on the application of Nagios XI, which is very expensive to use.
  2. The interface of the Nagios core is confusing.
  3. This application software cannot manage the network but only monitor the network.
  4. It cannot monitor the throughput of a network.
  5. In this application, there are various files of configuration, which are very hard for the user to configure them.
  6. This Nagios application treats each device as a host.



Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA