Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Nagios on Ubuntu 20.04 - DesignLinux

designlinux 0 Comments

Nagios is a popular open-source monitoring system.

Nagios keeps an inventory of your entire IT infrastructure and ensures your networks, servers, applications, services, and processes are up and running. In case of failure or suboptimal performance, Nagios will send notification alerts via various methods.

This article explains how to install Nagios on Ubuntu 20.04.

Installing Nagios on Ubuntu 20.04 #

Nagios 4 is available in the Ubuntu software repository. Installation is pretty straightforward, just run the following commands as a user with sudo privileges :

sudo apt updatesudo apt install nagios4 nagios-plugins-contrib nagios-nrpe-plugin

The command above will install a bunch of packages, including Nagios Core, Nagios Plugins, and Apache.

The Apache configuration file that ships with Nagios depend on the mod_authz_groupfile and mod_auth_digest modules, which are not enabled by default. mod_authz_groupfile module is used to allow or deny access to authenticated by group membership, and mod_authz_groupfile enables the MD5 digest authentication.

Run the commands below to enable both modules:

sudo a2enmod authz_groupfile auth_digest

The default the Apache configuration allows access to Nagios only from localhost and private IPs. We’ll change the configuration so that only authenticated users can view the interface and issue commands.

Open the configuration file with your text editor:

sudo nano /etc/apache2/conf-enabled/nagios4-cgi.conf

Comment the lines starting with Require ip, “<Files “cmd.cgi”>”, “” and Require all granted and uncomment the line containing Require valid-user, as shown below:

/etc/apache2/conf-enabled/nagios4-cgi.conf

The file also includes instructions for configuring different access levels.

Once done restart Apache:

sudo systemctl restart apache2

You can verify that both Apache and Nagios are working properly by checking their status:

sudo systemctl status apache2sudo systemctl status nagios4

Creating User Account #

By default, Nagios is configured to grant administrative privileges to a user named “nagiosadmin”. With this user, you can log in to the Nagios web interface and manage your inventory. Use the following htdigest command to create the user:

sudo htdigest -c /etc/nagios4/htdigest.users Nagios4 nagiosadmin

You will be prompted to enter and confirm the user’s password.

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

Restart the Apache service for changes to take effect:

sudo systemctl restart apache2

Configuring Firewall #

Ubuntu ships with a firewall configuration tool called UFW. If the firewall is enabled on your system, make sure to open the HTTP and HTTPS ports:

sudo ufw allow Apache

Accessing the Nagios Web Interface #

To access the Nagios web interface open your favorite browser and type your server’s domain name or public IP address followed by /nagios:

http(s)://your_domain_or_ip_address/nagios

Enter the nagiosadmin user login credentials, and you will be redirected to the default Nagios home page.

Conclusion #

We’ve shown you how installed Nagios on Ubuntu servers.

For more information about how to configure and use Nagios, check their Documentation .

If you hit a problem or have feedback, leave a comment below.

ubuntu nagios monitoring

Related

Tags: monitoring, nagios, ubuntu

Bash: Append to File

Prev Post

How to Install Gitea on CentOS 8

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 486
  • 612,665

DesignLinux.com © All rights reserved

Go to mobile version