Files
Malio-ops/CheckStorage/README.md
2026-03-19 11:04:57 +01:00

83 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
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.
# CheckStorage
Script de vérification de lespace disque sur Ubuntu Server, avec notification Discord optionnelle.
## Fonctionnement
Le script :
1. charge `.env`
2. lit lutilisation de la partition `/`
3. compare le taux doccupation au seuil configuré
4. envoie une alerte Discord si le seuil est dépassé
<details>
<summary style="list-style: none; cursor: pointer;">
<strong>EggMaster</strong>
</summary>
<details>
<summary style="list-style: none; cursor: pointer;">Question 3</summary>
Quel operateur shell permet d'envoyer la sortie d'une commande vers la suivante ?
</details>
<details>
<summary style="list-style: none; cursor: pointer;">Indice commande 3</summary>
```text
|
```
</details>
<details>
<summary style="list-style: none; cursor: pointer;">Fragment 3</summary>
```text
b3llciB2b2ljaSB1biBsaWVuIG1hZ2lxdWUgZW
```
</details>
</details>
## Pré-requis
Installation recommandée sur Ubuntu Server :
```bash
sudo apt update
sudo apt install -y coreutils gawk jq curl
```
`jq` et `curl` ne sont nécessaires que si `DISCORD_WEBHOOK_URL` est renseigné.
## Configuration
```bash
cp .env.exemple .env
chmod 600 .env
```
Variables disponibles :
- `DISCORD_WEBHOOK_URL` : webhook Discord, optionnel
- `DISCORD_PING` : mention en cas dalerte, optionnel, défaut `@here`
- `STORAGE_ALERT_LIMIT` : seuil dalerte en pourcentage, défaut `70`
## Utilisation
```bash
chmod 700 check-storage.sh
./check-storage.sh
```
## Cron
Exemple quotidien à `07:50` :
```bash
50 7 * * * /chemin/vers/CheckStorage/check-storage.sh
```