Ce script permet de surveiller l’état du stockage du système. Il vérifie l’utilisation des espaces disque et peut générer des alertes en cas de dépassement de seuil critique. Ce script est exécuté automatiquement via une tâche cron planifiée (actuellement les lundis et vendredis à 6h00).
Fonctionnement :
Analyse des partitions montées
Détection des taux d’utilisation élevés
Génération d’un rapport (et éventuellement envoi par mail)
Remarques :
Nécessite que les outils système (df, awk, mail, etc.) soient disponibles
Prévoir des chemins absolus pour une exécution via cron
Script
Script bash à render executable :
#!/bin/bash #━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # Last version : V1 - 2026-03-20 #━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # README ═══════════════════════════════════════════════════════════════════════════════════════════ # This script inspect the health of ther server and sent a report on Monday and Friday # The following line shall be added to the crontab ------------------------------------------------- # 00 6 * * 1,5 check_storage_server-prod-0042.sh #━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
for slot in {1..8}; do echo -e "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓" echo -e "┣━━━━━ Slot $slot ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫" echo -e "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛" /opt/MegaRAID/storcli/storcli64 /c0/e$ENCLOSURE/s"$slot" show all echo -e "\n" done
Exemple du contenu du fichier reçu en pièce-jointe dans le mail :
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ┃ DATE: Fri Mar 20 13:53:32 UTC 2026 ┃ HOST: server-prod-0042org ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ┣━━━━━ GENERAL INFORMATIONS ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ System: Red Hat Enterprise Linux release 9.6 (Plow) Kernel: 5.14.0-570.21.1.el9_6.x86_64 Uptime: up 42 weeks, 42 hours, 42 minutes
Properties : ========== ---------------------------------------------------------------------------- EID State Slot PD PS Fans TSs Alms SIM Port# ProdID VendorSpecific ---------------------------------------------------------------------------- 155 OK 8 8 0 0 0 0 0 /SAS UBM3 BC BP ----------------------------------------------------------------------------
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ┣━━━━━ DISKS INFORMATIONS ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Controller = 0 Status = Success Description = Show Drive Information Succeeded.
Drive Information : ================= ---------------------------------------------------------------- EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp Type ---------------------------------------------------------------- 155:1 1 Onln 0 1.60 TB NVMe SSD N N 512B N/A U - 155:2 3 Onln 0 1.60 TB NVMe SSD N N 512B N/A U - 155:3 2 Onln 0 1.60 TB NVMe SSD N N 512B N/A U - 155:4 7 DHS 0 1.60 TB NVMe SSD N N 512B N/A U - 155:5 4 Onln 0 1.60 TB NVMe SSD N N 512B N/A U - 155:6 5 Onln 0 1.60 TB NVMe SSD N N 512B N/A U - 155:7 6 Onln 0 1.60 TB NVMe SSD N N 512B N/A U - 155:8 0 Onln 0 1.60 TB NVMe SSD N N 512B N/A U - ----------------------------------------------------------------
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┣━━━━━ Slot 1 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ Controller = 0 Status = Success Description = Show Drive Information Succeeded.
Drive /c0/e155/s1 : ================= ---------------------------------------------------------------- EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp Type ---------------------------------------------------------------- 155:1 1 Onln 0 1.60 TB NVMe SSD N N 512B N/A U - ---------------------------------------------------------------- [...]
Drive /c0/e155/s1 - Detailed Information : ========================================
Drive /c0/e155/s1 State : ======================= Shield Counter = 0 Media Error Count = 0 Other Error Count = 0 Drive Temperature = 23C (73.40 F) Predictive Failure Count = 0