🕹ī¸Install Nagios For Monitoring With a New EC2 Instance

Introduction

What is Nagios

Nagios is an open network monitoring system and application - sources created by Ethan Galstad. Nagios monitors hosts and predetermined service, and displays a warning when something bad happened to the Server – like the server went down. Nagios runs on the Linux operating system.

Nagios NMS Function

  1. Host and Services Monitoring: Nagios can be used to monitor in real-time the status of a host (physical server or machine virtual) and services such as HTTP, SSH, SMTP, POP3 and others using plugins.

  2. Notifications and Alerting: Customizable alerting and various notification delivery methods via email, SMS, and Other channels allow you to get information when problems occur.

  3. Web Interface: Nagios provides a user-friendly web interface for configuration and monitoring.

  4. Plugins Architecture: Allows you to carry out monitoring that adapts to a variety of applications IT architecture using plugins.

Advantages of NMS Nagios

  1. Nagios is open source, which means it can be used for free.

  2. Using a web interface, so it can be accessed easily and remotely from any location other.

  3. Apart from monitoring network services (HTTP, FTP, etc.), Nagios can also monitor hosts resources (disk usage, memory usage, processes, log files, etc.)

  4. Has a reporting feature via a web interface.

  5. It has lots of plugins, so it adds more Nagios features complete compared to other NMS.

  6. Supports the use of Google Maps.

  7. Has a Schedule downtime feature, which is very necessary when the server is on maintenance or upgrade.

Disadvantages of Nagios NMS

  • The learning curve is steep, learning to install and configure Nagios requires some effort (effort) and higher knowledge, compared to other monitoring tools. Lots of it The available configuration options and plugins can be confusing for beginners.

  • Resource consumption, running many active checks will consume resources systems, especially in large environments. Proper resource management it is very important to ensure Nagios operates smoothly.

  • Web Interface Limitations, Although the Nagios web interface is easy to use most tasks, some complex configurations may still require editing configuration file directly. This may be a challenge for users who inexperienced.

  • Not able to generate history reports of bandwidth usage.


Installation

Create New Security Group

Name    : SG-NMS-Nagios
VPC     : VPC-Jakarta
Inbound Rules :
    - SSH      | Custom : SG-BastionHost
    - HTTP     | Anywhere (IPv4)   |
    - HTTPS    | Anywhere (IPv4)   |
Outbound Rules :
    - All Trafic | Any Where (IPv4)

Edit Security Group (WebServer&Database)

add a new inbound rules

SG-WebServer

Name : SG-WebServer
VPC : VPC-Jakarta
Inbound Rules :
    - SSH | Custom : SG-BastionHost
    - HTTP | Any Where (IPv4)
    - HTTPS | Any Where (IPv4)
    - All Trafic | Custom : SG-NMS-Nagios
Outbound Rules : 
    - All Trafic | Any Where (IPv4)

Database

Name : SG-DBServer
VPC : VPC-Jakarta
Inbound Rules :
    - SSH | Custom : SG-BastionHost
    - HTTP | Any Where (IPv4)
    - HTTPS | Any Where (IPv4)
    - All Trafic | Custom : SG-NMS-Nagios
Outbound Rules : 
    - All Trafic | Any Where (IPv4)

Create New EC2

#Nagios#
Name & Tag : NMS-Nagios
OS : Debian 12
Instance type : t2.micro
Key pair : vockey (.pem)
Network Setting : klik Edit
	VPC = VPC-Jakarta
	Subnet = pub-subnet-jakarta
	Auto-assign public IP : enable
	Security Group : SG-NMS-Nagios
Storage / EBS : 10GB

InstanceIP PublicIP Private

Bastion Host

34.207.160.104

10.10.1.7

Web Server

54.166.19.96

10.10.1.141

DBInstance

-

10.10.2.196

NMS-Nagios

3.89.232.111

10.10.1.229

Configuration

SSH to NMS-Nagios

cd Downloads/
ssh-agent bash
ssh-add labsuser.pem
ssh -A -i labsuser ubuntu@<ip-addr-pub-bastion>
ssh admin@<ip-addr-priv-nagios>

Installation

##Install pre-requisites##
apt update
apt-get install -y autoconf automake gcc libc6 libmcrypt-dev make libssl-dev wget unzip bc gawk dc build-essential snmp libnet-snmp-perl gettext libmariadb-dev apache2 php libapache2-mod-php8.2 fping libgd-dev openssl libgd-dev 

##Download the source##
cd /tmp
wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.14.tar.gz
tar xzf nagioscore.tar.gz

##Compile##
cd /tmp/nagioscore-nagios-4.4.14/
./configure --with-httpd-conf=/etc/apache2/sites-enabled
make all

##Create user and group##
##user www-data is added to the Nagios group##
make install-groups-users
usermod -a -G nagios www-data

##Install binary##
##in this step the binary files, OGIs, and HTML are installed.##
make install

##Install service / daemon##
make install-daemoninit

##Install command mode##
make install-commandmode

##Install configuration files##
make install-config

##Install apache config files##
make install-webconf
a2enmod rewrite
a2enmod cgi
systemctl restart apache2

##Create a nagiosadmin user##
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
##password : nagiosadmin##

##Start service web server apache2##
systemctl restart apache2.service

##Start service / daemon nagios##
systemctl start apache2
systemctl start nagios.service

Configuration is Completed

Open Browser

http://<ip-addr-pub-nagios>/nagios

username : nagiosadmin
password : nagiosadmin

Last updated