#!/bin/bash set -euo pipefail SEVERITY="${1:-info}" TITLE="${2:-Notification}" MESSAGE="${3:-No message}" TAGS="${4:-server}" # Read topics from config source /root/.ntfy-topics # Route to appropriate topic based on severity case "$SEVERITY" in critical) TOPIC="$TOPIC_CRITICAL" PRIORITY="urgent" ;; warning) TOPIC="$TOPIC_WARNING" PRIORITY="high" ;; info) TOPIC="$TOPIC_INFO" PRIORITY="default" ;; esac # Send notification WITHOUT authentication (security by obscurity) curl -s -H "Title: $TITLE" -H "Priority: $PRIORITY" -H "Tags: $TAGS" -d "$MESSAGE" "https://ntfy.sh/$TOPIC" >/dev/null 2>&1 || true logger -t homelab-monitor "[$SEVERITY] $TITLE: $MESSAGE"