Nagios Core, formerly known as Nagios, is a free and open-source computer-software application that monitors systems, networks, and infrastructure. Nagios offers monitoring and alerting services for servers, switches, applications, and services. It alerts users when things go wrong and alert them a second time when the problem has been resolved.
A system with CentOS Stream 9 installed and running.
rootaccess to the system.
- LAMP Stack installed and running, for this, you can refer to one of our guides on installing the LAMP Stack (Apache, MariaDB, and PHP).
Once you're all set, we'll proceed with Nagios Core installation and configuration.
yum groupinstall "Development tools" yum install wget
Next, let us disable SELinux. We are going to set SELinux to permissive. Edit this file:
Then update, Edit this line to permissive:
Before installing Nagios need to install some required libraries to Nagios Core work properly
yum install -y httpd httpd-tools php gcc glibc glibc-common gd gd-devel make net-snmp
Create Nagios User and Group
useradd nagios groupadd nagcmd
Next, add both the Nagios and the apache user to the nagcmd group
usermod -G nagcmd nagios usermod -G nagcmd apache
Check latest version here: Nagios Core Official
Create a directory to install Nagios
mkdir /root/nagios cd /root/nagios
Command to download Nagios and Nagios plugins
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.6.tar.gz wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
And extract Nagios and its Plugins
tar -xvf nagios-4.4.6.tar.gz tar -xvf nagios-plugins-2.2.1.tar.gz
Enter into Nagios directory
And run Nagios Configure file
After configuring, compile and installing required libraries using the make command
make all make install
In the above output, we can see it listed some libraries to install we can install those using the make install command
make install-init make install-commandmode make install-config
Remember, these are SAMPLE config files. You'll need to read the documentation for more information on how to define services, hosts, etc. to fit your particular needs.
To get Email alerts configure the file
NOTE: Replace your Email ID in place of email@example.com
Command to install Web interface
Command to set a password for the Web interface
htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
systemctl start httpd.service
Enable Port 80 & 443
firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --zone=public --add-port=443/tcp --permanent firewall-cmd --reload
Switch to Nagios Plugin
cd /root/nagios cd nagios-plugins-2.2.1/
And run Nagios Plugin Configuration file
./configure --with-nagios-user=nagios --with-nagios-group=nagios
Next, Compile and Install required libraries
make all make install
Command to verify Nagios Configuration Files
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Enable Nagios Services
systemctl enable nagios systemctl enable httpd
Open a Web browser and enter the following URL to login Nagios Web Interface
NOTE: Replace with your IP address or Fully qualified domain name in place of Your-server-IP-address FQDN
NOTE: Login for the Nagios Web Interface is default Username nagiosadmin and the Password you have set before in the previous step.
Nagios Web Dashboard
Now you have successfully installed Nagios on CentOS Stream 9.
If you can not configure and face technical difficulties, kindly reach out to us via Support Ticket.