13. Email Alert
In Pandora FMS, alerts are assigned to specific agent modules. There are more advanced tasks (alerts on events, correlation, etc.) but those are not included in this guide. The first alert is just sending an email when one of the machines that are already being monitored (from the previous step) is down.
Pandora FMS alerts are made up by three elements: Commands (send an email), Actions (send an email to a specific user, using the previous command) and Templates (execute a specific action when a certain term is met).
In this specific case, we are going to use a predefined command (send emails), we are going to modify an existing action (Mail to XXX) to send it to an specific email and we are going to use an already existing template, the template ''Critical condition'', which will run the alert when the module goes into critical.
With the alerts you may do many more things, such as creating a scaling, creating your own commands (to make more complex integrations or notifications), sending recovery warnings, setting correlations and mass assigning alerts, but that is for another type of guide.
Configuring email alerts
Pandora FMS already contains in its installation a server to send emails, whose default sender is [email protected]. Although generally these are classified as SPAM by any receiver. In case you want to change the email address in charge of sending notifications, and the server that processes them, go to the console, to section Setup > Setup > General Setup. At the bottom of the configuration page you will find the Mail configuration section.
If you use the local server (127.0.0.1) you may not be able to send emails correctly, as the configuration of your environment will depend on it. If you need more information, click here.
To prevent emails from being classified as spam, we recommend that you use a corporate email (exchange, gmail, etc).
To be able to configure the recipient of an alert, modify the action. The action is "Mail to XXX" in Alerts > Actions.
Click on the action name to add the configuration. Follow the menuĀ "Alerts -> Actions".
Edit "Mail to" action and use this example as a reference:
Field 1 (Destination address) will be modified and the destination email address must be added.
In field 2 enter the text from the screenshot. Here two macros are used (_agent_ and _module_) and they will replace at run time the agent name and the module generated by the alert.
There are about forty macros that you may use to obtain values at the time of executing alerts. Read the documentation.
Field 3 could be used to shape the email, in HTML or plain text:
Although Pandora FMS includes an HTML viewer, we recommend that if you are going to write emails in HTML, copy and paste the code here:
If you did not change the default action, the HTML template of the mail will be similar to this one. You may modify it later, now let us see how alerts are assigned.
Assigning an alert to a module
Now add the module (for example, Host Alive), the template (Critical Condition) and the action that you configured in the previous step (Mail to XXX). Add the alert:
Once added, you may see it in the agent view, checking whether it is executed or not, seeing the color of its state:
You may wait or force the host to fail to see if the alert works, or you may "force the alert" to see if the mail is actually sent. Click on the force icon (see image):
An email with the alert should be sent to the mailbox. As it is a "forced" alert, in the data field it says N/A. In real fife it would show the real module value, like this one:
Did you not achieve the expected results? Go to help orĀ support sections.