How to Install Nagios Open Source Monitoring on Debian 11 Server

How to install Nagios open source monitoring on Debian 11 server. The success of any IT department or infrastructure is dependent on extensive monitoring of all servers, devices, backups, firewall activities, application services, system checks, and web based reporting.

Nagios is one of the best, free and open source service monitoring programs, designed to monitor and notify on host or service status, performance and availability. It is a monitoring tool that allows you to monitor your servers, network devices, and other IT assets.

It can check for software or hardware issues, such as process failure or file corruption.

In this article, you will learn about Nagios, its features, and its benefits, followed by its installation with the components like Apache Web Server, PHP, and plugins on the Debian 11 server.

Shall we start with How to install Nagios open source monitoring on Debian 11 server.

What is Nagios

Firstly Nagios is an open-source monitoring tool that allows you to monitor your servers, network devices, and other IT assets. It provides a comprehensive overview of the status of your system. With Nagios you can monitor server performance, network availability, storage devices, and much more.

It alerts administrators of problems with systems on a network. The goal is to prevent downtime, save costs, and improve the quality of IT service delivery.

A great choice for large scale environments with many hosts, looking to adopt real time monitoring into their infrastructure management processes. 

Moreover Nagios is a distributed monitoring system that consists of an agent, a central server, and plug-ins. The agent installed on each host in the network to monitor its health.

A central server monitors all network hosts and reports their status via a web interface. If an audit log is available, Nagios can also generate an HTML report for each host.

What is more Nagios has no on-premise option. This makes it ideal for remote offices where network administrators cannot access their data center every day.

Also it checks configurations against standards like Microsoft’s Windows NT Server, Red Hat Linux and SuSE Linux Enterprise Server.

Reputable organizations such as NASA, Canonical Ltd., Cisco Systems, Deutsche Bahn AG, and eBay Inc has adopted Nagios in the system infrastructure.

Features of Nagios

Some of the prominent features of Nagios are:

  • Additionally Nagios Core is open source and free to use.
  • A powerful monitoring engine capable of scaling and managing 1000s of hosts and servers.
  • Comprehensive online dashboard that provides visibility into all network components and monitoring data.
  • Besides Nagios provide support for multi tenancy. It means it allows several users to access the Nagios dashboard.
  • Includes an expandable design that allows for easy integration with third-party apps via numerous APIs.
  • Has a large and active community, with over 1 million users worldwide.
  • The rapid alerting system delivers notifications to administrators as soon as an issue arise.
  • There are several plugins available to assist Nagios, as well as custom-created plugins that may be utilized with Nagios.
  • It features an excellent log and database system that easily stores anything that happens on the network.
  • The Proactive Planning tool assists in determining when it is time to improve the infrastructure.

Advantages of Nagios

  • It is free, open-source, scalable and secure.
  • The Nagios aids in increasing the availability of services, servers, applications, and processes, allowing users to monitor the network.
  • The tool helps to locate protocol failures, network outages and server outages so that they may be quickly identified and resolved.
  • The server failure is easily detectable and can send a warning to the user informing them of the difficulties.
  • Flexible tool for multi-user access at the same time.
  • Easily integrates with third-party applications.

Follow this post to learn how to install the Nagios open source monitoring tool on a Debian 11 server.

How to Install Nagios Open Source Monitoring on Debian 11 Server

Prerequisites

You will need:

  • Debian 11 system.
  • A user with root or sudo privileges.
  • A network connection.

Resolve Apache, PHP, and Other Dependencies

To begin with, you must install the Apache web server, PHP, and other essential software on your server. You can install them all by running the following command:

				
					sudo 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 of the packages, start the Apache service and set it to start automatically on the system boot.

				
					sudo systemctl start apache2
sudo systemctl enable apache2

				
			

Install Nagios on Debian 11

Debian default repository does not come with the current version of the Nagios package. As a result, it is advised to install Nagios from the source.

So the first step is to use the following command to download the most recent version of Nagios.

				
					wget https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.6.tar.gz
				
			

