From bc0e12941f12f0c6894db7042f66abdcdff2252d Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Thu, 4 Sep 2025 18:48:51 +0000 Subject: [PATCH] refactor: remove emojis from all webhook templates for professional appearance - Replaced emoji indicators with plain text (CRITICAL, WARNING, INFO) - Cleaned up ntfy, Gotify, and Telegram templates - Removed decorative emojis from alert details - Updated dynamic header generation to use plain text - Maintains professional tone appropriate for monitoring software --- internal/notifications/notifications.go | 6 ++--- internal/notifications/webhook_enhanced.go | 6 ++--- internal/notifications/webhook_templates.go | 26 ++++++++++----------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/notifications/notifications.go b/internal/notifications/notifications.go index e8c26a93e..7652fface 100644 --- a/internal/notifications/notifications.go +++ b/internal/notifications/notifications.go @@ -636,11 +636,11 @@ func (n *NotificationManager) sendWebhookRequest(webhook WebhookConfig, jsonData func() string { switch alert.Level { case alerts.AlertLevelCritical: - return "šŸ”“ CRITICAL" + return "CRITICAL" case alerts.AlertLevelWarning: - return "🟔 WARNING" + return "WARNING" default: - return "🟢 INFO" + return "INFO" } }(), alert.ResourceName, diff --git a/internal/notifications/webhook_enhanced.go b/internal/notifications/webhook_enhanced.go index f99a6e8b6..ac7474db3 100644 --- a/internal/notifications/webhook_enhanced.go +++ b/internal/notifications/webhook_enhanced.go @@ -481,11 +481,11 @@ func (n *NotificationManager) TestEnhancedWebhook(webhook EnhancedWebhookConfig) func() string { switch testAlert.Level { case alerts.AlertLevelCritical: - return "šŸ”“ CRITICAL" + return "CRITICAL" case alerts.AlertLevelWarning: - return "🟔 WARNING" + return "WARNING" default: - return "🟢 INFO" + return "INFO" } }(), testAlert.ResourceName, diff --git a/internal/notifications/webhook_templates.go b/internal/notifications/webhook_templates.go index 3ca8d6fa1..dbae83168 100644 --- a/internal/notifications/webhook_templates.go +++ b/internal/notifications/webhook_templates.go @@ -50,7 +50,7 @@ func GetWebhookTemplates() []WebhookTemplate { Headers: map[string]string{"Content-Type": "application/json"}, PayloadTemplate: `{ "chat_id": "{{.ChatID}}", - "text": "🚨 *Pulse Alert: {{.Level | title}}*\n\n{{.Message}}\n\nšŸ“Š *Details:*\n• Resource: {{.ResourceName}}\n• Node: {{.Node}}\n• Type: {{.Type | title}}\n• Value: {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.1f" .Value}} MB/s{{else}}{{printf "%.1f" .Value}}%{{end}}\n• Threshold: {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.0f" .Threshold}} MB/s{{else}}{{printf "%.0f" .Threshold}}%{{end}}\n• Duration: {{.Duration}}\n\nšŸ”— [View in Pulse]({{.Instance}})", + "text": "*Pulse Alert: {{.Level | title}}*\n\n{{.Message}}\n\n*Details:*\n• Resource: {{.ResourceName}}\n• Node: {{.Node}}\n• Type: {{.Type | title}}\n• Value: {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.1f" .Value}} MB/s{{else}}{{printf "%.1f" .Value}}%{{end}}\n• Threshold: {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.0f" .Threshold}} MB/s{{else}}{{printf "%.0f" .Threshold}}%{{end}}\n• Duration: {{.Duration}}\n\n[View in Pulse]({{.Instance}})", "parse_mode": "Markdown", "disable_web_page_preview": true }`, @@ -255,8 +255,8 @@ func GetWebhookTemplates() []WebhookTemplate { Method: "POST", Headers: map[string]string{"Content-Type": "application/json"}, PayloadTemplate: `{ - "message": "{{if eq .Level "critical"}}šŸ”“ **CRITICAL**{{else if eq .Level "warning"}}🟔 **WARNING**{{else}}🟢 **INFO**{{end}}: **{{.ResourceName}}** on **{{.Node}}**\n\n{{.Message}}\n\nšŸ“Š **Alert Details:**\n• šŸ–„ļø **Resource:** {{.ResourceName}}\n• šŸ—„ļø **Node:** {{.Node}}\n• šŸ“ˆ **Type:** {{.Type | title}}\n• šŸŽÆ **Current:** {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.1f" .Value}} MB/s{{else}}{{printf "%.1f" .Value}}%{{end}}\n• āš ļø **Threshold:** {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.0f" .Threshold}} MB/s{{else}}{{printf "%.0f" .Threshold}}%{{end}}\n• ā±ļø **Duration:** {{.Duration}}\n• šŸ†” **Alert ID:** {{.ID}}\n\nšŸ”— [View in Pulse]({{.Instance}})", - "title": "{{if eq .Level "critical"}}šŸ”“{{else if eq .Level "warning"}}🟔{{else}}🟢{{end}} {{.ResourceName}} - {{.Type | title}} Alert", + "message": "**{{if eq .Level "critical"}}CRITICAL{{else if eq .Level "warning"}}WARNING{{else}}INFO{{end}}**: **{{.ResourceName}}** on **{{.Node}}**\n\n{{.Message}}\n\n**Alert Details:**\n- **Resource:** {{.ResourceName}}\n- **Node:** {{.Node}}\n- **Type:** {{.Type | title}}\n- **Current:** {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.1f" .Value}} MB/s{{else}}{{printf "%.1f" .Value}}%{{end}}\n- **Threshold:** {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.0f" .Threshold}} MB/s{{else}}{{printf "%.0f" .Threshold}}%{{end}}\n- **Duration:** {{.Duration}}\n- **Alert ID:** {{.ID}}\n\n[View in Pulse]({{.Instance}})", + "title": "{{.ResourceName}} - {{.Type | title}} {{.Level | upper}} Alert", "priority": {{if eq .Level "critical"}}10{{else if eq .Level "warning"}}5{{else}}2{{end}}, "extras": { "client::display": { @@ -287,20 +287,20 @@ func GetWebhookTemplates() []WebhookTemplate { // Note: Title, Priority, and Tags headers should be added dynamically based on alert level // For now, we'll use static reasonable defaults that won't break }, - PayloadTemplate: `{{if eq .Level "critical"}}šŸ”“ CRITICAL{{else if eq .Level "warning"}}🟔 WARNING{{else}}🟢 INFO{{end}}: {{.ResourceName}} on {{.Node}} + PayloadTemplate: `{{if eq .Level "critical"}}CRITICAL{{else if eq .Level "warning"}}WARNING{{else}}INFO{{end}}: {{.ResourceName}} on {{.Node}} {{.Message}} -šŸ“Š Alert Details: -• šŸ–„ļø Resource: {{.ResourceName}} -• šŸ—„ļø Node: {{.Node}} -• šŸ“ˆ Type: {{.Type | title}} -• šŸŽÆ Current: {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.1f" .Value}} MB/s{{else}}{{printf "%.1f" .Value}}%{{end}} -• āš ļø Threshold: {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.0f" .Threshold}} MB/s{{else}}{{printf "%.0f" .Threshold}}%{{end}} -• ā±ļø Duration: {{.Duration}} -• šŸ†” Alert ID: {{.ID}} +Alert Details: +- Resource: {{.ResourceName}} +- Node: {{.Node}} +- Type: {{.Type | title}} +- Current: {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.1f" .Value}} MB/s{{else}}{{printf "%.1f" .Value}}%{{end}} +- Threshold: {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.0f" .Threshold}} MB/s{{else}}{{printf "%.0f" .Threshold}}%{{end}} +- Duration: {{.Duration}} +- Alert ID: {{.ID}} -šŸ”— View in Pulse: {{.Instance}}`, +View in Pulse: {{.Instance}}`, Instructions: "1. Choose a topic name (e.g., 'my-pulse-alerts')\n2. URL format: https://ntfy.sh/YOUR_TOPIC\n Or for self-hosted: https://your-ntfy-server/YOUR_TOPIC\n3. For authentication, add a custom header:\n • Header Name: Authorization\n • Header Value: Bearer YOUR_TOKEN (or Basic base64_encoded_credentials)\n4. Subscribe to the topic in your ntfy app using the same topic name", }, {