Add disk-usage command to monitor backup server storage
Some checks failed
Deploy Borgmatic Configuration / Deploy to Production Server (push) Has been cancelled

Add new make disk-usage command to display repository statistics and remote
server disk space. This helps monitor storage usage and plan capacity.

Changes:
- Add disk-usage target to display Borg repository statistics
- Show original, compressed, and deduplicated sizes
- Display free disk space on remote backup server via SSH
- Update .PHONY declaration with new target

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
BeauTroll
2025-12-18 15:43:12 +01:00
parent 6f968f73c4
commit cecc224dea

View File

@@ -1,7 +1,7 @@
# Makefile pour Borgmatic - Agence66 # Makefile pour Borgmatic - Agence66
# Usage: make [commande] # Usage: make [commande]
.PHONY: help install test backup list restore healthcheck logs status clean .PHONY: help install test backup list restore healthcheck logs status clean disk-usage
# Couleurs pour l'affichage # Couleurs pour l'affichage
BLUE := \033[0;34m BLUE := \033[0;34m
@@ -55,6 +55,15 @@ info: ## Affiche les informations sur le repository
@echo "$(BLUE)Informations sur le repository:$(NC)" @echo "$(BLUE)Informations sur le repository:$(NC)"
@sudo bash -c 'set -a && source /etc/borgmatic/.env && set +a && borgmatic info' @sudo bash -c 'set -a && source /etc/borgmatic/.env && set +a && borgmatic info'
disk-usage: ## Affiche l'espace disque utilisé et libre sur le serveur de backup
@echo "$(BLUE)Espace disque sur le serveur de backup:$(NC)"
@echo ""
@echo "$(YELLOW)Espace utilisé par le repository Borg:$(NC)"
@sudo bash -c 'set -a && source /etc/borgmatic/.env && set +a && borgmatic info --json 2>/dev/null | grep -o "\"stats\":{[^}]*}" | sed "s/[{}\"]//g" | tr "," "\n" | grep -E "original_size|compressed_size|deduplicated_size" || borgmatic info | grep -E "Original size|Compressed size|Deduplicated size"'
@echo ""
@echo "$(YELLOW)Espace libre sur le serveur distant:$(NC)"
@sudo bash -c 'set -a && source /etc/borgmatic/.env && set +a && SERVER=$$(echo $$BORG_REPO | sed "s|ssh://||" | cut -d"/" -f1) && ssh $$SERVER "df -h | grep -E \"Filesystem|$$\" | head -2"'
restore: ## Lance le script de restauration interactive restore: ## Lance le script de restauration interactive
@echo "$(BLUE)Restauration interactive...$(NC)" @echo "$(BLUE)Restauration interactive...$(NC)"
sudo ./scripts/restore.sh sudo ./scripts/restore.sh