Configuration of email alerts
We are working on the translation of the Pandora FMS documentation. Sorry for any inconvenience.
Quick email configuration guide for alerts in Pandora FMS
Email configuration with Gmail account
In order for the Pandora server to be able to send alerts via Gmail account email, we need to have Pandora and Postfix configured as follows:
Pandora Settings
To correctly configure email with a Gmail account in the Pandora server configuration file (/etc/pandora/pandora_server.conf) all the fields must be commented out except the mta_address that we will configure with localhost or the ip of the server where the postfix server is installed.
If we have Postfix installed on the same server as Pandora, the configuration in pandora_server.conf would be this:
mta_address localhost #mta_port 25 #mta_user [email protected] #mta_pass mypassword #mta_auth LOGIN #mta_from Pandora FMS <[email protected]>
Below is a small summary of the configuration of an alert in the Pandora console.
Action Settings
To configure the mail recipient we use the Mail to XXX action to add a mail recipient to which all alert emails will be sent.
Alert Settings
In this case, a new alert with the module that can be seen in the screenshot has been generated in the module > Alerts configuration.
Once the alert is triggered, we can see how it will reach the email chosen in the action:
Postfix installation
The following packages must be installed on the Pandora server for the correct functioning of the postfix server together with a GMAIL account.
yum install postfix mailx cyrus-sasl-plain cyrus-sasl cyrus-sasl-lib cyrus-sasl-md5 cyrus-sasl-scram cyrus-sasl-gssapi
Postfix Configuration
Assuming that you already have Postfix installed on your server and that everything works fine except sending mail via gmail, you'll need to follow these steps:
1– Check that the “less secure pass” option is enabled in the Gmail account. To do this, you can enable it in this link. (https://myaccount.google.com/lesssecureapps)
2– Edit the file /etc/postfix/main.cf and add the following lines at the end of the file:
myhostname = <hostname> #Add server hostname here relayhost = [smtp.gmail.com]:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_tls_policy_maps = hash:/etc/postfix/tls_policy smtp_sasl_security_options = noanonymous smtp_use_tls = yes smtp_tls_CAfile = /etc/pki/tls/cert.pem smtp_tls_security_level = encrypt
3– Create the file /etc/postfix/sasl_passwd with your gmail address and password.
nano /etc/postfix/sasl_passwd
Add the following line to the file with your gmail address and password:
[smtp.gmail.com]:587 [email protected]:PASSWORD
Protect it properly:
chmod 600 /etc/postfix/sasl_passwd chown root:root/etc/postfix/sasl_passwd
4– Create the file /etc/postfix/tls_policy with the following information:
nano /etc/postfix/tls_policy
[smtp.gmail.com]:587 encrypt
Protect it properly:
chmod 600 /etc/postfix/tls_policy chown root:root/etc/postfix/tls_policy
5– Transform /etc/postfix/sasl_passwd and /etc/postfix/tls_policy to a hash type indexed file using the command:
postmap /etc/postfix/sasl_passwd && postmap /etc/postfix/tls_policy
Which will create the file /etc/postfix/sasl_passwd.db and /etc/postfix/tls_policy.db
6– Finally, restart postfix to apply the changes, like this:
/etc/init.d/postfix restart
7– You can check the operation by opening two consoles. In one, the following command will be executed to monitor the behavior of the mail:
tail -f /var/log/maillog
And in the other an email will be sent:
echo "Test mail" | email [email protected]
If the previous steps were successful, the other console should see something like this:
Dec 18 18:33:40 OKComputer postfix/pickup[10945]: 75D4A243BD: uid=0 from= Dec 18 18:33:40 OKComputer postfix/cleanup[10951]: 75D4A243BD: message-id= Dec 18 18:33:40 OKComputer postfix/qmgr[10946]: 75D4A243BD: from=, size=403, nrcpt=1 (queue active) Dec 18 18:33:44 OKComputer postfix/smtp[10953]: 75D4A243BD: [email protected], relay=smtp.gmail.com[74.125.93.109]:587, delay=3.7, delays=0.15/0.14/ 1.8/1.6, dsn=2.0.0, status=sent (250 2.0.0 OK 1324249500 eb5sm36008464qab.10) Dec 18 18:33:44 OKComputer postfix/qmgr[10946]: 75D4A243BD: removed
If the result is the above, Pandora will point to the Postfix server to send the emails and they will be sent without problems.