mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 01:10:12 -08:00
feat: Update webhook notification system to include enhanced message context and tags
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user