Continuous Monitoring
What is Continuous Monitoring?
Continuous Monitoring is the process and technology used to detectcompliance and risk issues associated with an organization’sfinancial and operational environment. The financial and operationalenvironment consists of people, processes, and systems workingtogether to support efficient and effective operations.
Continuous Monitoring refers to the process and technology requiredto incorporate monitoring across each phase in DevOps and IToperation lifecycles. It helps to continuously ensure the healthperformance, and reliability of your application and infrastructureas it moves from development to production.
Why we need Continuous Monitoring?
Continuous Monitoring assists IT organizations, DevOps teams inparticular, with procuring real-time data from public environments.It also helps general feedback on the overall IT setup, includingoffsite network and deployed software.
What Are Continuous Monitoring Tools?
- Lansweeper
- Spiceworks
- Snort
- SolarWinds
- Nagios
- Tenable
- Ipswich WhatsUp Gold
- Paessler PRTG
- Rapid7 Insight
- Cisco Identity Service Engine
Let us Discuss Nagios
What is Nagios?
Nagios is used for continuous monitoring of system applications,services, and business processes, etc in a DevOps culture. Nagiosruns on a server, usually as a daemon or a service. It periodicallyruns plugins residing on the same server, contact hosts or serverson your network or the internet.
Nagios is used as an infrastructure monitoring tool. Nagios is themost powerful infrastructure monitoring. Nagios was first launchedon March 14, 1999, and formerly known as Netsaint.
How Nagios Works?
Nagios is an open-source computer software application which monitorscomputer systems, network and entire IT infrastructure. It wasdesigned to run on the Linux operating system and can monitordevices running Linux, Windows, and Unix operating systems. Nagiossoftware runs periodic checks on critical parameters ofapplications, network and server resources.
For the Nagios, we have to install Nagios server in any of one serverwe have install Nagios. And rest of all how many servers we have tomonitor through the Nagios we have to install into that has an NRP.
Nagios act as apparent and NRP act as a child. Through Nagios itsmonitors all the child servers.
What is the Purpose of Nagios?
Nagios offers to monitor and altering services for servers, switches,applications, and services. It alerts users when the thing goeswrong and alerts them a second time when the problem has beenresolved.
From 2018 companies reportedly use Nagios in their tech stacks,including Uber, Twitch, and Dropbox.
Nagios Structure?
A user can choose to work in a command-line interface (CLI) or selecta web based graphical user interface (GUI) in some versions ofNagios and from third parties. Nagios dashboard provides an overviewof the critical parameters monitored assets.
Based on the parameters and thresholds defined, Nagios can send outalerts if critical is reached. These notifications can be sent indifferent ways, including email and text messages.
Nagios Installation on Ubuntu
Nagios installation has been divided into three parts.
- Installing Nagios on Master
- Installing NRPE on slave
- Installing Check NRPE Plugin on Master
Green Terminal is Master, Yellow Terminal is Slave machine.
Install Nagios on Master
Step 1: Update the master.
The Command is sudo apt-get update
Output Is:
Step 2: Run the following command
sudo apt-get install wget build-essential unzip openssllibssl-dev
Output Is:
Step 3: Run the following command
sudo apt-get install apache2 php libapache2-mod-php php-gdlibgd-dev
Output Is:
Step 4: Now, add the user with the commands givenbelow.
sudo adduser nagios
In this command, it asks to enter a password. Give whatever passwordyou want. It helps to view the Nagios on the web-page.
In the above image add Full Name as your wish. And remaininginformation as same.
Step 5: Run the following commands to complete theuser adding process.
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd www-data
Output Is:
Step 6: Now that we are set with the prerequisites,install Nagios Core as shown below.
wgethttps://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.2.tar.gz
Output Is:
Step 7: Untar the file with the command shown below.
tar xzf nagios-4.4.2.tar.gz
Step 8: Enter the Nagios-4.4.2 directory.
The Command is cd nagios-4.4.2
Output Is:
Step 9: Now with the given command make the requiredconfigurations.
sudo ./configure –with-command-group=nagcm
Output Is:
Now we will make all the configuration work.
Step 10:
sudo make all
Output Is:
Step 11: Run the following command.
sudo make install
Output Is:
Step 12: Install init and run the following command.
sudo make install-init
Output Is:
Step 13: Install config and run the followingcommand.
sudo make install-config
Output Is:
Step 14: Install command mode as shown below:
sudo make install-commandmode
Output Is:
Step 15: Before moving ahead run the followingcommands to copy eventhandlers scripts under the libexec directory.
sudo cp -R contrib/eventhandlers//usr/local/nagios/libexec/
sudo chown -R nagios:nagios/usr/local/nagios/libexec/eventhandlers
Output Is:
Step 16: Create Apache configuration on the nano.
sudo nano /etc/apache2/conf-available/nagios.conf
ScriptAlias /nagios/cgi-bin “/usr/local/nagios/sbin”
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName “Restricted Area”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Alias /nagios “/usr/local/nagios/share”
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName “Restricted Area”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Copy the file and past it on nano editor
Output Is:
Save the file and exit from the nano editor.
Step 17: Add a password as shown below, to completethe apache configuration. The same password which you gave first.
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.usersnagiosadmin
Output Is:
Step 18: Enable Apache configuration.
sudo a2enconf nagios
Output Is:
sudo a2enmod cgi rewrite
Output Is:
Step 19: Restart apache service.
sudo service apache2 restart
Output Is:
Step 20: Now go to the main directory.
Cd
Output Is:
Step 21: To install the required Nagios plugin,download the plugins.
wgethttps://www.nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
Output Is:
Step 22: Untar the file.
tar xzf nagios-plugins-2.2.1.tar.gz
Output Is:
Step 23: Go inside Nagios-2.2.1 directory.
cd nagios-plugins-2.2.1
Output Is:
Step 24: Compile the plugins and then complete theplugin installation process running the three commands given below:
sudo ./configure –with-nagios-user=nagios–with-nagios-group=nagios –with-openssl
Output Is:
sudo make
Output Is:
sudo make install
Output Is:
Before we can start using Nagios, we going to need to make a smallchange in the base configurations.
Step 25: Go to the main directory.
cd
Output Is:
Step 26: Get inside /usr/local/nagios/etc/nagios.cfg
sudo nano /usr/local/nagios/etc/nagios.cfg
Scroll down until you will see.#cfg_dir=/usr/local/nagios/etc/servers
Remove # from#cfg_dir=/usr/local/nagios/etc/servers
Output Is:
Save and exit the file.
Step 27: Make the following directory.
sudo mkdir /usr/local/nagios/etc/servers
Output Is:
Step 28: Verify the configuration before startingNagios.
sudo /usr/local/nagios/bin/nagios -v/usr/local/nagios/etc/nagios.cfg
Output Is:
Here we can see there are no warnings and no errors. Everything looksfine!
Step 29: Start Nagios.
sudo service nagios start
Output Is:
sudo systemctl enable nagios
Output Is:
Installing NRPE on Slave
In the slave machine, we are adding a host in Nagios.
Installing NRPE on the slave
Step 1: Update the slave machine
sudo apt-get update
Output Is:
Step 2: Install the required plugins.
sudo apt-get install nagios-nrpe-servernagios-plugins
Output Is:
Step 3: Open the configuration file as shown below:
sudo nano /etc/nagios/nrpe.cfg
In the file allowed_hosts=127.0.0.1,xxx toallowed_hosts=127.0.0.1, master IP.
After made changes save and exit the file.
Output Is:
Step 4: Start NRPE service as shown below:
sudo /etc/init.d/nagios-nrpe-server restart
Output Is: