apache / hertzbeat

Apache HertzBeat(incubating) is a real-time monitoring system with agentless, performance cluster, prometheus-compatible, custom monitoring and status page building capabilities.
https://hertzbeat.apache.org/
Apache License 2.0
5.71k stars 989 forks source link

[BUG] The notification template cannot implement line wrapping #2815

Closed aitting closed 3 hours ago

aitting commented 4 hours ago

Is there an existing issue for this?

Current Behavior

The notification template cannot implement line wrapping. How to wrap can cause errors in the JSON data submitted when pushing the webhook.

this is my notification template text:

content: Event【 ${title} 】 
id: {id}

This is the JSON data push format after line wrapping:

{
    "target": "hedou_service_esc.event-detail.title",
    "alarmId": 447211236329472,
    "thresholdId": 87,
    "priority": 1,
    "content": "content: Event【 my event title 】 
id: 30d0b4e5-fbe6-be07-0d18-3a163b7d36da",
    "status": 0,
    "times": 1,
    "triggerTime": "2024-11-15T16:27:10",
    "tags": {
        "app": "hedou_service_esc",
        "monitorId": "447172690212864",
        "thresholdId": "87",
        "monitorHost": "192.168.3.24"
    },
    "extraProperties": {}
}

Expected Behavior

Correct format:

{
    "target": "hedou_service_esc.event-detail.title",
    "alarmId": 447211236329472,
    "thresholdId": 87,
    "priority": 1,
    "content": "content: Event【 my event title 】 \r\n id: 30d0b4e5-fbe6-be07-0d18-3a163b7d36da",
    "status": 0,
    "times": 1,
    "triggerTime": "2024-11-15T16:27:10",
    "tags": {
        "app": "hedou_service_esc",
        "monitorId": "447172690212864",
        "thresholdId": "87",
        "monitorHost": "192.168.3.24"
    },
    "extraProperties": {}
}

Steps To Reproduce

No response

Environment

HertzBeat version(s):1.5.0

Debug logs

No response

Anything else?

No response

aitting commented 3 hours ago

After upgrading to version 1.6.1, it worked normally