From 91f60ed9b825636bbd771459d9dd73cfbf36c66f Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Sat, 16 Aug 2025 21:46:33 +0000 Subject: [PATCH] fix: improve webhook test notifications with realistic values - Use realistic test values (85.5% CPU, 80% threshold) instead of zeros - Set alert level to 'warning' instead of 'info' for better visibility - Add 5-minute duration to test alerts for realistic testing - Improve test message to be more descriptive - Fix empty message text issue in Telegram webhooks The webhook system now sends proper test notifications that accurately simulate real alerts, making it easier to verify webhook configurations. --- internal/notifications/notifications.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/notifications/notifications.go b/internal/notifications/notifications.go index 06bfcb9d3..295ddca9d 100644 --- a/internal/notifications/notifications.go +++ b/internal/notifications/notifications.go @@ -1094,19 +1094,19 @@ func (n *NotificationManager) SendTestNotification(method string) error { // SendTestWebhook sends a test notification to a specific webhook func (n *NotificationManager) SendTestWebhook(webhook WebhookConfig) error { - // Create a test alert for webhook testing + // Create a test alert for webhook testing with realistic values testAlert := &alerts.Alert{ ID: "test-webhook-" + webhook.ID, - Type: "test", - Level: "info", + Type: "cpu", + Level: "warning", ResourceID: "webhook-test", - ResourceName: "Webhook Test", + ResourceName: "Test Alert", Node: "test-node", - Instance: "pulse-server", - Message: fmt.Sprintf("Testing webhook: %s", webhook.Name), - Value: 0, - Threshold: 0, - StartTime: time.Now(), + Instance: "pulse-monitoring", + Message: fmt.Sprintf("This is a test alert from Pulse to verify your %s webhook is working correctly", webhook.Name), + Value: 85.5, + Threshold: 80.0, + StartTime: time.Now().Add(-5 * time.Minute), // Alert started 5 minutes ago LastSeen: time.Now(), Metadata: map[string]interface{}{ "webhookName": webhook.Name,