alertmanager-bark-hook/config/text_template_example.tpl
2022-08-15 13:51:23 +08:00

41 lines
1.2 KiB
Smarty

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