Adding an Alert in the Face of an Issue
At Pandora FMS the most basic way in which to create alerts is assigning an alert to a specific module.
Introduction
Of course, more advanced tasks can be carried out, such as alerts on events, correlation, etc. The first alert to create is sending an email when one of the monitored machines goes offline (with the Host alive module).
Pandora FMS alerts are made up by three elements:
- Command.
- Action.
- Template.
In this particular case, a predefined command will be used (email forwardingt), an existing action will be modified (Mail to XXX
) and an existing template will also be used, template Critical condition, that will execute the task when the module itself goes into critical state.
See also: "How Pandora FMS alert system works (video)"
Server Setup
For the correct functioning of the email
command, it is necessary to configure in pandora_server.conf
file a mail server that allows to make relay.
In the example, the mail server located in our localhost
through Postfix. You should enter the IP address of the local mail server, or one in Internet (configuring its authentication).
To modify the server configuration file, you must access it, located at /etc/pandora/pandora_server.conf
as root user by elevating your privileges using the sudo su
command. You are the only responsible for this key.
To edit this configuration file in this example, the vim program is used. More information can be found in the video tutorial "Editing files with VIM".
Find the lines you see in the screenshot below and set those values. If you do not have a mail server, you may use for example a Gmail® account. You may see a quick guide on how to configure Pandora FMS server to work with a Gmail® account in the following link: Configuring email alerts.
The lines that begin with the character #
are comments and are not taken into account by the server.
Once the changes are made, click ESC and :wq
to save the changes and exit. Once you are in the command line, restart Pandora FMS server:
/etc/init.d/pandora_server restart
Alert Setup
As indicated before, alerts in Pandora FMS are made up by 3 parts: Command, Action and Template. You may find these options in the Alerts section. In order to configure this alert just modify the action, so the Alert actions option will be used.
The section to be used is that of Mail to admin, click on said name to edit the alert action.
Modify Field 1 and enter your email address, in this example [email protected] is used. Field 2 will leave the text in the screenshot. Here two macros are used, which will replace at run time the name of the agent and the module that generated the alert.
Assigning an Alert to a Module
Now add the module (Host Alive), the template (Critical Condition) and the action (Mail to admin). Click Add alert.
Once added, you may see in the agent view whether it is running or not, by taking a look at is state color:
When the host goes offline the alert will fire:
An email should be received, something similar to this one:
Pandora FMS alerts are extremely flexible and, therefore sometimes complex to use. There is a specific chapter for those in the documentation: Alerts in Pandora FMS.