ready for build

This commit is contained in:
qiqian
2022-08-15 13:51:23 +08:00
parent 2a15d631e1
commit 8fa3ac851c
15 changed files with 260 additions and 40 deletions

View File

@@ -1,8 +1,14 @@
bark_api: http://bark-server.default:8080/push
title:
firing: Homeserver 告警发生
resolved: Homeserver 告警解除
default: Homeserver
to:
- 'token'
template_file: text_template.tpl
DEBUG: true
APP_CONFIG:
bark_api: http://bark-server.default:8080/push
title:
firing: Homeserver 告警发生
resolved: Homeserver 告警解除
default: Homeserver
to:
- 'token'
severity:
- 'warning'
- 'critical'
template_file: text_template.tpl

View File

@@ -1,22 +1,41 @@
{%- for alert in alerts -%}
{%- if alert.status == 'firing' -%}
{%- 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 %}
{% 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 %}
{%- else -%}
详情:{{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 %}
{% 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 %}
{%- endif -%}
{%- endfor -%}
{% if alert.annotations.value -%}
告警数据:{{alert.annotations.value}}
{%- endif %}
---
{%- endfor %}
{%- endif -%}