I need the ability to monitor my Atmail installation.
- On-Premise Server + WebMail Installations: Version 6.0 > Current Version
- Webmail Only Installations: Version 6.0 > Current Version
- No monitoring of my Atmail installation
One of the many challenges with having a mailserver is keeping everything running. Problems can occur unexpectedly, and this may affect your service continuity for your end-users.
In Atmail, we use many monitoring and maintenance tools so that we may keep an eye on everything. One of these tools is Nagios.
Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes. It provides you with instant awareness of your organization's mission-critical IT infrastructure. Nagios allows you to detect and repair problems and mitigate future issues before they affect end-users and customers.
At the base level, Nagios can send you reports of any issues with your services as they occur. This document aims to provide a basic example of how to install, setup, and use Nagios for your own Atmail (or third-party) systems.
This installation documentation focuses on installing Nagios on a CentOS/Fedora operating system, or a close derivative. RPM or binary packages may exist for your own system. This document details a source installation, from the raw tar files.
Before installing Nagios, make sure you have the following packages:
- GCC compiler
- GD development libraries
Downloading and Installing Nagios
Create the nagios user:
Create a directory for storing the downloads.
Download the source code tarballs of both Nagios and the Nagios plugins (visit http://www.nagios.org/download/ for links to the latest versions). These directions were tested with Nagios 3.1.1 and Nagios Plugins 2.0.3.
Unpack the Nagios package:
Run the Nagios configure script, passing the name of the group you created earlier like so:
Compile the Nagios source code.
Install binaries, init script, sample config files and set permissions on the external command directory.
Install the Nagios web config file in the Apache conf.d directory.
Create a nagiosadmin account for logging into the Nagios web interface. This command will prompt you for a password that you can use to login to Nagios from the web.
Restart Apache to make the new settings take effect.
Unpack the Nagios plugins:
Compile and install the plugins.
Add Nagios to the list of system services and have it automatically start when the system boots.
Verify the sample Nagios configuration files.
If there are no errors, start Nagios.
You can now open your main Nagios configuration file. This is in /usr/local/nagios/etc/nagios.cfg. At the top, append your local configuration file. For the purposes of this document, we will put it in /usr/local/nagios/etc/objects/atmail.cfg.
You can copy a template that comes by default called localhost.cfg:
In the file, you can now put your hostnames. Let's assume that your server is in 192.168.0.6 , with the hostname atmail.local:
This will be the template that will be used during service checks. host_name points to your server's hostname. alias is what it will be referred to in the logs and in the web interface. address will contain the IP of your server.
You can now define the services that you want to monitor. The service definition part of the configuration file is marked as such:
Below this, you can set the services to monitor. The service checks rely on Nagios' plugins that are executed via another template called commands.cfg. For example, a service check that verifies that your HTTP server is running would look like:
The use flag sets the template. The host_name flag sets which host you want to check. The service_description flag sets what it shows up as in the logs and web interface. Finally, the check_command flag defines the check used to verify the service. In this case, we're checking atmail.local if the HTTP (Port 80) service is still active.
Conversely, an IMAP check would look like:
A complete service check block for IMAP, SMTP, POP, and HTTP would look like:
Now, you can define the contacts where emails will be sent to, in case something goes wrong. Open up /usr/local/nagios/etc/objects/contacts.cfg, and define your first contact. It will look like:
contact_name refers to the name it will be referenced to in the configure file. use defines the template to use. alias refers to what the contact will be referred to in the configuration files. email refers to the email where service notifications will be set.
Now you're ready! Restart Nagios to apply changes:
Example Configuration Files
To get you started, your Nagios configuration can look like this: