{{ define "teams.card" }} { "@type": "MessageCard", "@context": "http://schema.org/extensions", "summary": "{{ .CommonAnnotations.summary }}", "themeColor": "0078D7", "title": "🚨 {{ .CommonAnnotations.summary }}", "sections": [ {{- /* add 함수 대신 .CommonAnnotations를 사용하여 쉼표를 처리하는 안정적인 방식 */ -}} {{- range .Alerts }} { "activityTitle": "{{ .Annotations.description }}", "facts": [ { "name": "상태", "value": "**{{ printf "%.0f" .Annotations.value }}%**" }, { "name": "심각도", "value": "{{ .Labels.severity }}" }, { "name": "호스트명", "value": "{{ .Labels.hostname }}" }, { "name": "IP 주소", "value": "{{ .Labels.ip }}" }, { "name": "발생 일시", "value": "{{ .StartsAt }}" } ], "markdown": true } {{- if .CommonAnnotations -}},{{- end }} {{- end }} ], "potentialAction": [ { "@type": "OpenUri", "name": "Grafana에서 보기", "targets": [ { "os": "default", "uri": "{{ .CommonAnnotations.runbook_url }}" } ] } ] } {{ end }}