Add Uptime Kuma monitoring integration with dedicated hooks
Some checks failed
Deploy Borgmatic Configuration / Deploy to Production Server (push) Has been cancelled
Some checks failed
Deploy Borgmatic Configuration / Deploy to Production Server (push) Has been cancelled
Implement Uptime Kuma Push Monitor support with separate hook files following separation of concerns principle. Changes: - Add UPTIME_KUMA_PUSH_URL to .env.example - Create dedicated uptime-kuma-success.sh hook - Create dedicated uptime-kuma-error.sh hook - Update config.yaml to call both ntfy and Uptime Kuma hooks - Each notification service has its own file for modularity 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,14 @@ NTFY_URL=https://ntfy.sh/your-topic-name
|
|||||||
# Laisser vide si pas d'authentification
|
# Laisser vide si pas d'authentification
|
||||||
NTFY_USER=username:password
|
NTFY_USER=username:password
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# MONITORING UPTIME KUMA
|
||||||
|
# ============================================
|
||||||
|
|
||||||
|
# URL du Push Monitor Uptime Kuma
|
||||||
|
# Obtenue depuis Uptime Kuma > Add New Monitor > Type: Push
|
||||||
|
UPTIME_KUMA_PUSH_URL=http://uptime-kuma:3001/api/push/YOUR_KEY_HERE
|
||||||
|
|
||||||
# ============================================
|
# ============================================
|
||||||
# OPTIONS AVANCÉES
|
# OPTIONS AVANCÉES
|
||||||
# ============================================
|
# ============================================
|
||||||
|
|||||||
@@ -80,13 +80,15 @@ commands:
|
|||||||
- after: action
|
- after: action
|
||||||
when: [create]
|
when: [create]
|
||||||
run:
|
run:
|
||||||
- echo "Exécution hook de succès"
|
- echo "Exécution hooks de succès"
|
||||||
- /etc/borgmatic/hooks/ntfy-success.sh
|
- /etc/borgmatic/hooks/ntfy-success.sh
|
||||||
|
- /etc/borgmatic/hooks/uptime-kuma-success.sh
|
||||||
|
|
||||||
- after: error
|
- after: error
|
||||||
run:
|
run:
|
||||||
- echo "Exécution hook d'erreur"
|
- echo "Exécution hooks d'erreur"
|
||||||
- /etc/borgmatic/hooks/ntfy-error.sh
|
- /etc/borgmatic/hooks/ntfy-error.sh
|
||||||
|
- /etc/borgmatic/hooks/uptime-kuma-error.sh
|
||||||
# Commandes PostgreSQL/MySQL si nécessaire
|
# Commandes PostgreSQL/MySQL si nécessaire
|
||||||
# postgresql_databases:
|
# postgresql_databases:
|
||||||
# - name: all
|
# - name: all
|
||||||
|
|||||||
28
hooks/uptime-kuma-error.sh
Executable file
28
hooks/uptime-kuma-error.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Hook Borgmatic - Ping Uptime Kuma en cas d'erreur
|
||||||
|
# Borgmatic 2.0 utilise des variables d'environnement
|
||||||
|
#
|
||||||
|
|
||||||
|
# Charger les variables d'environnement
|
||||||
|
if [ -f /etc/borgmatic/.env ]; then
|
||||||
|
source /etc/borgmatic/.env
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Vérifier que l'URL Uptime Kuma est configurée
|
||||||
|
if [ -z "$UPTIME_KUMA_PUSH_URL" ]; then
|
||||||
|
echo "UPTIME_KUMA_PUSH_URL non configuré, ping ignoré"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ping Uptime Kuma avec status=down
|
||||||
|
curl -s "${UPTIME_KUMA_PUSH_URL}?status=down&msg=Backup%20failed&ping=" > /dev/null 2>&1
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Ping Uptime Kuma envoyé (error)"
|
||||||
|
else
|
||||||
|
echo "Erreur lors du ping Uptime Kuma"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
28
hooks/uptime-kuma-success.sh
Executable file
28
hooks/uptime-kuma-success.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Hook Borgmatic - Ping Uptime Kuma en cas de succès
|
||||||
|
# Borgmatic 2.0 utilise des variables d'environnement
|
||||||
|
#
|
||||||
|
|
||||||
|
# Charger les variables d'environnement
|
||||||
|
if [ -f /etc/borgmatic/.env ]; then
|
||||||
|
source /etc/borgmatic/.env
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Vérifier que l'URL Uptime Kuma est configurée
|
||||||
|
if [ -z "$UPTIME_KUMA_PUSH_URL" ]; then
|
||||||
|
echo "UPTIME_KUMA_PUSH_URL non configuré, ping ignoré"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ping Uptime Kuma avec status=up
|
||||||
|
curl -s "${UPTIME_KUMA_PUSH_URL}?status=up&msg=Backup%20successful&ping=" > /dev/null 2>&1
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Ping Uptime Kuma envoyé (success)"
|
||||||
|
else
|
||||||
|
echo "Erreur lors du ping Uptime Kuma"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user