Templates
When Are Templates Used?
1.
2.
3.
4.
5.
Golang template syntax
template/html to parse data, enabling you to accomplish any complex rendering requirements.How to Configure Notification Templates?
Configure Notification Templates
1.
Templates
page, click the Create Custom Template
button or Copy Default Template
, and enter the editing page.2.
3.
Save
button to save the template.Use Notification Templates
1.
Channel
-> Escalation Rules
page, click the Edit
button, and enter the editing page.2.
3.
4.
Save
button to save the escalation policy.What Variables Can I Reference?
Field | Type | Required | Description |
---|---|---|---|
ID | string | Yes | Incident ID |
Title | string | Yes | Incident title |
Description | string | Yes | Incident description, can be empty |
DetailUrl | string | Yes | Incident detail page URL |
Num | string | Yes | Short incident identifier, for easy visual recognition, may be duplicate |
IncidentSeverity | string | Yes | Severity level, enum values: Critical, Warning, Info |
IncidentStatus | string | Yes | Incident status, enum values: Critical, Warning, Info, Ok |
Progress | string | Yes | Processing progress, enum values: Triggered, Processing, Closed |
StartTime | int64 | Yes | Trigger time, Unix timestamp in seconds |
LastTime | int64 | No | Latest event time, latest incorporated event time in associated alerts, Unix timestamp in seconds, default 0 |
EndTime | int64 | No | Recovery time, when all associated alerts recover, the incident will automatically recover and close. Unix timestamp in seconds, default 0 |
SnoozedBefore | int64 | No | Snooze end time, Unix timestamp in seconds, default 0 |
AckTime | int64 | No | First acknowledgment time, Unix timestamp in seconds, default 0 |
CloseTime | int64 | No | Close time, end_time is incident recovery time, close_time is processing progress close time. Incident automatically closes upon recovery, manual closure doesn't affect recovery. Unix timestamp in seconds, default 0 |
Creator | Person | No | Creator information, not present when automatically generated by system |
Closer | Person | No | Closer information, not present when incident recovers automatically |
AssignedTo | Assignment | No | Assignment configuration |
Responders | []Responder | No | Responder list, initialized based on assignment configuration, also includes records if non-assigned personnel acknowledge the incident |
ChannelID | int64 | No | Channel ID, value is 0 when manually creating global incident |
ChannelName | string | No | Channel name |
GroupMethod | string | No | Grouping method, enum values: n: no grouping, p: rule-based grouping, i: intelligent grouping |
Labels | map[string]string | No | Label key-value pairs, both Key and Value are strings. No information when manually created, contains first alert's label information when automatically created |
AlertCnt | int64 | Yes | Number of associated alerts |
Alerts | []Alert | No | Associated alert details, no information when manually created |
FireType | string | No | Notification type, enum values: fire: notify, refire: loop notification |
IsFlapping | bool | No | Whether in flapping state, i.e., frequent occurrence and recovery, related to convergence configuration |
Impact | string | No | Incident impact, filled after incident closure |
RootCause | string | No | Root cause, filled after incident closure |
Resolution | string | No | Resolution, filled after incident closure |
Field | Type | Required | Description |
---|---|---|---|
person_id | int64 | Yes | Person ID |
person_name | string | Yes | Person name |
string | Yes | Email address |
Field | Type | Required | Description |
---|---|---|---|
PersonIDs | []string | No | Person ID list, exists only when assigning by person |
EscalateRuleID | string | No | Escalation rule ID, exists only when assigning by rule |
EscalateRuleName | string | No | Escalation rule name |
LayerIdx | string | No | Assignment level, corresponds to escalation rule level index, starts from 0 |
Type | string | Yes | Assignment type, enum values: assign: assign, reassign: reassign, escalate: escalation assign, reopen: reopen assign |
Field | Type | Required | Description |
---|---|---|---|
PersonID | int64 | Yes | Person ID |
PersonName | string | Yes | Person name |
string | Yes | Email address | |
AssignedAt | int64 | Yes | Assignment time, Unix timestamp in seconds, default 0 |
AcknowledgedAt | int64 | No | Acknowledgment time, Unix timestamp in seconds, default 0 |
Field | Type | Required | Description |
---|---|---|---|
Title | string | Yes | Alert title |
Description | string | Yes | Alert description, can be empty |
AlertSeverity | string | Yes | Severity level, enum values: Critical, Warning, Info |
AlertStatus | string | Yes | Alert status, enum values: Critical, Warning, Info, Ok |
Progress | string | Yes | Processing progress, enum values: Triggered, Processing, Closed |
StartTime | int64 | Yes | Trigger time, Unix timestamp in seconds |
EndTime | int64 | No | Recovery time, Unix timestamp in seconds, default 0 |
CloseTime | int64 | No | Close time, EndTime is alert recovery time, CloseTime is processing progress close time. Alert automatically closes upon recovery, manual closure doesn't affect alert recovery. Unix timestamp in seconds, default 0 |
Labels | map[string]string | No | Label key-value pairs, both Key and Value are strings |
Common Questions
1.
Labels
?Incidents
page, find an incident and view its details to see all label information2.
default template
used when I configured custom template rendering?resource
label:
3.
escaped
in incident titles?
4.
convert time formats
?
5.
6.
7.
8.
9.
10.
# Supported functions
- Use `and` function for logical AND judgment
- Use `or` function for logical OR judgment
- Use `not` function for logical NOT judgment
- Use `eq` function for logical equal judgment
- Use `ne` function for logical not equal judgment
- Use `gt` function for logical greater than judgment
- Use `ge` function for logical greater than or equal judgment
- Use `lt` function for logical less than judgment
- Use `le` function for logical less than or equal judgment
# Example usage
# Use and function for logical AND judgment
{{if and (eq .Labels.resource "cpu") (eq .Labels.metric "cpu_usage")}}
{{.Labels.resource}} CPU usage exceeds 80%
{{end}}
# Use or function for logical OR judgment
{{if or (eq .Labels.resource "cpu") (eq .Labels.metric "cpu_usage")}}
{{.Labels.resource}} CPU usage exceeds 80%
{{end}}
# Use not function for logical NOT judgment
{{if not (eq .Labels.metric "cpu_usage")}}
{{.Labels.metric}} is not CPU usage
{{end}}
11.