# 13. Alertes par email

**Dans Pandora FMS, les alertes sont affectées à des modules spécifiques d'un agent.** Lorsque ledit module entre dans un état particulier, des actions peuvent être réalisées, telles que des notifications à un utilisateur particulier via la console Web :

[![pfms-first-steps-alerts_by_email-image-007.png](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/scaled-1680-/pfms-first-steps-alerts-by-email-image-007.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/pfms-first-steps-alerts-by-email-image-007.png)

La première alerte que nous allons créer consiste à envoyer un message par courrier électronique lorsque la connexion est perdue sur l'une des machines surveillées.

<p class="callout info">Les alertes dans Pandora FMS sont composées de trois éléments :</p>

1. **Commande** (envoyer un e-mail).
2. **Action** (envoyer un message à un utilisateur spécifique, en utilisant la commande précédente).
3. **Modèle** (exécuter une action déterminée lorsqu'une condition est remplie).

Dans ce cas précis, nous utiliserons une commande prédéfinie (envoi d'e-mails), nous modifierons une action existante (**Mail to Admin**) pour l'envoyer via une boîte mail spécifique et nous utiliserons un modèle déjà existant, le modèle **Critical condition**, qui déclenchera l'alerte lorsque le module en question passera en état critique.

Avec les alertes, nous pouvons faire bien d'autres choses, comme créer une escalade, créer nos propres commandes (pour réaliser des intégrations ou des notifications plus complexes), envoyer des avis de récupération et affecter des alertes en masse, mais nous verrons tout cela plus tard. *C'est un guide rapide, n'est-ce pas ?*

#### <span style="font-weight: 400;">Configuration de l'alerte d'envoi par e-mail  
</span>

<span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Pandora FMS inclut déjà un serveur d'envoi d'e-mails par défaut dont l'expéditeur est `yourmail@domain.es`. G</span>énéralement, ces envois sont classés comme SPAM par les destinataires. Pour <span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">changer l'adresse e-mail chargée d'envoyer les notifications</span> et le serveur qui les traite, nous devons accéder à la section **Management** → **Settings** → **System Settings** → **General Setup**. Dans l'un des onglets de configuration, vous trouverez la section **Alerts configuration** :

<span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">[![pfms-first-steps-alerts_by_email-image-010.png](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/scaled-1680-/pfms-first-steps-alerts-by-email-image-010.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/pfms-first-steps-alerts-by-email-image-010.png)</span>

<span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Si vous utilisez le serveur local (`127.0.0.1`), vous ne pourrez pas envoyer les messages correctement, car cela dépendra de la configuration de votre environnement. Pour plus d'informations, vous pouvez consulter [ce lien](https://pandorafms.com/manual/fr/documentation/pandorafms/management_and_operation/12_console_setup#ks1_1_7).</span>

<p class="callout info"><span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Pour éviter que les e-mails ne soient identifiés comme *spam*, nous vous recommandons d'utiliser une messagerie professionnelle (Gmail®, Proton®, etc.).</span></p>

<span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Pour pouvoir configurer le destinataire d'une alerte, il suffit de modifier l'action. L'action est **Mail to Admin** dans **Management** → **Actions** : </span>

<span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">[![pfms-first-steps-alerts_by_email-image-020.png](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/scaled-1680-/pfms-first-steps-alerts-by-email-image-020.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/pfms-first-steps-alerts-by-email-image-020.png)</span>

Modifiez l'action **Mail to Admin** (en cliquant sur son nom) et utilisez cet exemple comme référence :

[![pfms-first-steps-alerts_by_email-image-030.png](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/scaled-1680-/pfms-first-steps-alerts-by-email-image-030.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/pfms-first-steps-alerts-by-email-image-030.png)

<span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">On modifiera le champ 1 (**Destination address**) pour y mettre l'adresse e-mail de destination.</span>

<span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Dans le champ 2, on laissera le texte présent sur la capture. Ici, on utilise deux macros (`_agent_` et `_module_`) qui seront remplacées au moment de l'exécution par le nom de l'agent et du module ayant généré l'alerte.</span>

<p class="callout info"><span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Il existe près de quarante macros que vous pouvez utiliser pour obtenir des valeurs lors de l'exécution des alertes. [Consultez la documentation](https://pandorafms.com/manual/fr/documentation/pandorafms/management_and_operation/01_alerts#ks15).</span></p>

<span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Le Champ 3 pourra être utilisé pour rédiger le corps de l'e-mail, en HTML ou en texte brut :</span>

[![pfms-first-steps-alerts_by_email-image-040.png](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/scaled-1680-/pfms-first-steps-alerts-by-email-image-040.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/pfms-first-steps-alerts-by-email-image-040.png)

Bien que Pandora inclue un visualiseur HTML, nous vous recommandons, si vous rédigez des e-mails en HTML, de copier et coller le code ici.

[![pfms-first-steps-alerts_by_email-image-042.png](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/scaled-1680-/pfms-first-steps-alerts-by-email-image-042.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/pfms-first-steps-alerts-by-email-image-042.png)

Si vous n'avez pas modifié l'action par défaut, le modèle HTML de l'e-mail ressemblera à ceci. Vous pourrez le modifier plus tard, voyons maintenant comment les alertes sont affectées.

#### <span style="font-weight: 400;">Affectation de l'alerte à un module  
</span>

<span style="font-weight: 400;">Nous naviguons vers la vue d'édition d'un agent où nous souhaitons affecter une alerte à un module déjà défini, et nous cliquons sur l'onglet des alertes :</span>

<span style="font-weight: 400;">[![pfms-first-steps-alerts_by_email-image-050.png](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/scaled-1680-/pfms-first-steps-alerts-by-email-image-050.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/pfms-first-steps-alerts-by-email-image-050.png)</span>

<span style="font-weight: 400;">Maintenant, nous ajoutons le module (par exemple, Host Alive), le modèle (Critical Condition) et l'action que nous avons configurée à l'étape précédente (Mail to XXX). Nous ajoutons l'alerte :</span>

[![pfms-first-steps-alerts_by_email-image-060.png](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/scaled-1680-/pfms-first-steps-alerts-by-email-image-060.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/pfms-first-steps-alerts-by-email-image-060.png)

<span style="font-weight: 400;">Une fois ajoutée, nous pourrons l'observer dans la vue de l'agent en vérifiant si elle s'exécute ou non, en regardant la couleur de son état :</span>

[![pfms-first-steps-alerts_by_email-image-070.png](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/scaled-1680-/pfms-first-steps-alerts-by-email-image-070.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/pfms-first-steps-alerts-by-email-image-070.png)

<span style="font-weight: 400;">Nous pouvons attendre (ou forcer) l'arrêt de l'*hôte* pour voir si l'alerte fonctionne. Une méthode consiste à insérer directement une valeur zéro dans le module, qui est de type vrai/faux :</span>

<span style="font-weight: 400;">[![pfms-first-steps-alerts_by_email-image-090.png](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/scaled-1680-/pfms-first-steps-alerts-by-email-image-090.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/pfms-first-steps-alerts-by-email-image-090.png)</span>

<span style="font-weight: 400;">Un e-mail contenant l'alerte devrait arriver dans la boîte mail :</span>

[![pfms-first-steps-alerts_by_email-image-110.png](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/scaled-1680-/pfms-first-steps-alerts-by-email-image-110.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2026-03/pfms-first-steps-alerts-by-email-image-110.png)

<p class="callout info">Vous n'obtenez pas les résultats expliqués dans ce chapitre ? Accédez à la section d'[aide](https://pandorafms.com/guides/public/books/premiers-pas-avec-pandora-fms/page/21-ou-chercher-en-cas-de-probleme) ou de [support](https://pandorafms.com/guides/public/books/premiers-pas-avec-pandora-fms/page/22-assistance).</p>