Setting up Nagios Email Alerts
Nagios is an open source system and network monitoring application that watches specified hosts and services and alerts you when a monitored service changes state from normal to having an issue and when that issue is resolved. Click here (link opens an external website in a new browser tab/window) for more information about Nagios.
You may access the Nagios interface by navigating to http://<controller_ip>:8085/nagios/
, where <controller_ip>
is the IP address of the Controller host.
The default login credentials are:
-
Username:
nagiosadmin
-
Password:
nagiosadmin
To configure Nagios to send email alerts:
-
SSH into the Controller host and then execute the command
docker ps
to list the containers running on the Controller host.This command returns a tabulated list of all of the containers that are running on the Controller host.
- Search the
IMAGE
column of the tabulated list for the entry that includes the wordnagios
, and make note of theCONTAINER ID
for that container. - Execute the command
docker exec -it <container_id> /bin/bash
, where<container_id>
is the alphanumeric string listed in theCONTAINER ID
column for thenagios
container. - The
contacts.cfg
file contains the information needed to send Nagios alerts to groups and/or individual users. Edit this file by executing the commandvi /etc/nagios/objects/contacts.cfg
. In this file:- The
CONTACTS
section lists individual users who will receive email alerts. Within this section, eachdefine contact
block defines an individual user. - The
GROUPS
sections lists user groups who will receive email alerts.
- The
- Either:
- Add a new
define contact
block to add a new user who will receive Nagios email alerts. See The Define Contact Block, below. - Modify an existing
define contact
block to change an existing user who currently received Nagios email alerts. See The Define Contact Block, below.
- Add a new
- Execute the command
:x
to save your changes and exit the text editor. - Execute the command
supervisorctl restart nagios
to update Nagios with the changes you just made. - If needed, configure your email server to work with Nagios as described here (link opens an external website in a new browser tab/window).
This procedure updates the Nagios email configuration, and the specified user(s) will start receiving email alerts.
You may also see the Other Resources, below, for additional help configuring Nagios email alerts.
The Define Contact Block
Each defined contact block in the contacts.cfg
file appears as follows:
define contact {
contact_name <username> ;
use generic-contact ;
alias <full name of user> ;
email <email_address> ;
}
For example, if you have a user named Jane Doe, the defined contact block for her may look like this:
define contact {
contact_name Jane ;
use generic-contact ;
alias Jane Doe ;
email jane_doe@emailaddress.com ;
}
Other Resources
You may also view these external resources for additional information, if desired (links open external websites in anew browser tabs/windows):