71 lines
2.3 KiB
PHP
71 lines
2.3 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
|
|
|
|
// --- 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' => [
|
|
'WARNING' => 'ntfy',
|
|
'ERROR' => 'ntfy,mail',
|
|
'CRITICAL' => 'ntfy,mail',
|
|
],
|
|
|
|
// --- Tags ntfy par niveau ---
|
|
'NTFY_TAGS' => [
|
|
'WARNING' => 'warning',
|
|
'ERROR' => 'warning,rotating_light',
|
|
'CRITICAL' => 'skull,warning',
|
|
],
|
|
|
|
// --- 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',
|
|
],
|
|
]; |