Monitoring/PMM

How to Customize PMM Alerts | PMM 알람 발송 커스터마이징 방법

minies 2024. 12. 26. 18:43
반응형

 

I spent quite a bit of time customizing the alert feature.

I'm sharing this post in the hope that you won’t have to waste your time like I did.

 


 

 

  • Alerting > Contact Poinsts > Contact Points > Optional Slack settings > Title
{{ template "slack.slack_title" . }}

 

 

  • Alerting > Contact Poinsts > Contact Points > Optional Slack settings > Text Body
{{ template "slack.slack_message" . }}

 

 


 

  • Alerting > Contact Poinsts >  Message templates > slack.slack_alert_firing
{{ define "slack_alert_firing" }}
  Severity: *{{ .Labels.severity }}*
  *{{ .Labels.alertname }}*
  {{ .Annotations.summary }}
  <https://urpmmip:443 dashboard> - <https://urpmmip:443/graph/alerting/silence/new?matcher=node%3D{{ .Annotations.Node }}|Silence all alerts for this node> - <https://urpmmip:443/graph/alerting/silence/new?matcher=alertname%3D{{ .Labels.alertname }}|Silence this alert for all nodes>
  {{ end }}

 

 

  • Alerting > Contact Poinsts >  Message templates > slack.slack_alert_resolved
{{ define "slack_alert_resolved" }}
  *{{ .Labels.alertname }}*
  {{ .Annotations.summary }}
  {{ .Annotations.AlertValues }}
  <https://urpmmip:443 dashboard>
{{ end }}

 

 

  • Alerting > Contact Poinsts >  slack.slack_message
{{ define "slack.slack_message" }}
  {{ if gt (len .Alerts.Firing) 0 }}
    {{ range .Alerts.Firing }} {{ template "slack_alert_firing" .}} {{ end }} {{ end }}
  {{ if gt (len .Alerts.Resolved) 0 }}
    {{ range .Alerts.Resolved }} {{ template "slack_alert_resolved" .}} {{ end }} {{ end }}
{{ end }}

 

 

  • Alerting > Contact Poinsts >  slack.slack_title
{{ define "slack.slack_title" }}
  {{ if gt (len .Alerts.Firing) 0 }}
  🔥 {{ len .Alerts.Firing }} alert(s) firing
  {{ end }}
  {{ if gt (len .Alerts.Resolved) 0 }}
  ✅ {{ len .Alerts.Resolved }} alert(s) resolved
  {{ end }}
{{ end }}

 

 


References

https://www.percona.com/blog/how-to-filter-or-customize-alert-notifications-in-percona-monitoring-and-management-subject-and-body/

 

How to Filter or Customize Alert Notifications in Percona Monitoring and Management (Subject and Body)

Learn to customize Percona Monitoring and Management alert notifications to fit your needs, tailoring the 'Subject' and 'Body' to be relevant to your needs.

www.percona.com

 

https://grafana.com/blog/2023/04/05/grafana-alerting-a-beginners-guide-to-templating-alert-notifications/

 

Grafana Alerting: A guide to templating alert notifications

Grafana Alerting: A beginner's guide to templating alert notifications We often see questions about how to template alerts. In Grafana, you can template information about your alerts with custom labels and annotations, and you can also template how notific

grafana.com

 

 

 

 

 

반응형