Nagios is a monitoring tool widely adopted by numerous DevOps teams to facilitate efficient and reliable tracking of apps, systems, and devices. Yet, using this tool requires a steep learning curve. For this reason, installing and using Nagios requires having the right information.
With this article, users can be exposed to an overview of Nagios’ strengths, advantages, downsides, installation, and more. This provides the perfect starting point for beginners.
Why Continuous Monitoring Is Important
As the name implies, continuous monitoring involves constant identification, reporting, and response to events and risks that can occur in an IT system. This represents a vital DevOps security measure with numerous goals. With a good monitoring tool, users can enjoy the real-time insight into the performance of their system. This also responds to the general health and security of IT infrastructure. The enhanced visibility across IT operations cannot be ignored.
Nagios: An Overview
Nagios is an open-source monitoring tool that can help users monitor their networks, systems, and IT infrastructure. With this tool, users track the performance of apps, networks, business processes, services, and operating systems (Windows, Unix, Linux, OSX).
Nagios carries out periodic checks on essential variables and metrics to monitor the system and prevent unwanted changes and potential issues. However, if the software runs into a problem, the tool offers a notification to the user. Besides this, Nagios can also carry out automated scripts, which can address and provide a remedy to the situation.
Users can also adopt Nagios to monitor CPU loads, memory and disk usage, the number of running processes, response times, log files, URL and content monitoring metrics, and system availability. Users can adopt two variants of this tool:
- Nagios XI This is an extended, paid version of Nagios, which offers advanced components and tools that are needed for monitoring.
- Nagios Core This is a free version of the tool, which ensures that users can keep track of all vital metrics.
In DevOps, this software has emerged as a common tool thanks to its efficiency, scalability, and flexibility. Just like other robust continuous monitoring tools, the use of Nagios removes the need for any form of manual monitoring. Instead of detecting and remedying infrastructure errors, the team can emphasize more significant tasks.
It is not uncommon to find many DevOps teams that find Nagios as their preferred monitoring tool. After all, even the free version of Nagios ensures that users can monitor all metrics and components that are critical to any mission. Besides this, Nagios also ensures that monitoring across various environments and devices is centralized.
Nagios effectively monitors database servers, including Oracle, SQL Server, MySQL, and more. The tool is also characterized by high scalability, which ensures that a team can track thousands of devices and node environments. In the world of network administration, users find this software easy to identify all forms of network issues while effectively detecting the primary causes.
Features
The Nagios monitoring tool is designed with some exciting features. Some of these are introduced as follows:
- Nagios allows both agentless and agent-based configurations. The Nagios Remote Plugin Executor (NRPE) agent ensures that users can run remote scripts and plugins.
- This monitoring tool ensures that teams can set custom thresholds for perimeters and metrics. With this, users can be sure that Nagios will set notifications through email, voice calls, or SMS once the system has surpassed the limit.
- Nagios comes with a highly customizable user interface characterized by multi-tenant capabilities. This enables users to set custom visibility for each user.
- Nagios is also characterized by several APIs, facilitating simple integration with either third-party or in-house apps.
- The tool also has an archive of configuration snapshots. This allows users to resort to a previous working setup, especially if there is a serious issue with the system.
- The tool also has a form of capacity and performance planning, which is needed to assist and plan for IT upgrades before critical systems get overloaded.
- Nagios is also designed with a robust log management system.
- The tool offers parallel processing, which helps users detect hardware issues quickly.
- With Nagios, users can set up monitoring on machines across various locations.
- The tool adopts a topology to determine dependencies.
- Nagios is designed to enable users to define the network hierarchy by using parent hosts.
Architecture
Nagios operates on a host server and all its operations depend on a server-agent architecture. Users can install an agent at the network element, which needs sufficient monitoring. Then, the agent communicates with the Nagios server. Nagios then gathers the metrics through the agent while being able to make decisions depending on the set limits and events.
Based on the setup, protocol- and agent-based monitoring can either be passive or active. When active, the server gets in touch with elements, including servers or switches, while making inquiries about their status. On the other hand, when passive, the system relays information to the server either in case of an incident or routinely. Besides this, Nagios can also communicate with other systems by adopting native protocols like WMI or SNMP.
There are three major components of Nagios architecture. These are introduced as follows:
- Plugins These add-ons are needed to run on the Nagios server while facilitating communication with local and remote hosts, which need continuous monitoring.
- The process scheduler With the process scheduler, it is possible to check plugins routinely. This carries out actions depending on the results.
- Graphical User Interface (GUI) The Graphical User Interface ensures that users can interact with Nagios while viewing the monitoring data.
Besides the web-based GUI, users can also interact with the tool by making use of the Command-Line Interface.
General Scope
Nagios primarily focuses on certain areas that involve the responsibility of check schedule, check to process, check execution, and event management. It should be noted that there are more Nagios projects that can carry out various duties, including issuing notifications, performing checks, and more tasks.
How to Install Nagios Core
This free version is straightforward to install once you can follow the step-by-step guide that discusses the installation of Nagios Core on Ubuntu 20.04.
The first step is to watch out for system updates. To do this, you must check the web for any new available packages.
$ sudo apt update
Then, upgrade the system packages to the latest versions:
o apt upgrade
Then, install Prerequisite Packages. Once the system is updated, you should install the prerequisite packages needed to run the Core. The command line should contain the following code:
$ sudo apt install wget unzip vim curl gcc openssl build-essential libgd-dev libssl-dev libapache2-mod-php php-gd php apache2
Then, download Nagios Core. To achieve this, you can browse the Git repository while selecting the latest update. You can also download the tool from the official website. To extract the tool, the following command can be useful:
$ export VER=”4.4.6″
From there, you can make use of the curl command:
$ curl -SL https://github.com/NagiosEnterprises/nagioscore/releases/download/nagios-$VER/nagios-$VER.tar.gz | tar -xzf –
With this command, it is possible to download the nagios-4.4.6 directory while adding it to the working directory.
Then, you can install Nagios by compiling from the source. You can do this by navigating into the directory.
$ cd nagios-4.4.6
Then, run the configure script:
$ ./configure
Next, you can run the “make all” command to compile the program alongside the CGIs:
$ sudo make all
Then, you can create group users:
$ sudo make install-groups-users
$ sudo usermod -a -G nagios www-data
You can then proceed to install Nagios Core on the Ubuntu system:
$ sudo make install
After this is written in the command line, additional instructions will show up on the screen. Then, you can run this command for the installation of the init script in the /lib/systemd/system path:
$ sudo make install-init
From this, install and configure permissions on the directory:
$ sudo make install-commandmode
Next, install sample config files in /usr/local/nagios/etc/:
$ sudo make install-config
The next step in this Nagios installation is to set up Apache and Nagios User Interface.
First, you must enable the Apache module that is needed for the Nagios web interface. For this, the following command should be run:
$ sudo make install-webconf
$ sudo a2enmod rewrite cgi
$ sudo systemctl restart apache2
Then, enter the following command for the classic Nagios monitoring theme:
$ sudo make install-classicui
The next step is to create the First Nagios User. To achieve this, there is a need to create a user who can log into Nagios. Creating a user can be done with this command:
$ sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagadmin
There is also a need to provide a password for the user while confirming it. The whole process is not complete just yet. The next step towards achieving the full installation of Nagios is to install Nagios Plugins.
Take a look at the newly available plugins at the official repository.
Downloading plugins requires typing the following command:
$ VER=”2.3.3″
$ curl -SL https://github.com/nagios-plugins/nagios-plugins/releases/download/release-$VER/nagios-plugins-$VER.tar.gz | tar -xzf –
With this command, you can create a new nagios-plugins-2.3.3 directory in your working directory.
$ cd nagios-plugins-2.3.3
From here, the plugins can be compiled from the source:
$ ./configure –with-nagios-user=nagios –with-nagios-group=nagios
$ sudo make install
Ensuring that all configurations are in order requires that you run the following command:
$ sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Then, you can start the Nagios Daemon. You can do so by typing in the following command:
$ sudo systemctl enable –now nagios
Next, this command will ensure that your tool keeps running:
$ sudo systemctl status nagios
Once this is done, the tool is now available for access by opening a browser and visiting http://server-IP/nagios URL.
After this has been prompted, you can input the credential defined above (the user-created) to sign in and start monitoring.
Nagios Plugins
These add-ons ensure that users can clearly define parameters on monitored systems, as well as check the state of a host or service. These plugins are divided into three different types:
- Community plugins These are third-party plugins that community members develop. There are more than 3,000 available community plugins.
- Official plugins There are about 50 official plugins that Nagios develops and maintains.
- Custom add-ons Since Nagios is an open-source monitoring tool, users with the right skills can create custom plugins.
With Nagios plugins, users can enjoy low-level intelligence, which may be utilized with Nagios Core to monitor anything. Plugins can act as a standalone application. However, their main purpose involves being operated by the Nagios Core application. A connection is established with Apache. CGI runs this to display the result. Furthermore, Nagios is connected to a database, which is adapted to retain a log file.
Nagios GUI
Nagios GUI ensures that users can get an overview of every process that occurs within the system. With Nagios XI GUI, users can view some of the most important monitoring data. There are six submenus of the GUI users must be aware of. These are introduced below:
- Quick view This is a customizable interface, which consists of different Dashlets that can be deleted, added, and manipulated to meet users’ needs. With a quick view, users can find the Tactical Overview, which represents an overall summary of all hosts and services currently being monitored.
- Details This menu details the summaries of all hosts and services. This tab will display all commands, statistics, and services running for each host.
- Graphs This menu displays a series of scalable performance graphs for the services that are being monitored for each host.
- Maps This is a graphical status map that shows all hosts and parent-child relationships.
- Incident management This menu summarizes all current notifications and alerts for services and hosts.
- Monitoring process This shows the data about all Nagios’ internal operations.
There are other options you will find at the top menu. These are introduced below:
- Views This option provides quick access to a set of views specific to every user. Network admins can ensure this displays data on wall monitors in a network operations center (NOC).
- Dashboards With these customizable dashboards, users can see essential, relevant data unique to individual Nagios users.
- Reports This menu offers a straightforward way to produce graphical reports and statistics for hosts and services.
- Configure Users can use the Configure menu to set up new monitoring processes.
- Tools These are utilities that you can quickly access and make use of from Nagios by using a web browser.
- Help This option is available for those wishing direct access to the Nagios support resources and team.
What Are the Benefits of Nagios?
Nagios has gained much popularity in the world of Network administration thanks to its plethora of benefits. Some of these are listed in this section.
- The tool ensures that there is no need for periodic testing.
- Nagios supports quick and reliable detection of website defacement, outages, and hijacking attempts.
- The tool offers better system availability and performance.
- Nagios is characterized by capacity planning, which helps plan future IT upgrades.
- Nagios’s huge, active community backs it while constantly working on new add-ons.
Since the tool is open-source, skilled teams can easily modify the features to meet their needs.
With Nagios plugins, users can enjoy a high level of flexibility. These plugins are free to download and develop.
Nagios supports high levels of security due to its alerting and response systems.
What Can Be Improved On Nagios
Despite the exciting features of the monitoring tool, Nagios has some drawbacks. As a result, this section is dedicated to the aspects of Nagios that can be improved. Some of these are introduced as follows:
- The sheer amount of data available on the interface can overwhelm a beginner.
- Even though Nagios Core is free and some mission-critical metrics can be monitored with it, many essential features are only available on Nagios XI, which you can only buy.
- Certain configuration files can prove difficult to configure.
- The monitoring tool cannot monitor network throughput.
- Every device is perceived as a host by this tool.
- Making Nagios suitable for specific needs often requires a lot of customization and modification.
Users Find Nagios Helpful
Nagios is a top monitoring tool with a plethora of features to admire. For any business that depends on sound system monitoring, Nagios is the ideal tool for them. Even adopting the free version of Nagios can be a good consideration. Those who have no experience with Nagios, they should consider installing the tool for free while testing its capabilities. Then, after using the free version, you can decide if the paid version is the right tool your team needs. Regardless of what option you consider, Nagios can help you achieve improved monitoring.
Conclusion
It is not uncommon for businesses – regardless of size- to monitor their systems reliably. To achieve this, Nagios is an effective option to consider. With so many capabilities, it is no surprise to find the position reviews and feedback this tool has generated. However, before you install the paid version, ensure that you acquaint yourself with how Nagios works while learning the pros and cons of the tool. This will help determine if the tool is the right one for your specific needs. Either way, the tool remains a reliable one to have.