Skip to main content

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: Command (send an email), Action (send an email to a specific user, using the previous command) and Template (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 execute 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 the 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 name of the action to add the configuration. Follow the menu "Alerts -> Actions".

pfms-open-management-alerts-actions.png

Edit "Mail to" action and use this example as a reference:

11-1.png

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 can 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:

11-2.png

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:

11-3.png

If you have not changed the default action, the HTML template of the mail will be similar to this one. You can modify it later, now let us see how alerts are assigned.

Assigning an alert to a module

Go to the agent edition view where you wish to assign an alert to an already defined module and click on the alert tab:

11-7.png

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:

11-5.png

Once added, you may see it in the agent view, checking whether it is executed or not, seeing the color of its state:

11-6.png

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):

11-4.png

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:

11-8.png

Are you not achieving the expected results? Go to help or support sections.