TRENDING
  • Linux
  • Shell Script
  • Cloud
  • DevOps
  • About US
SUBSCRIBE
  • CLOUD
  • DEVOPS
  • LINUX
  • SHELL SCRIPT
Reading: How to Setup Nagios Monitoring using AWS Cloud Formation on Ubuntu Instance
Share
TechBrownTechBrown
Aa
  • CLOUD
  • DEVOPS
  • LINUX
  • SHELL SCRIPT
Search
  • CLOUD
  • DEVOPS
  • LINUX
  • SHELL SCRIPT
Follow US
© 2014 - 2022 TechBrown. All Rights Reserved.
DevOps

How to Setup Nagios Monitoring using AWS Cloud Formation on Ubuntu Instance

March 21, 2022
Share
4 Min Read
SHARE
Contents
IntroductionPrerequisites:Step 1 – Login to AWS AccountStep 2 – Create Cloud Formation TemplateConclusion

In this guide, we will setup nagios monitoring server on Ubuntu. When monitoring comes in picture it plays vital role in maintaining infrastructure as well as application availability with 0% downtime. To provide better experience to end users with high availability monitoring plays very crucial role. We are here to guide you how to install nagios server on Ubuntu with few clicks.

Introduction

Nagios is a monitoring tool which is widely use for monitoring items of server like CPU, Memory and Hard disk to maintain the health of servers. It is also use for monitoring application components. Using nagios we can monitor our servers as well as application and recovers it quickly if something went wrong like application went down or server slowness issue due to high usage of CPU , Memory or Hard disk. To maintain health of servers and high availability of application nagios is best monitoring tool.

Prerequisites:

We required given prerequisites to proceed further:

  1. AWS Account Access
  2. Need EC2 and Cloud Formation service access to setup nagios.

Step 1 – Login to AWS Account

To go further first login to AWS account and check you have access to EC2 and Cloud Formation service.

Step 2 – Create Cloud Formation Template

First of all Create Cloud Formation Template Using any of the editor with .yml format. Copy below CFT file and paste it to any editor and save as .yml extension on your local machine.

---
AWSTemplateFormatVersion: '2010-09-09'
Description: Nagios Server Creation
Parameters:
LinuxAMI-ID:
Type: String
Subnet-ID:
Type: AWS::EC2::Subnet::Id
Security-Group:
Type: AWS::EC2::SecurityGroup::Id
Key-Name:
Type: String

Resources:
NagiosInstance:
Type: AWS::EC2::Instance
Properties:
ImageId: !Ref LinuxAMI-ID
InstanceType: t2.small
KeyName: !Ref Key-Name
Tags:
- Key: Name
Value: !Sub NAGIOS-Server
BlockDeviceMappings:
- DeviceName: /dev/sda1
Ebs:
VolumeType: gp2
VolumeSize: '30'
DeleteOnTermination: 'true'
NetworkInterfaces:
- AssociatePublicIpAddress: "true"
DeviceIndex: "0"
GroupSet:
- !Ref SecurityGroup
SubnetId: !Ref SubnetID
UserData:
Fn::Base64: 
!Sub |
#!/bin/bash
sudo apt update -y
sudo apt install -y autoconf bc gawk dc build-essential gcc libc6 make wget unzip apache2 php libapache2-mod-php libgd-dev libmcrypt-dev make libssl-dev snmp libnet-snmp-perl gettext
cd ~/
wget https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.6.tar.gz
tar -xf nagios-4.4.6.tar.gz
cd nagioscore-*/
sudo ./configure --with-httpd-conf=/etc/apache2/sites-enabled
sudo make all
sudo make install-groups-users
sudo usermod -a -G nagios www-data
sudo make install
sudo make install-daemoninit
sudo make install-commandmode
sudo make install-config
sudo make install-webconf
sudo a2enmod rewrite cgi
systemctl restart apache2
htpasswd -c -B -b /usr/local/nagios/etc/htpasswd.users nagiosadmin admin123
ufw allow Apache
ufw allow ssh
ufw enable
sudo apt install monitoring-plugins nagios-nrpe-plugin -y
cd /usr/local/nagios/etc
mkdir -p /usr/local/nagios/etc/servers
echo "cfg_dir=/usr/local/nagios/etc/servers" >> /usr/local/nagios/etc/nagios.cfg
cd /usr/local/nagios/share/
wget github.com/ynlamy/vautour-style/releases/latest/download/vautour_style.zip
echo "A" | unzip vautour_style.zip
cd 
systemctl start nagios
systemctl enable nagios
Outputs:
PublicIp:
Description: Nagios Server Public IP
Value: !GetAtt NagiosInstance.PublicIp
Export:
Name: Nagios-PublicIp
InstanceID:
Description: The Instance ID
Value: !Ref NagiosInstance
Export:
Name: Nagios-InstanceID

Conclusion

Nagios monitoring server has been successfully setup using AWS cloud formation template. You are ready to use nagios server for monitoring critical issue and recovers it quickly if something went wrong.

Sign Up For Newsletter

Be keep up! Get the latest articles delivered straight to your inbox.

Pranay Nimkar March 21, 2022
Share this Article
Facebook TwitterEmail Print
Share
Leave a comment Leave a comment

Leave a Reply Cancel reply

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

TRENDING

Linux

How to Play PS2 Games using PCSX2 on Ubuntu / Linux Mint

Linux

How to Fix cannot connect to local MySQL server through socket error on AlmaLinux / Rocky Linux

Linux

How to Install and Configure AskBot on Ubuntu / AlmaLinux / Rocky Linux

Linux

How to Configure Squid Proxy Server on AlmaLinux / Rocky Linux

Always Stay Up to Date

Subscribe to our newsletter to get our newest articles instantly!

Follow US on Social Media

Facebook Twitter Youtube Rss

© 2014 - 2022 Techbrown. All Rights Reserved.

  • About Us
  • Terms of Service
  • Cookie Policy
  • Privacy Policy
By using this site, you agree to the Privacy Policy, Cookie Policy and Terms of Service.
Accept

Removed from reading list

Undo
AdBlock Detected
Our site is an advertising supported site. Please whitelist to support our site.
Okay, I'll Whitelist
Welcome Back!

Sign in to your account

Lost your password?