Next, use the following command to extract the downloaded file.

				
					tar -xvzf nagios-4.4.6.tar.gz
				
			

Navigate to the extracted directory and run the following command to configure it.

				
					cd nagioscore-nagios-4.4.6
./configure --with-httpd-conf=/etc/apache2/sites-enabled
				
			

You will receive the following results:

				
					General Options:
 -------------------------
        Nagios executable:  nagios
        Nagios user/group:  nagios,nagios
       Command user/group:  nagios,nagios
             Event Broker:  yes
        Install ${prefix}:  /usr/local/nagios
…
				
			

Use the following command to build all the required programs:

				
					sudo make all
sudo make install-groups-users

				
			

Now, join the Apache group as the Nagios user:

				
					sudo usermod -a -G nagios www-data
				
			

Use the following command to install Nagios, including web configuration, command mode, and other components:

				
					sudo make install
sudo make install-daemoninit
sudo make install-commandmode
sudo make install-config
sudo make install-webconf
				
			

Now run the following command to enable the Apache rewrite and cgi modules:

				
					sudo a2enmod rewrite cgi
				
			

Finally, restart the Apache service to let the changes take effect:

				
					sudo systemctl restart apache2
				
			

Create a Nagios Admin User

It is advised to safeguard Nagios using password based authentication for security reasons. You can establish a Nagios admin account and configure its password using the following command:

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

Set the password as follows:

				
					New password: 
Re-type new password:
Adding password for user nagiosadmin

				
			

Here, we need to change some folder permissions.

				
					sudo chown www-data:www-data /usr/local/nagios/etc/htpasswd.users
sudo chmod 640 /usr/local/nagios/etc/htpasswd.users

				
			

Install the Nagios Plugins

The next step is to add the Nagios plugins to your system. Execute the following command to download the latest stable version of the Nagios plugins:

				
					wget https://github.com/nagios-plugins/nagios-plugins/releases/download/release-2.3.3/nagios-plugins-2.3.3.tar.gz
				
			

Now, run the following command to extract the downloaded plugins.

				
					tar xvzf nagios-plugins-2.3.3.tar.gz
				
			

After that, navigate to the plugins folder directory and compile and install its contents.

				
					cd nagios-plugins-2.3.3.tar.gz
./configure --with-nagios-user=nagios --with-nagios-group=nagios
sudo make
sudo make install

				
			

Start the Apache and Nagios services:

				
					sudo systemctl restart apache2
sudo systemctl start nagios.service

				
			

Configure the firewall

Configure the firewall to allow port 80 using the following command.

				
					sudo ufw allow 80
				
			

Reload the firewall for the changes to take effect.

				
					sudo ufw reload
				
			

And enable the firewall to start on boot using the following command.

				
					sudo ufw enable
				
			

Access the Nagios Web Interface

Now that Nagios is installed and configured on your server, you can now access it by entering http://your-server-ip/nagios into your browser.

You will be prompted for a username and password. The username, as you may recall, is the one configured to be “nagiosadmin”.

Enter your Nagios admin username and password, then click the Sign in button. Once logged in, you can see the Nagios dashboard in the window.

In the left panel, navigate to Hosts and Services to see your local server, server related information, and the status of all active services.

That’s it for How to install Nagios open source monitoring on Debian 11 server.

How to Install Nagios Open Source Monitoring on Debian 11 Server Conclusion

In this guide, you have learned how to install Nagios source monitoring along with its essential components on a Debian 11 server.

Furthermore Nagios has evolved to become one of the leading monitoring tools on the market today. It monitors computer networks, installed as part of the operating system on most UNIX-like systems. It runs on Unix, Linux, and BSD systems, and is used to monitor the availability of computer resources.

Finally Nagios can be used to monitor both physical and virtual servers. It has many features, including alerting, graphing, trend analysis, and much more.

Explore more solutions like Nagios in our monitoring section.

Avatar for Sobia Arshad
Sobia Arshad

Information Security professional with 4+ years of experience. I am interested in learning about new technologies and loves working with all kinds of infrastructures.

5 1 vote
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x