How to Install Nagios on Ubuntu 20.04

[ad_1]

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 #

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.

[ad_2]

Source link

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.