134 lines
5.6 KiB
Bash
Executable File
134 lines
5.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Setup Uptime Kuma Monitors for tower-of-joy Infrastructure
|
|
#
|
|
# This script provides instructions and data for configuring monitoring
|
|
# for all infrastructure services in Uptime Kuma.
|
|
#
|
|
# Usage: ./scripts/setup-kuma-monitors.sh
|
|
|
|
set -e
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
CYAN='\033[0;36m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Configuration
|
|
KUMA_URL="http://192.168.86.149:3001"
|
|
|
|
# Service definitions
|
|
declare -a MONITORS=(
|
|
"Portainer|http://192.168.86.149:8001|60|Container management interface"
|
|
"Nginx Proxy Manager|http://192.168.86.149:81|60|Reverse proxy admin interface"
|
|
"Ollama API|http://192.168.86.149:11434|60|ML model API endpoint"
|
|
"Headscale|http://192.168.86.149:8085/health|60|Mesh VPN control server"
|
|
"Uptime Kuma|http://192.168.86.149:3001|120|Service monitoring (self-check)"
|
|
"Netdata|http://192.168.86.149:19999|60|System metrics dashboard"
|
|
"Heimdall|http://192.168.86.149:8888|60|Application dashboard"
|
|
"Organizr|http://192.168.86.149:9999|60|Unified dashboard"
|
|
"Jellyfin|http://192.168.86.149:8096|60|Media streaming server"
|
|
)
|
|
|
|
echo -e "${BLUE}╔════════════════════════════════════════════╗${NC}"
|
|
echo -e "${BLUE}║ Uptime Kuma Monitor Setup Guide ║${NC}"
|
|
echo -e "${BLUE}╚════════════════════════════════════════════╝${NC}"
|
|
echo ""
|
|
echo -e "${CYAN}Target:${NC} $KUMA_URL"
|
|
echo -e "${CYAN}Monitors to configure:${NC} ${#MONITORS[@]}"
|
|
echo ""
|
|
|
|
# Check if Uptime Kuma is accessible
|
|
echo -n "Checking Uptime Kuma availability... "
|
|
if curl -s -o /dev/null -w "%{http_code}" "$KUMA_URL" | grep -q "200\|301\|302"; then
|
|
echo -e "${GREEN}✓${NC}"
|
|
else
|
|
echo -e "${RED}✗${NC}"
|
|
echo -e "${RED}Error: Cannot reach Uptime Kuma at $KUMA_URL${NC}"
|
|
echo "Make sure Uptime Kuma is running: docker ps | grep uptime-kuma"
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo -e "${BLUE}═══════════════════════════════════════════${NC}"
|
|
echo -e "${GREEN}Monitors to Configure:${NC}"
|
|
echo -e "${BLUE}═══════════════════════════════════════════${NC}"
|
|
echo ""
|
|
|
|
counter=1
|
|
for monitor_def in "${MONITORS[@]}"; do
|
|
IFS='|' read -r name url interval desc <<< "$monitor_def"
|
|
echo -e "${YELLOW}[$counter/${#MONITORS[@]}] $name${NC}"
|
|
echo -e " ${CYAN}URL:${NC} $url"
|
|
echo -e " ${CYAN}Interval:${NC} ${interval}s"
|
|
echo -e " ${CYAN}Description:${NC} $desc"
|
|
echo ""
|
|
((counter++))
|
|
done
|
|
|
|
echo -e "${BLUE}═══════════════════════════════════════════${NC}"
|
|
echo -e "${GREEN}Setup Instructions:${NC}"
|
|
echo -e "${BLUE}═══════════════════════════════════════════${NC}"
|
|
echo ""
|
|
echo "1. Open Uptime Kuma in your browser:"
|
|
echo -e " ${CYAN}${KUMA_URL}${NC}"
|
|
echo ""
|
|
echo "2. Log in with your Uptime Kuma credentials"
|
|
echo ""
|
|
echo "3. For each monitor listed above, click ${GREEN}'Add New Monitor'${NC} and enter:"
|
|
echo ""
|
|
echo " ${CYAN}Monitor Settings:${NC}"
|
|
echo " • Monitor Type: ${GREEN}HTTP(s)${NC}"
|
|
echo " • Friendly Name: ${GREEN}[Name from list above]${NC}"
|
|
echo " • URL: ${GREEN}[URL from list above]${NC}"
|
|
echo " • Heartbeat Interval: ${GREEN}[Interval from list]${NC} seconds"
|
|
echo " • Retries: ${GREEN}1${NC}"
|
|
echo " • Retry Interval: ${GREEN}60${NC} seconds"
|
|
echo " • HTTP Method: ${GREEN}GET${NC}"
|
|
echo " • Expected Status Code: ${GREEN}200${NC}"
|
|
echo ""
|
|
echo "4. Click ${GREEN}'Save'${NC} for each monitor"
|
|
echo ""
|
|
echo "5. After adding all monitors, verify they appear in:"
|
|
echo " • Uptime Kuma dashboard"
|
|
echo " • Organizr homepage (Service Status widget)"
|
|
echo ""
|
|
|
|
echo -e "${BLUE}═══════════════════════════════════════════${NC}"
|
|
echo -e "${GREEN}Quick Copy-Paste Data:${NC}"
|
|
echo -e "${BLUE}═══════════════════════════════════════════${NC}"
|
|
echo ""
|
|
|
|
for monitor_def in "${MONITORS[@]}"; do
|
|
IFS='|' read -r name url interval desc <<< "$monitor_def"
|
|
echo -e "${YELLOW}$name${NC}"
|
|
echo "$url"
|
|
echo ""
|
|
done
|
|
|
|
echo -e "${BLUE}═══════════════════════════════════════════${NC}"
|
|
echo -e "${GREEN}Post-Setup Verification:${NC}"
|
|
echo -e "${BLUE}═══════════════════════════════════════════${NC}"
|
|
echo ""
|
|
echo "After adding all monitors:"
|
|
echo ""
|
|
echo "1. Check Uptime Kuma dashboard shows all services as 'Up'"
|
|
echo "2. Refresh Organizr (${CYAN}http://192.168.86.149:9999${NC})"
|
|
echo "3. Verify 'Service Status' widget shows all monitors"
|
|
echo "4. Test by stopping a container and watching status change:"
|
|
echo -e " ${CYAN}docker stop heimdall${NC}"
|
|
echo " (Monitor should show as Down within 60s)"
|
|
echo -e " ${CYAN}docker start heimdall${NC}"
|
|
echo " (Monitor should recover)"
|
|
echo ""
|
|
|
|
echo -e "${GREEN}✓ Setup guide complete!${NC}"
|
|
echo ""
|
|
echo -e "${YELLOW}Tip:${NC} For automated setup in the future, consider:"
|
|
echo " • Uptime Kuma API (requires authentication)"
|
|
echo " • Backup/restore Uptime Kuma configuration"
|
|
echo " • Export configuration: Settings → Backup"
|
|
echo ""
|