[Day 3] 6. Nagios Setup
Pre-requisites:
-
Configure Hostname:
- Set the hostname as . To do the same follow these steps:
nag-server- open the file and change the name written to
/etc/hostname.nag-server - open the file and replace the name
/etc/hostswithdebianor create a new entry below that line as:nag-servershell127.0.1.1 nag-server ```
- open the
- Set the hostname as
-
Configure Static IP:
- Set a static IP for the server.
-
Network Connectivity:
- Ensure the server can ping both the local server and the internet.
-
Configure APT:
- Update the APT sources list in .
/etc/apt/sources.list - add
deb [trusted=1] http://sunbeam.shuharilabs.com/sw/repo/deb12/ bookworm main
- Update the APT sources list in
-
Install sudo:
-
Install
by switching to the root user and running:sudobashapt install sudo
-
-
Set Time Zone:
-
Set the time zone using the following command:
bashsudo dpkg-reconfigure tzdatathen select
and thenAsia.Kolkata
-
Install Nagios Core:
-
Install Pre-requisites / Dependencies:
-
Install required packages using the following command:
bashsudo apt-get install -y apache2 apache2-utils autoconf gcc libc6 libgd-dev make php python3 tree unzip wget libkrb5-dev openssl libssl-dev
-
-
Download and Extract Nagios Source Code:
-
Download Nagios and extract it:
shellwget http://192.168.0.52/sw/security_tools/nagios/nagios-4.5.0.tar.gz tar -zxf nagios-4.5.0.tar.gz cd nagios-4.5.0
-
-
Configure Nagios:
-
Navigate to the
directory and configure Nagios:nagios-4.5.0bashsudo ./configure --with-httpd-conf=/etc/apache2/sites-enabled/
-
-
Compile and Install Nagios:
-
Run the following command to compile Nagios:
bashsudo make all
-
Create Nagios User and Group:
-
Create User and Group for Nagios:
-
Run the following command in the
directory:nagios-4.5.0bashsudo make install-groups-users
-
-
Add Apache User to Nagios Group:
-
Ensure that the Apache user can access Nagios:
bashsudo usermod -aG nagios www-data
-
-
Change Nagios User Password:
-
Set a password for the Nagios user:
bashsudo passwd nagios
-
-
Install Nagios Executable:
-
Run the following command to install the Nagios executable:
bashsudo make install -
The Nagios binary will be located in
./usr/local/nagios/bin
-
-
Enable Nagios Service to Start Automatically:
-
Ensure Nagios starts automatically after the system boots:
bashsudo make install-daemoninit
-
-
Enable Command Mode for Nagios:
-
Allow Nagios to execute commands:
bashsudo make install-commandmode
-
-
Install Nagios Configuration Files:
-
If there is no
folder in Nagios, run the following command to install the configuration:/etcbashsudo make install-config
-
-
Install Web Configuration:
-
Install the web configuration for Nagios:
bashsudo make install-webconf
-
Configure Apache for Nagios:
-
Enable Apache Modules:
-
Enable the
andrewritemodules:cgibashsudo a2enmod rewrite sudo a2enmod cgi
-
-
Set Up Authentication:
-
Set up password authentication for the Nagios web interface:
bashsudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
-
-
Verify Configuration:
-
Verify the Nagios configuration:
bashsudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfghere we are calling the
and asking it to check thenagiosfile.nagios.conf
-
Enable and Start Services:
-
Enable Apache and Nagios Services:
-
Enable and start both Apache and Nagios:
bashsudo systemctl enable --now apache2 nagios
-
-
Check the Status of Services:
-
Verify the status of Apache:
bashsudo systemctl status apache2 -
Restart and verify the status of Nagios:
bashsudo systemctl status nagios
-
Access Nagios Web Interface:
-
Open a browser on your host machine and visit the following URL to access the Nagios web interface:
<your_ip>/nagios
Read Next
[Day 3] 7. Installing the Nagios Plugins
### **1. Install Dependencies for Plugins** Run the following command to install the required dependencies for Nagios plugins: ```bash sudo apt...
[Day 3] 8. PKI Lab (Encryption and Decryption)
#### **Prerequisite** - A **Windows Machine** (any edition except Windows Home). - Familiarity with the **Encrypting File System (EFS)** by Micros...