Files
Malio-ops/CheckStorage/README.md

52 lines
1012 B
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é
## 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
```