diff --git a/backup-plex.sh b/backup-plex.sh index 04c1605..fc3f5a9 100755 --- a/backup-plex.sh +++ b/backup-plex.sh @@ -36,7 +36,7 @@ INTEGRITY_CHECK_ONLY=false INTERACTIVE_MODE=true PARALLEL_VERIFICATION=true PERFORMANCE_MONITORING=true -WEBHOOK_URL="" +WEBHOOK_URL="https://notify.peterwood.rocks/lab" EMAIL_RECIPIENT="" # Parse command line arguments @@ -198,23 +198,17 @@ send_notification() { # Webhook notification if [ -n "$WEBHOOK_URL" ]; then - local payload=$(jq -n \ - --arg title "$title" \ - --arg message "$message" \ - --arg status "$status" \ - --arg hostname "$hostname" \ - --arg timestamp "$(date -Iseconds)" \ - '{ - title: $title, - message: $message, - status: $status, - hostname: $hostname, - timestamp: $timestamp - }') + local tags="backup,plex,${hostname}" + [ "$status" == "error" ] && tags="${tags},errors" + [ "$status" == "warning" ] && tags="${tags},warnings" - curl -s -X POST "$WEBHOOK_URL" \ - -H "Content-Type: application/json" \ - -d "$payload" > /dev/null 2>&1 || true + # Enhanced message with additional context + local enhanced_message="$message\n\nHost: $hostname\nTimestamp: $(date '+%Y-%m-%d %H:%M:%S')" + + curl -s \ + -H "tags:${tags}" \ + -d "$enhanced_message" \ + "$WEBHOOK_URL" 2>/dev/null || log_warning "Failed to send webhook notification" fi # Email notification (if sendmail is available)