How To Install & Setup Nagios Core On Raspberry PI
Have you ever thought about how some of the World’s biggest companies monitor hundreds of devices? If not, then do it now because, in this tutorial, I am going to introduce you to Nagios. Nagios is a monitoring solution that can monitor a few devices in your house or hundreds of devices, services, network protocols in a multi-billion company.
First of all, why do we need Nagios or any monitoring tool at all?
It should not be difficult to understand why we need a monitoring tool. A monitoring tool is helpful when you do not want to waste your time to manually check your devices, ports, or services running on those ports. Let’s say you setup a web server and want to make sure that it is always up. But problems occur and your server may go down because of an automatic update. So to know that a problem has occurred, you should always be in front of the system and monitor it yourself. It is time-wasting to put your eyes on server all time just to check that it’s up.
Let a monitoring tool like Nagios handle it for you. It will watch your devices, services running on your devices and network protocols and notifies you if anything goes down. Isn’t it useful?
So in this article, I will show you how to install and setup Nagios on Raspberry Pi. It is very simple to do.
How does Nagios work?
So how does Nagios monitor something? First of all, we install Nagios on a system and we call it Nagios server. Now Nagios can monitor a device either using an agent or a native protocol.
We install an agent on the device we want to monitor and Nagios server talks to the agent periodically. Nagios sends messages asking how certain services are performing and the agent responds back with the information. The Nagios server processes the information saves it and alerts the administrator if anything is not working correctly.
Let us say there is a Linux system in the network and I want to monitor the hard disk on this system. I do not want the hard disk storage go above 80%. So I can setup an agent on the Linux system. Now the Nagios will run periodic checks on the Linux system asking for hard disk information and the agent will provide the information back to the server. Based on the information, Nagios will perform actions. If the hard disk storage is above 80%, then it will notify the admin.
In the same way, you can monitor pretty much anything.
The second method Nagios uses to monitor network devices is through native protocols. There are two protocols, i.e. SNMP and WMI. We will talk about these protocols in later articles when configuring devices with Nagios.
The idea behind installing Nagios on a Raspberry Pi is to monitor devices on a small network such as home network.
How to install Nagios on Raspberry Pi?
Nagios is available in the default repository of Raspbian. So start with updating your system first –
sudo apt update && sudo apt upgrade -y
Install nagios3 –
sudo apt install nagios3
Now the download will start. It won’t take long as it’s only a few MB in size.
After the download is complete, it will ask you to enter the web administrator password. By default, the setup will create a user ‘nagiosadmin‘. So remember your password for later use.
As you confirm the admin password, the installation will start. After the installation is complete, that’s it. You are now ready to use Nagios.
Nagios3 web login
Enter the credentials to login. The username is ‘nagiosadmin’ and password is what you set during the installation.
And there you go! Nagios core is setup and running. You can follow the easy to use Documentation to setup your devices with Nagios.
I will cover more topics in Nagios such as configuring devices and using plugins.