Today, to keep track of networks and servers, it has become vital to invest in monitoring tools. The monitoring tools keep you updated about the incidents, network activities, and other actions that lead to better performance.
Nagios is a popular monitoring tool that offers all the system-related information to the user and monitors networks and applications in real-time. It also takes the support of plugins to identify the performance bottlenecks and maintain statistics. Here, we will discuss Nagios Core in detail – its importance, features, architecture, use-cases, integrations, and support options.
What is Nagios Core?
Nagios Core is an open-source continuous monitoring tool used for IT infrastructure, network, and system monitoring. Nagios Core, previously known as Nagios, is free computer software used by professionals for monitoring and alerting services for servers, switches, applications, and services. It allows administrators to monitor hosts and services designed to inform you about network problems.
As and when an event of failure occurs, Nagios immediately sends alerts to the technical staff and permits them to commence the remediation processes before outages cause any negative impact on the business processes, end-users, or customers.
Nagios Core is an enterprise-grade monitoring tool, you can use to keep track of most, if not all, aspects of your IT infrastructure, including networks, hosts (and their resources), services, and applications. Nagios also helps monitor IT infrastructure components like applications, operating systems, networking, and system metrics. It also has various plugins stored on a server that provides low-level intelligence on how to monitor everything.
Most DevOps teams use the Nagios tool to detect network issues, maintain security, and service availability and discover the root cause of the problem. Written in C language, the continuous monitoring tool is easy to use and can run natively on Linux systems.
Why Nagios Core?
Originally released in 1999 as NetSaint by Ethan Galstad, it is subsequently used as an open-source project. The trademark issue with the name “NetSaint” led to renaming the project as Nagios. Later in 2012, it was again renamed as Nagios Core.
Nagios Core is software with a powerful graphical interface that allows users to customize layout and view network status and log files. Also, it supports the integration of automatic graphs that aid organizations in running trend analysis and predicting future plans before the systems become obsolete.
Additionally, Nagios Core provides full monitoring for Linux operating systems and distributions, including services status, process status, file system utilization, operating system metrics, etc. Also, it has the ability to enable plugins that expand its monitoring capabilities.
By using a parent node, Nagios is able to determine a network node’s hierarchy. It runs plugins stored in the server that is connected to
a node or other server in your network or on the Internet. Nagios runs on a host server (usually as a daemon) and tool operations are dependent on the server-agent architecture.
It also supports SSL and SSH encrypted tunnels that help in remote monitoring. Another reason why most companies choose Nagios Core is it helps identify performance bottlenecks in the network.
Nagios Core Architecture
Nagios supports both command-line interface (CLI) and web-based graphical user interface (GUI). Depending on the version of Nagios, administrators can choose to work with both interfaces. It also has a dashboard that displays the necessary parameters monitored on assets. Once these parameters are properly defined, Nagios can send alerts on noticing any suspicious activity or reaching critical levels.
Nagios has a client-server type architecture, i.e., the workload of each client-server is separate. The server runs on the host and also the plugins are stored on the server running on a remote host for monitoring threats and other problems in the network.
There is a component name scheduler, which is responsible for passing the signal to execute plugins. On receiving the signal from the remote host, the plugin sends the information to the process scheduler, who updates the GUI, and alerts are forwarded to the admins.
You can find a wide range of plugins supported by the tool that provides intelligence on how to monitor the network. But for executing the plugins, Nagios core is used. Do you know Nagios has developed and maintained around 50 plugins by now and approx 3000 from the community? Each plugin is categorized under separate lists, such as cloud, log files, software, hardware, and network connections.
It also has a powerful and interactive web interface that aids in creating web pages.
Features of Nagios Core
Nagios is an open-source tool with modern GUI and high-performance capabilities. Users can easily run the continuous monitoring tool on the Linux operating system and perform periodic checks on IT infrastructure. Let us have a look at some of its features that make it a suitable option for your business.
- Offers better security and scalability to the network.
- The continuous monitoring tool is easy to manage and allows administrators to discover issues faster present in the network.
- Allows users to easily manage logs and database system
- It has an easy-to-use and informative web interface that aids in monitoring applications, networks, and other services.
- In case an event of failure occurs, the tool immediately sends the alert to the team and notifies them about the detected network issue. It also ensures that immediate actions are taken against the issue.
- It has a failover capability that helps identify performance bottlenecks in the network.
- The continuous monitoring tool has various options that help automatically fix the issues.
- It supports the monitoring of network services, including HTTP, FTP, POP, SMTP, SNMP, SSH, etc.
- Nagios Core is flexible and allows multi-user access for monitoring network components at the same time
Benefits of Using Nagios Core
If you are looking for a monitoring tool that will help increase the availability of your servers, applications, processes, and services, then Nagios is the best option for your organization. With the help of the Nagios tool, your professional team will be able to quickly discover protocol failures, and server and network outages in real-time. Further, it will immediately commence the remediation process to resolve the issue.
Basically, as the tool detects the fault or error, it instantly sends an alert to the user and notifies them about the problem for a quick solution. It is one of the stable and reliable platforms that help businesses in monitoring thousands of nodes.
Additionally, it has powerful script APIs that help in monitoring in-house and custom applications or services. There are a few additional features supported by the tool that ensure you know about the trends and capacity planning. Unlike other continuous monitoring tools, Nagios provides historical reports and supports third-party add-ons.
What are Nagios Plugins?
Nagios Plugins are standalone extensions that help extend Nagios capabilities and enable them to monitor anything and everything. Nagios plugins play a critical role in the configuration of Nagios. They help admins to run certain tests, for example, checking available disk space, etc.
If you want your Nagios system to do specific tasks, you can use plugins from your services configuration files. Plugins are critical for defining how an environment should be monitored and defining custom Nagios commands in your commands. Plugins can be both compiled binaries and executable scripts. Officially, Nagios maintains around 50 plugins and the rest 3000+ come from the community or third party.
You can choose from N number of plugins and use it for monitoring services, metrics, applications, or hardware. Once activated, the plugins connect to Apache for displaying the result.
How does Nagios Plugins Work?
Nagios plugin checks hosts and services available for monitoring the infrastructure. In some cases, to provide more complex checks for an application, third-party Nagios plugins are used.
Like any Nagios plugin, you will want to test it out on the command line before adding it to your config file. At first, when you run Nagios plugins, it will search for libtap libraries and set up tests automatically.
The next step after a plugin is running is to define a command for it within your Nagios Core configuration, so it can be used for monitoring hosts and/or services. You should have a running Nagios Core 4.0 or newer server, with some hosts and services configured, already. Also, you must have the plugin installed that you want to define a new command for, so you can use it as part of defining services.
To determine the state of a monitored service, Nagios Exchange runs the Check plugin against it.
Nagios Exchange is able to determine the status of the monitored service by reading the check output. Nagios will run the plugin to check the status of the service or node.
Usually, in a network, a Nagios server is running on one host, and Plugins are running on any remote hosts that need monitoring. In most cases, only the Nagios plugins running on the remote host using the -h switch are available as services.
If your remote hosts are running Check_MK agents, then you can probably monitor Nagios plugins that only run locally as services using MRPE.
Now we know the user plugin is running in both the client being checked and on the Nagios server, and NRPE is communicating properly, we can proceed and set up the Nagios Exchange files for checking remote devices. Once the configuration is done, verify that Nagios alerts you of failed authentication (because Nagios is trying to retrieve a page without providing the username/password).
The extension acts as an abstraction layer between the monitoring logic, which is represented visually in the Nagios interface, and the actual services and hosts being monitored.
With improvements, the plugins are capable of handling more complicated logic, using command-line arguments to configure, and, accepting inputs over STDIN, to perform multi-service, dependency-based checks.
If you want to monitor a windows machine, install Check_nt plugin and NSClinet++. Similarly, for Linux and Mac OS install NRPE (Nagios Remote plug-in Executor) and NSCA plugins.
Use Cases
- Proactive alerting It is important to stay updated about the network incidents and the event of failure. With a proactive alerting system, you can create a plan of attack and protect your applications and servers from huge damage. With Nagios core, you can stay up-to-date and timely mitigate the effects of system failures.
- Updating about the status of Network Activity and Health Nagios core monitors all activity and updates admin about the necessary changes that aid in making informed business decisions. You can also generate pre-built reports that will help identify which hardware is necessary and which areas require your immediate attention.
- Identifying Network Incidents If anything goes wrong, Nagios Core immediately goes through the damage and begins troubleshooting the problem. It not only saves your money but also time by immediately working on it to resolve the incident and prevent your business processes from the bigger loss.
- Monitoring System Metrics Nagios Core is the best tool to keep track of the network and applications. It provides essential tools that aid in monitoring server metrics and ensure that it lies within the designated thresholds or else immediate notifications will be forwarded to the staff updating about the issue/problem.
Pricing
Nagios Core is available in three versions – free, standard, and enterprise.
The free version allows users to monitor seven hosts and is best suitable for small environments. Also, it offers a free license and allows users to perform service checks. The standard version, on the other hand, starts at $1,995 with a one-time license and support for GUI configuration, advanced reporting, enhanced visualizations, custom user dashboards, and phone support.
The Enterprise version of the tool starts at $3,495 with a one-time license including standard edition plan features and capacity planning reports, audit logging, SLA reports, automated host, web-based server console access, etc.
Integrations
One of the major reasons why most people trust and use Nagios is it can be easily integrated into existing infrastructure. You can integrate it with management software and keep track of all existing custom hardware, application, or service.
Documentation and Support
Nagios Core has a dedicated team of experts available full-time to resolve your queries and deliver customer satisfaction. The support team also assures that the organization receives proper coverage whenever required. Users across the globe can access expert guidance and support, regardless of their location.
Also, it provides an extensive knowledge base and documentation for users to get in-depth information from fellow professionals. Customers can also reach out to the support teams via email, phone, or online ticket system.
Install Nagios Server and Nagios Client
In this section, we will install and configure the Nagios server, install the Nagios client and add it to the Nagios server then monitor the Nagios client machine from the Nagios dashboard.
1. Install Required Dependency
Before starting to install Nagios, you will need to install several dependencies on your Nagios server machine:
apt-get install apache2 php libapache2-mod-php autoconf bc gawk dc build-essential gcc libc6 make wget unzip libgd-dev libmcrypt-dev make libssl-dev snmp libnet-snmp-perl gettext -y
After installing all the dependencies, start and enable the Apache service using the following command:
systemctl start apache2 systemctl enable apache2
2. Download and Install Nagios
First, download the Nagios core source file from the Git repository:
wget https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.6.tar.gz
Next, extract the downloaded file with the following command:
tar -xvzf nagios-4.4.6.tar.gz
Next, navigate to the extracted directory and compile the Nagios source with the following command:
cd nagioscore-nagios-4.4.6 ./configure --with-httpd-conf=/etc/apache2/sites-enabled make all
Next, create Nagios users and groups, then add the Nagios user to the www-data group:
make install-groups-users usermod -a -G nagios www-data
Next, install the Nagios binary, service, command mode, configuration files, and web configuration files using the following command:
make install make install-daemoninit make install-commandmode make install-config make install-webconf
Next, enable the Apache rewrite and cgi modules with the following command:
a2enmod rewrite cgi
Then, restart the Apache service to apply the configuration changes:
systemctl restart apache2
3. Create Nagios Admin User
Next, you will need to create an admin user and set a password to access the Nagios web interface.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Set your password as shown below:
New password: Retype new password: Adding password for user nagiosadmin
4. Install Nagios and NRPE Plugins
Nagios provides several plugins to capture the system metrics. You can install all of them by running the following command:
apt-get install monitoring-plugins nagios-nrpe-plugin -y
Next, create a directory to store Nagios configuration files:
mkdir -p /usr/local/nagios/etc/hosts
Next, edit the Nagios configuration file and define your created directory:
nano /usr/local/nagios/etc/nagios.cfg
Add the following line:
cfg_dir=/usr/local/nagios/etc/hosts
Next, edit the Nagios resource configuration file:
nano /usr/local/nagios/etc/resource.cfg
Change the following line:
$USER1$=/usr/lib/nagios/plugins
Next, edit the Nagios command configuration file:
nano /usr/local/nagios/etc/objects/commands.cfg
Add the following lines at the end of the file:
define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }
Save and close the file, then start and enable the Nagios service:
systemctl start nagios systemctl enable nagios
You can verify the status of the Nagios using the following command:
systemctl status nagios
You should see the Nagios service status in the following output:
● nagios.service - Nagios Core 4.4.6 Loaded: loaded (/lib/systemd/system/nagios.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2022-08-26 11:08:46 UTC; 4s ago Docs: https://www.nagios.org/documentation Process: 24457 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS) Process: 24458 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS) Main PID: 24459 (nagios) Tasks: 8 (limit: 2347) Memory: 2.8M CGroup: /system.slice/nagios.service ├─24459 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg ├─24460 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─24461 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─24462 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─24463 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─24479 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg ├─24480 /usr/lib/nagios/plugins/check_ping -H 127.0.0.1 -w 3000.0,80% -c 5000.0,100% -p 5 └─24481 /bin/ping -4 -n -U -w 30 -c 5 127.0.0.1
Next, restart the Apache service to apply the changes:
systemctl restart apache2
5. Access Nagios Dashboard
Now, open your web browser and access the Nagios web interface using the URL http://your-server-ip/nagios. You should see the Nagios login page:
Provide your admin username, password and click on the Sign in button. Once you are logged in, you should see the Nagios dashboard on the following page:
6. Add Remote Linux Host to Nagios Monitoring Server
In this section, we will install the Nagios client package on the client machine, add it to the Nagios server machine then monitor it from the Nagios dashboard.
Install and Configure Nagios Client
First, go to the Linux client machine and install the Nagios client packages with the following command:
apt install nagios-nrpe-server monitoring-plugins -y
Next, edit the Nagios NRPE configuration file and define your server address:
nano /etc/nagios/nrpe.cfg
Change the following lines:
server_address=client-ip-address allowed_hosts=127.0.0.1,::1,nagios-server-ip
Save and close the file, then edit another configuration file:
nano /etc/nagios/nrpe_local.cfg
Add the following lines:
command[check_root]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p / command[check_ping]=/usr/lib/nagios/plugins/check_ping -H client-ip-address -w 100.0,20% -c 500.0,60% -p 5 command[check_ssh]=/usr/lib/nagios/plugins/check_ssh -4 client-ip-address command[check_http]=/usr/lib/nagios/plugins/check_http -I client-ip-address
Save and close the file, then restart the Nagios NRPE service to apply the changes:
systemctl restart nagios-nrpe-server
Next, go back to the Nagios server machine and verify the NRPE server status:
/usr/lib/nagios/plugins/check_nrpe -H client-ip-address /usr/lib/nagios/plugins/check_nrpe -H client-ip-address -c check_ping
Add Client Machine to the Nagios Server
Next, you will need to add the remote host configuration to the Nagios server.
On the Nagios server, edit the Nagios configuration file and define the path of the remote host configuration file:
nano /usr/local/nagios/etc/nagios.cfg
Add the following line:
cfg_file=/usr/local/nagios/etc/objects/node1.cfg
Save and close the file then create a remote host configuration file:
nano /usr/local/nagios/etc/objects/node1.cfg
Add the following lines:
define host { use linux-server host_name node1 alias Ubuntu Linux Host address client-ip-address register 1 } define service { host_name node1 service_description PING check_command check_nrpe!check_ping max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24x7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24x7 notifications_enabled 1 register 1 } define service { host_name node1 service_description Check Users check_command check_nrpe!check_users max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24x7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24x7 notifications_enabled 1 register 1 } define service { host_name node1 service_description Check SSH check_command check_nrpe!check_ssh max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24x7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24x7 notifications_enabled 1 register 1 } define service { host_name node1 service_description Check Root / Disk check_command check_nrpe!check_root max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24x7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24x7 notifications_enabled 1 register 1 } define service { host_name node1 service_description Check HTTP check_command check_nrpe!check_http max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24x7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24x7 notifications_enabled 1 register 1 }
Save and close the file, then restart the Nagios service to apply the changes:
systemctl restart nagios
7. Verify Remote Host On the Nagios Dashboard
At this point, the Nagios client is added to the Nagios server. Now, it’s time to verify it.
Go to the Nagios dashboard and click on the Hosts in the left pane. You should see the added client on the following page:
Click on the Services in the left pane. You should see the status of all services on the following page:
Conclusion
Nagios Core is a free, open-source continuous monitoring tool that provides monitoring and alerting services for servers, switches, applications, and services. It helps monitor IT infrastructure components like applications, operating systems, networking, and system metrics. Also, it supports various plugins that guide on how to monitor everything.
Today, many organizations use Nagios over other monitoring tools for it helps maintain security, detects network issues faster, and identifies the root cause of the problem before causing any bigger damage.
Written in C language, it is an easy-to-use continuous monitoring tool that can also run natively on Linux systems.
Nagios has a client-server type architecture, i.e., the workload of each client-server is separate, and a wide range of plugins help extend its capabilities. Also, it has a failover capability that aids organizations in quickly identifying performance bottlenecks in the network.
You can also monitor HTTP, FTP, POP, SMTP, SNMP, SSH, and other network services with Nagios. In short, there are various benefits of Nagios and its plugins. Learn how they work and what are the pricing plans of the popular continuous monitoring tool. Further, learn about the support services, integrations, and use-cases from the above section.
Compare the tool, its features, and other aspects before coming to a conclusion. Also, check on the different pricing plans available for the tool and choose the one that meets your requirement and budget.