Add Uptime Kuma testing to test-notifications script
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
Extend notification testing script to include Uptime Kuma push monitor tests alongside existing ntfy tests. Changes: - Add 3 Uptime Kuma test scenarios (up, down, up) - Gracefully skip Uptime Kuma tests if not configured - Update script description to include Uptime Kuma - Improve output formatting with separate sections 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Script de test des notifications ntfy
|
# Script de test des notifications (ntfy et Uptime Kuma)
|
||||||
# Usage: ./test-notifications.sh
|
# Usage: ./test-notifications.sh
|
||||||
#
|
#
|
||||||
|
|
||||||
@@ -98,13 +98,75 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}==================================================${NC}"
|
||||||
|
echo -e "${BLUE}Test des notifications Uptime Kuma${NC}"
|
||||||
|
echo -e "${BLUE}==================================================${NC}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Vérifier si Uptime Kuma est configuré
|
||||||
|
if [ -z "$UPTIME_KUMA_PUSH_URL" ]; then
|
||||||
|
echo -e "${YELLOW}⚠️ UPTIME_KUMA_PUSH_URL non configuré${NC}"
|
||||||
|
echo "Ignoré - configurez UPTIME_KUMA_PUSH_URL dans .env pour tester Uptime Kuma"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}Configuration:${NC}"
|
||||||
|
echo " URL: ${UPTIME_KUMA_PUSH_URL}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Test 4: Ping Uptime Kuma (succès)
|
||||||
|
echo -e "${YELLOW}📤 Test 4: Ping Uptime Kuma (status=up)...${NC}"
|
||||||
|
RESPONSE=$(curl -s -w "\n%{http_code}" "${UPTIME_KUMA_PUSH_URL}?status=up&msg=Test%20success&ping=")
|
||||||
|
|
||||||
|
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
|
||||||
|
if [ "$HTTP_CODE" -eq 200 ]; then
|
||||||
|
echo -e "${GREEN}✅ Ping Uptime Kuma (success) envoyé avec succès${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}❌ Échec (HTTP $HTTP_CODE)${NC}"
|
||||||
|
echo "$RESPONSE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# Test 5: Ping Uptime Kuma (erreur)
|
||||||
|
echo -e "${YELLOW}📤 Test 5: Ping Uptime Kuma (status=down)...${NC}"
|
||||||
|
RESPONSE=$(curl -s -w "\n%{http_code}" "${UPTIME_KUMA_PUSH_URL}?status=down&msg=Test%20error&ping=")
|
||||||
|
|
||||||
|
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
|
||||||
|
if [ "$HTTP_CODE" -eq 200 ]; then
|
||||||
|
echo -e "${GREEN}✅ Ping Uptime Kuma (error) envoyé avec succès${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}❌ Échec (HTTP $HTTP_CODE)${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# Test 6: Remettre le statut à "up"
|
||||||
|
echo -e "${YELLOW}📤 Test 6: Remettre Uptime Kuma à up...${NC}"
|
||||||
|
RESPONSE=$(curl -s -w "\n%{http_code}" "${UPTIME_KUMA_PUSH_URL}?status=up&msg=Test%20complete&ping=")
|
||||||
|
|
||||||
|
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
|
||||||
|
if [ "$HTTP_CODE" -eq 200 ]; then
|
||||||
|
echo -e "${GREEN}✅ Statut remis à up${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}❌ Échec (HTTP $HTTP_CODE)${NC}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${GREEN}==================================================${NC}"
|
echo -e "${GREEN}==================================================${NC}"
|
||||||
echo -e "${GREEN}✅ Tous les tests de notification ont réussi !${NC}"
|
echo -e "${GREEN}✅ Tous les tests de notification ont réussi !${NC}"
|
||||||
echo -e "${GREEN}==================================================${NC}"
|
echo -e "${GREEN}==================================================${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Vérifiez que vous avez reçu 3 notifications sur votre appareil:"
|
echo -e "${YELLOW}Vérifications:${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}Ntfy:${NC}"
|
||||||
echo " 1. Notification de test simple"
|
echo " 1. Notification de test simple"
|
||||||
echo " 2. Notification de succès de backup"
|
echo " 2. Notification de succès de backup"
|
||||||
echo " 3. Notification d'erreur de backup"
|
echo " 3. Notification d'erreur de backup"
|
||||||
echo ""
|
echo ""
|
||||||
|
if [ -n "$UPTIME_KUMA_PUSH_URL" ]; then
|
||||||
|
echo -e "${BLUE}Uptime Kuma:${NC}"
|
||||||
|
echo " 4. Monitor devrait montrer un changement up → down → up"
|
||||||
|
echo " 5. Vérifiez l'historique dans le dashboard Uptime Kuma"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user