Installation Nagios on Ubuntu

Ankita LunawatAnkita Lunawat
2 min read

Nagios is a powerful open-source monitoring tool that allows you to monitor your network and systems. Here's a basic guide on how to install Nagios on Ubuntu:

Prerequisites

  • An Ubuntu server

  • A user with sudo privileges

  • Basic understanding of the command line

Install Nagios dependency packages

Update your package list and install the necessary dependencies.

sudo apt update
sudo apt install -y build-essential libgd-dev openssl libssl-dev unzip apache2 php libapache2-mod-php php-gd

Create a Nagios user and group

Create a user and group for Nagios.

sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd www-data

Download and compile Nagios by obtaining the source files and building them on your system.

Download and extract the latest Nagios Core release.

wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.5.8.tar.gz
tar xzf nagios-4.5.8.tar.gz
cd nagios-4.5.8

Configure and compile Nagios by running the necessary commands.

./configure --with-nagios-group=nagios --with-command-group=nagcmd
make all

Install Nagios by updating your package list, installing dependencies, creating a user and group, downloading the latest release, and compiling it.

Install Nagios binaries, init scripts, and command mode.

sudo make install
sudo make install-init
sudo make install-commandmode
sudo make install-config
sudo make install-webconf

To install Nagios plugins, download the plugin package, extract it, configure it, and then compile and install it.

Download and install Nagios plugins

wget https://nagios-plugins.org/download/nagios-plugins-2.4.9.tar.gz
tar xzf nagios-plugins-2.4.9.tar.gz
cd nagios-plugins-2.4.9
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
sudo make install

Set up Apache on Ubuntu

Enable Apache modules and restart the service.

sudo a2enmod rewrite
sudo a2enmod cgi
sudo systemctl restart apache2

Set up the Nagios web interface on Ubuntu.

Create a Nagios admin user for the web interface.

sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Start the Nagios service on Ubuntu

Start and enable the Nagios service.

sudo systemctl start nagios
sudo systemctl enable nagios

Access the Nagios web interface on Ubuntu

Open your web browser, go to http://<IP of Instance>/nagios, and log in with the username nagiosadmin and the password you set earlier.

You can monitor using the console.

0
Subscribe to my newsletter

Read articles from Ankita Lunawat directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ankita Lunawat
Ankita Lunawat

Hi there! I'm a passionate AWS DevOps Engineer with 2+ years of experience in building and managing scalable, reliable, and secure cloud infrastructure. I'm excited to share my knowledge and insights through this blog. Here, you'll find articles on: AWS Services: Deep dives into core AWS services like EC2, S3, Lambda, and more. DevOps Practices: Best practices for CI/CD, infrastructure as code, and automation. Security: Tips and tricks for securing your AWS environments. Serverless Computing: Building and deploying serverless applications. Troubleshooting: Common issues and solutions in AWS. I'm always eager to learn and grow, and I hope this blog can be a valuable resource for fellow DevOps enthusiasts. Feel free to connect with me on [LinkedIn/Twitter] or leave a comment below!