Files
scripts-bash/servers/linux/monitoring/conf/alert-engine.conf.php
2026-03-17 08:14:39 +01:00

80 lines
2.9 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Configuration Alert Engine
* Copyright (C) 2026 Cédric Abonnel
* License: GNU Affero General Public License v3
* NE PAS ÉDITER - Utilisez alert-engine.local.conf.php pour vos surcharges
* RISQUE D'ECRASEMENT - RISQUE D'EFFACEMENT
*/
// On définit les variables de base (équivalent de l'environnement)
$monitoring_state_dir = getenv('MONITORING_STATE_DIR') ?: '/var/lib/monitoring';
return [
// --- Fichiers d'état ---
'ALERT_STATE_FILE' => $monitoring_state_dir . '/alert-engine.offset',
'ALERT_DEDUP_FILE' => $monitoring_state_dir . '/alert-engine.dedup',
// --- Activation des canaux ---
'ALERT_NTFY_ENABLED' => true,
'ALERT_MAIL_ENABLED' => true,
// --- Configuration Mail ---
'ALERT_MAIL_BIN' => '/usr/sbin/sendmail',
'ALERT_MAIL_SUBJECT_PREFIX' => '[monitoring]',
'DEST' => 'admin@example.com', // N'oubliez pas de définir le destinataire
// --- Configuration ntfy ---
'NTFY_SERVER' => 'https://ntfy.sh',
'NTFY_TOPIC' => 'TPOSOB84sBJ6HTZ7',
'NTFY_TOKEN' => '',
'NTFY_CLICK_URL' => '',
// --- Déduplication ---
'ALERT_DEDUP_WINDOW' => 3600, // en secondes
// --- Événements à ignorer ---
'ALERT_IGNORE_EVENTS' => [
'update_not_needed',
'alert_sent_ntfy',
'alert_sent_mail'
],
// --- Canaux par défaut selon le niveau ---
'DEFAULT_CHANNELS' => [
'INFO' => 'ntfy',
'NOTICE' => 'ntfy',
'WARNING' => 'ntfy',
'ERROR' => 'ntfy,mail',
'CRITICAL' => 'ntfy,mail',
],
// --- Tags : Une icône pour chaque état possible ---
'NTFY_TAGS' => [
'DEBUG' => 'gear', // ⚙️
'INFO' => 'information_source', //
'NOTICE' => 'bell', // 🔔
'SUCCESS' => 'white_check_mark', // ✅
'WARNING' => 'warning', // ⚠️
'ERROR' => 'rotating_light,warning', // 🚨
'CRITICAL' => 'skull,warning', // 💀
'ALERT' => 'ambulance,rotating_light',// 🚑
'EMERGENCY' => 'fire,sos,skull', // 🔥
'AUDIT' => 'mag', // 🔍
],
// --- Règles spécifiques par événement ---
// Si un événement est listé ici, il outrepasse les DEFAULT_CHANNELS
'RULES' => [
'disk_usage_high' => 'ntfy',
'disk_usage_critical' => 'ntfy,mail',
'check_failed' => 'ntfy,mail',
'internal_error' => 'ntfy,mail',
'update_hash_unavailable' => 'ntfy',
'update_download_failed' => 'ntfy,mail',
'update_hash_mismatch' => 'ntfy,mail',
'manifest_download_failed' => 'ntfy,mail',
'manifest_invalid' => 'ntfy,mail',
'update_finished_with_errors' => 'ntfy,mail',
],
];