alertmanager-bark-hook/config/text_template_example.tpl

41 lines
1.2 KiB
Smarty
Raw Normal View History

2022-08-15 05:51:23 +00:00
{%- if status == 'firing' -%}
2022-08-08 05:51:01 +00:00
告警发生:
2022-08-15 05:51:23 +00:00
{%- for alert in alerts %}
2022-08-08 05:51:01 +00:00
告警时间:{{alert.startsAt}}
2022-08-15 05:51:23 +00:00
{% if alert.labels.instance -%}
涉及实例:{{alert.labels.instance}}
{% endif -%}
{% if alert.labels.device -%}
涉及设备:{{alert.labels.device}}
{% endif -%}
2022-08-08 05:51:01 +00:00
告警名称:{{alert.labels.alertname}}
严重性:{{alert.labels.severity}}
2022-08-15 05:51:23 +00:00
详情:{{alert.annotations.description}}
{% if alert.annotations.value -%}
告警数据:{{alert.annotations.value}}
{% endif -%}
{% if alert.annotations.runbook_url -%}
参考文档:{{alert.annotations.runbook_url}}
{%- endif %}
---
{%- endfor %}
{%- else -%}
2022-08-08 05:51:01 +00:00
告警恢复:
2022-08-15 05:51:23 +00:00
{%- for alert in alerts %}
2022-08-08 05:51:01 +00:00
告警时间:{{alert.startsAt}}
恢复时间:{{alert.endsAt}}
2022-08-15 05:51:23 +00:00
{% if alert.labels.instance -%}
涉及实例:{{alert.labels.instance}}
{%- endif %}
{% if alert.labels.device -%}
涉及设备:{{alert.labels.device}}
{%- endif %}
2022-08-08 05:51:01 +00:00
告警名称:{{alert.labels.alertname}}
严重性:{{alert.labels.severity}}
详情:{{alert.annotations.summary}}
2022-08-15 05:51:23 +00:00
{% if alert.annotations.value -%}
告警数据:{{alert.annotations.value}}
{%- endif %}
---
{%- endfor %}
{%- endif -%}