74 lines
2.7 KiB
PHP
74 lines
2.7 KiB
PHP
<?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
|
||
|
||
// --- 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',
|
||
],
|
||
]; |