Nagios is a popular monitoring tool many DevOps teams use to ensure thorough and efficient tracking of systems, devices, apps, and services. However, the tool does have a steep learning curve, so setting up and starting to use Nagios can be tricky without prior experience or a good tutorial. This article gives an overview of Nagios' capabilities and provides an ideal starting point for newcomers to the tool. Read on to learn about Nagios' essential features, benefits, and architecture, and discover how companies use the tool to ensure continuous monitoring of IT environments. Continuous monitoring is a process of constant detecting, reporting, and responding to risks and events within an IT system. This process is a vital DevOps security practice and has multiple goals: The need for continuous tracking comes from the issues of manual monitoring as traditional tracking is too prone to: The ability to quickly detect, report, and respond to threats is vital to a company's overall cybersecurity. Continuous monitoring is also a standard practice within SecOps teams as reliable, real-time insights throughout environments improve: Other popular terms for continuous monitoring are ConMon and Continuous Control Monitoring (CCM). Continuous monitoring is a vital aspect of modern cybersecurity. A sound ConMon solution allows a security team to: If you are looking for a ConMon solution, our articles on cloud monitoring and server monitoring tools can help you find the right software. Nagios is an open-source app for monitoring systems, networks, and IT infrastructure. The tool allows users to track the state and performance of: Nagios runs periodic checks on critical thresholds and metrics to monitor for system changes and potential problems. If the software runs into an issue, the tool notifies admins and can also run automatic scripts to contain and remedy the situation. You can use Nagios to monitor: The tool is available in two main variants: This software is a common tool of choice in DevOps circles due to the solution's scalability, efficiency, and flexibility. Our article on the best DevOps tools presents the top options on the market and helps put together an ideal DevOps toolchain. As with all robust ConMon tools, Nagios eliminates the need for manual monitoring. The team gets to focus on more impactful tasks than identifying and fixing infrastructure errors. Nagios also standardizes and centralizes monitoring across all environments, devices, and systems. Other reasons why DevOps and SecOps teams often see Nagios as their go-to continuous monitoring tool are: If you are interested in a database server but are unsure how much it will set you back, our article on database server pricing can help estimate the cost of your future setup. Here are the main benefits of using Nagios for continuous monitoring: Our article on network security tools presents additional tools you can use alongside Nagios to ensure safe and transparent network operations. Here are the main features of the Nagios monitoring tool: Nagios runs on a host server (usually as a daemon) and the tool's operations rely on a server-agent architecture. You set up an agent at the network element that requires monitoring, and the agent communicates with the Nagios server. The tool retrieves metrics via the agent and makes decisions based on events and set thresholds. Another way Nagios can communicate with systems is through native protocols, such as SNMP or WMI. Depending on the setup, both agent and protocol-based monitoring can either be: Nagios architecture has three main components: While you can use the web-based GUI to interact with the tool, teams can also work in the command-line interface (CLI). Plugins are stand-alone add-ons and extensions that allow users to: Plugins are either compiled binaries (written in C, C++, etc.) or executable scripts (Shell, Perl, PHP, etc.) users run from a command line. Plugins run on the Nagios server and enable users to monitor both remote and local hosts via agents or local protocols. Nagios uses the results generated by a plugin to determine: Nagios plugins come in three types: All plugins follow a status code. The table below explains the default exit code statuses and their descriptions: The graphical user interface (GUI) offers an overview of all the processes going on within Nagios. The Nagios XI GUI provides viewing of the most critical monitoring data and has six submenus: In the top menu, you will find: The step-by-step guide below shows how to install Nagios Core on Ubuntu 20.04. 1. You should first check the web for the latest available packages: 2. Next, upgrade the system packages to the latest versions: After updating the system, you need to install the packages required to run Core. Enter the following code into the command line: Download Nagios Core. To do so, browse to the official Git repository and select the latest release. Alternatively, you can download the tool from the official website. At the time of writing this article, the latest version of Nagios is 4.4.6, so we use the following command to extract the tool: Now, use the This command downloads a directory called nagios-4.4.6 and adds it to your current working directory. We now need to install Core by compiling from the source. 1. Navigate into the Nagios directory: 2. Run the configure script: 3. Run the 4. Next, we need to create group users: 5. Now install Nagios Core on your Ubuntu system: 6. As you can see, some additional instructions appear on the screen. Run the following command to install the 7. Next, install and configure permissions on the directory: 8. Finally, install sample config files in /usr/local/nagios/etc/: 1. You need to enable the Apache module required for the Nagios web interface, so run the following command: 2. Type in the following command for the classic Nagios monitoring theme: We now need to create a user that can log in to Nagios. The following command creates a user called nagadmin: You need to provide a password for the user and confirm it (by default, passwords are stored in /usr/local/nagios/etc/htpasswd.users). Look at the latest available plugins at the official repository (at the time of writing this article, the newest released version is 2.3.3). 1. To download plugins, type the following command: 2. This command creates a new directory (nagios-plugins-2.3.3) in your current working directory. To install plugins, you first need to navigate to the new directory: 3. Now compile the plugins from source: 4. To make sure all configurations are in order, run the following command: 1. The last step is to start the Nagios service, which we achieve with the following command: 2. To make sure the tool is running, use the following command: 3. You can now access the tool by opening your browser and navigating to the http://server-IP/nagios URL. 4. Once prompted, type in the credentials defined in step 6 to sign in and you are ready to start monitoring. While rich with capabilities, Nagios is not a perfect tool. Here are the main disadvantages of using Nagios: Nagios is a sound option for any business looking for reliable system monitoring. If your team never used the tool before, consider setting up Nagios Core for free and testing the tool's capabilities first-hand. After a few weeks with Core, you will know whether the team requires XI or not. Either way, your IT monitoring will see massive improvements.What Is Continuous Monitoring?
Why Is ConMon Important?
What Is Nagios?
Why Do We Need Nagios?
Benefits of Nagios
Nagios Features
Nagios Architecture
Nagios Plugins
EXIT CODE STATUS DESCRIPTION 0 OK The system is working fine 1 WARNING The system continues to operate but requires attention 2 CRITICAL The system is not working correctly 3 UNKNOWN The plugin cannot assess the status of the host or service Nagios GUI
Nagios Core Installation
Step 1: Check for System Updates
$ sudo apt update
$ sudo apt upgrade
Step 2: Install Prerequisite Packages
$ sudo apt install wget unzip vim curl gcc openssl build-essential libgd-dev libssl-dev libapache2-mod-php php-gd php apache2
Step 3: Download Nagios Core
$ export VER="4.4.6"
curl
command:$ curl -SL https://github.com/NagiosEnterprises/nagioscore/releases/download/nagios-$VER/nagios-$VER.tar.gz | tar -xzf -
Step 4: Install Nagios
$ cd nagios-4.4.6
$ ./configure
make all
command to compile the program alongside the CGIs:$ sudo make all
$ sudo make install-groups-users$ sudo usermod -a -G nagios www-data
$ sudo make install
init
script in the /lib/systemd/system path:$ sudo make install-init
$ sudo make install-commandmode
$ sudo make install-config
Step 5:Set up Apache and Nagios UI
$ sudo make install-webconf$ sudo a2enmod rewrite cgi$ sudo systemctl restart apache2
$ sudo make install-classicui
Step 6: Create the First Nagios User
$ sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagadmin
Step 7: Install Nagios Plugins
$ VER="2.3.3"$ curl -SL https://github.com/nagios-plugins/nagios-plugins/releases/download/release-$VER/nagios-plugins-$VER.tar.gz | tar -xzf -
$ cd nagios-plugins-2.3.3
$ ./configure --with-nagios-user=nagios --with-nagios-group=nagios$ sudo make install
$ sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Step 8: Start the Nagios Daemon
$ sudo systemctl enable --now nagios
$ sudo systemctl status nagios
Disadvantages of Using Nagios
Excellent Monitoring Capabilities, Even With the Free Version of the Tool
13 New Relic Alternatives for System Monitoring Security Strategy, August 19, 2021
Andreja Velimirovic
12 Docker Container Monitoring Tools You Should Be Using Virtualization, May 12, 2020
Dejan Tucakov
Best 22 CI/CD Tools for Sysadmins in 2023 DevOps, November 5, 2020
Andreja Velimirovic
Best Container Orchestration Tools DevOps, Virtualization, February 3, 2020
Andreja Velimirovic
Andreja Velimirovic
Andreja is a content specialist with over half a decade of experience in putting pen to digital paper. Fueled by a passion for cutting-edge IT, he found a home at phoenixNAP where he gets to dissect complex tech topics and break them down into practical, easy-to-digest articles.