Good old nagios! Nagios is a great Open Source Monitoring Server that monitors your servers and services/applications that is hosted on top of them, and has the ability to notify in the event when they go down.
I’ve been using Nagios for the last 7 years and worked for 3 business that chose Nagios as their preferred server monitoring solution.
All Nagios related posts are grouped under the #nagios category.
What we are doing today
Today we will setup a Nagios server and its plugins. The plugins helps to check different endpoints, such as custom tcp checks, ssh, snmp etc.
In this nagios tutorial series, I will publish a couple of post which will include:
- Setup the Nagios Server and its Plugins - this post
- Setup the NRPE Server and NRPE Client Server (this is nice for local ports or custom checks)
- Setup Nagiosgraph (Graph performance data and add it as extra host configuration)
- Setup a custom Bash and Python Nagios Plugin for Custom Checks
- Setup a Telegram / Slack Plugin
Installing Dependencies:
Go ahead and install all the dependencies needed by nagios and add the nagios user and group:
1 2 3 4 5 6 7 8 |
|
Install Nagios
Download the nagios tarball from their website, have a look at https://www.nagios.org/downloads/ for the latest version.
1
|
|
Extract the archive:
1 2 |
|
Configure with nagios user and nagcmd group, install and change the ownership of the generated data:
1 2 3 4 5 6 7 8 |
|
Install Nagios Plugins
Get the nagios plugins tarball, extract and install:
1 2 3 4 5 6 |
|
Access Nagios
Enable apache modules:
1 2 |
|
Setup basic auth for logging onto nagios:
1
|
|
Setup a symlink for apache’s nagios configuration
The configuration for the above will look more or less like the following:
1 2 3 4 5 6 7 8 9 |
|
Create the systemd unit file for nagios /etc/systemd/system/nagios.service
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Reload the daemon:
1
|
|
Enable the service:
1
|
|
Ensure nagios is started:
1 2 |
|
Access nagios on http://nagios-ip/nagios with the credentials that you configured earlier.
Up Next
In the next posts I will cover the following:
- Setup NagiosGraph for monitoring performance data
- Show you how to create a custom nagios plugin in python
- Create a Custom Notification service to send notifications to Telegram (or any API)