Share your love
Ubuntu 24.04 Nagios Core Setup: Best Guide for Server Monitoring
This guide tries to show you a step-by-step guide for Ubuntu 24.04 Nagios Core Setup. Nagios Core is an open-source monitoring tool. It allows you to monitor your servers, applications, networks, etc.
The Nagios Core version is popular among users because it is free and highly customizable. Using this guide from the Orcacore website, you can easily install and use Ubuntu 24.04 Nagios Core Setup.
Table of Contents
Server Monitoring with Ubuntu 24.04 Nagios Core Setup
Before you start your Ubuntu 24.04 Nagios Core Setup and want to start the server monitoring, you need some requirements.
You must log in to your server as a root or non-root user with sudo privileges and set up a basic UFW firewall. Once you are done, proceed to the following steps to start your Ubuntu 24.04 Nagios Core Setup.
Step 1 – Install Dependencies and Download Latest Nagios Core Version
First, you must run the system update with the following command:
sudo apt update
Then, use the following command to install the required packages and dependencies for Ubuntu 24.04 Nagios core setup:
sudo apt install wget curl build-essential unzip openssl libssl-dev apache2 php libapache2-mod-php php-gd libgd-dev -y
Now you can visit the Nagios Core Downloads page and get the latest version. In this guide, we use the release version 4. You can use the commands below to download the latest package for Nagios Core 4:
# NAGIOS_VER=$(curl -s https://api.github.com/repos/NagiosEnterprises/nagioscore/releases/latest|grep tag_name | cut -d '"' -f 4)
# wget https://github.com/NagiosEnterprises/nagioscore/releases/download/$NAGIOS_VER/$NAGIOS_VER.tar.gz
Once your download is completed, you must extract it with the command below:
sudo tar xvzf $NAGIOS_VER.tar.gz
Step 2 – Build and Install Nagios on Ubuntu 24.04
At this step of Ubuntu 24.04 Nagios Core Setup, you can start to compile and build Nagios. First, navigate to the Nagios directory with the following command:
sudo cd $NAGIOS_VER
Then, run the command below to check if everything is ok to start your Nagios installation:
sudo ./configure --with-httpd-conf=/etc/apache2/sites-enabled
At this point, you must run the following commands one by one to configure and install the packages for Nagios setup:
# sudo make install-groups-users
# sudo usermod -a -G nagios www-data
# sudo make all
# sudo make install
# sudo make install-daemoninit
# sudo make install-commandmode
# sudo make install-config
# sudo make install-webconf
# sudo a2enmod rewrite cgi
Now you have learned to build your Nagios on Ubuntu 24.04. Next, you must Set up Apache Authentication For Nagios Core.
Step 3 – Configure Nagios Web Authentication – NagiosAdmin
In this step of Ubuntu 24.04 Nagios Core Setup, you need to create a web user for authentication. The “htpasswd” command rises to the occasion for this task.
Please note that Nagios uses the “nagiosadmin” user by default. Run the command below and set your desired password:
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Then, set the correct permission and ownership to the (/usr/local/nagios/etc/htpasswd.users) file with the following commands:
# sudo chown www-data:www-data /usr/local/nagios/etc/htpasswd.users
# sudo chmod 640 /usr/local/nagios/etc/htpasswd.users
Step 4 – Install Nagios Plugins For Server Monitoring
At this step of Ubuntu 24.04 Nagios Core Setup, it is recommended to install the Nagios plugins. To do this, navigate to your home directory and use the following commands to download the latest version of Nagios Plugins and extract the file:
# cd ~
# VER=$(curl -s https://api.github.com/repos/nagios-plugins/nagios-plugins/releases/latest|grep tag_name | cut -d '"' -f 4|sed 's/release-//')
# wget https://github.com/nagios-plugins/nagios-plugins/releases/download/release-$VER/nagios-plugins-$VER.tar.gz
# tar xvf nagios-plugins-$VER.tar.gz
Then, navigate into the new plugins folder then use the commands below to compile and install Nagios plugins:
# cd nagios-plugins-$VER
# sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# sudo make
# sudo make install
Step 5 – Server monitoring with Nagios Ubuntu 24.04
At this step of Ubuntu 24.04 Nagios Core Setup, you can access your Nagios dashboard and start your server monitoring.
Note: Remember to allow port 80 through your UFW firewall and restart your services with the following commands:
# sudo ufw allow 80
# sudo ufw reload
# sudo systemctl restart apache2
# sudo systemctl start nagios.service
You can now access your Nagios web interface by typing your server’s IP address in your web browser followed by nagios:
http://your-ip-address/nagios
You will be prompted for a username and password. You should enter the Nagiosadmin user and the password you have created for it and click sign in.
Then, you must see your Nagios dashboard.
From there, you can monitor and manage many tasks including:
- Monitor Network Devices
- Monitor Servers
- Monitor Applications and Services
- Monitor System Metrics
- Alerting and Notifications
- Custom Monitoring
- Historical Reporting
- Downtime Scheduling
- Event Handlers
That’s it, you are done.
Conclusion
At this point, you have learned the Ubuntu 24.04 Nagios Core Setup. You can simply download the Nagios core package and its plugins, then, install and build it on your server. From there, you can start your server monitoring with Nagios. Nagios Core provides comprehensive monitoring and alerting capabilities, ensuring that your IT environment is running smoothly and problems are addressed before they escalate.
Hope you enjoy it. Also, you may like to read the following articles:
Nagios Core Installation on Debian 12
Install and Configure Nagios on Centos 7
Install Grafana on Ubuntu 24.04
Install Sniffnet on AlmaLinux 9
FAQs
How do I access the Nagios Core web interface?
After Ubuntu 24.04 Nagios Core setup is finished, you can access the Nagios web interface via http://server-ip/nagios
.
What is the default login for the Nagios Core web interface?
You create a user with a password during installation By default it is nagiosadmin.
How can I restart or stop Nagios Core after installation?
To restart Nagios: sudo systemctl restart nagios
To stop Nagios: sudo systemctl stop nagios
To start Nagios: sudo systemctl start nagios