Skip to content

Commit

Permalink
switch to workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesClonk committed Aug 7, 2024
1 parent 2b70fce commit 6feda22
Showing 4 changed files with 60 additions and 41 deletions.
6 changes: 3 additions & 3 deletions monitoring/prometheus-msteams/image.lock.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: kbld.k14s.io/v1alpha1
kind: Config
minimumRequiredVersion: 0.24.0
minimumRequiredVersion: 0.32.0
overrides:
- image: quay.io/prometheusmsteams/prometheus-msteams:v1.4.1
newImage: quay.io/prometheusmsteams/prometheus-msteams@sha256:c69cc0661eabf703694eb7a6e861d7b6c3333b0b8b153aa5e88a32b0ba21c97b
- image: docker.io/jamesclonk/prometheus-msteams:workflows
newImage: index.docker.io/jamesclonk/prometheus-msteams@sha256:476a9500b789fa4ec74ca2b73df26bdaaaa3b1b76b902e9b5837543a9d721291
preresolved: true
87 changes: 53 additions & 34 deletions monitoring/prometheus-msteams/templates/configmap.yml
Original file line number Diff line number Diff line change
@@ -16,15 +16,24 @@ data:
card.tmpl: |
{{ define "teams.card" }}
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "{{- if eq .Status "resolved" -}}2DC72D
{{- else if eq .Status "firing" -}}
{{- if eq .CommonLabels.severity "critical" -}}DD1A1A
{{- else if eq .CommonLabels.severity "warning" -}}FFA500
{{- else -}}808080{{- end -}}
{{- else -}}808080{{- end -}}",
"summary": "{{- if eq .CommonAnnotations.summary "" -}}
"type":"message",
"attachments":[
{
"contentType":"application/vnd.microsoft.card.adaptive",
"contentUrl":null,
"content":{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.6",
"body": [
{
"type": "TextBlock",
"text": "Prometheus Alert ({{ .Status | title }}) - {{ .CommonLabels.alertname }}{{- if .CommonLabels.job -}} for {{ .CommonLabels.job }}{{ end }}",
"size": "Large"
},
{
"type": "TextBlock",
"text": "{{- if eq .CommonAnnotations.summary "" -}}
{{- if eq .CommonAnnotations.message "" -}}
{{- if eq .CommonLabels.alertname "" -}}
Prometheus Alert
@@ -37,31 +46,41 @@ data:
{{- else -}}
{{- .CommonAnnotations.summary -}}
{{- end -}}",
"title": "Prometheus Alert ({{ .Status | title }}) - {{ .CommonLabels.alertname }}{{- if .CommonLabels.job -}} for {{ .CommonLabels.job }}{{ end }}",
"sections": [ {{$externalUrl := .ExternalURL}}
{{- range $index, $alert := .Alerts }}{{- if $index }},{{- end }}
{
"activityTitle": "[{{ $alert.Annotations.description }}]({{ $externalUrl }})",
"facts": [
{{- range $key, $value := $alert.Annotations }}
{
{{- if ne $key "description" -}}
"name": "{{ $key }}",
"value": "{{ $value }}"
{{- end -}}
},
{{- end -}}
{{$c := counter}}{{ range $key, $value := $alert.Labels }}{{if call $c}},{{ end }}
{
"name": "{{ $key }}",
"value": "{{ $value }}"
}
{{- end }}
],
"markdown": true
}
{{- end }}
]
"weight": "Bolder",
"color": "Warning",
"fontType": "Monospace",
"size": "Medium",
"isSubtle": false,
"separator": true,
"wrap": true
}{{$externalUrl := .ExternalURL}}
{{- range $index, $alert := .Alerts }}
,{
"type": "TextBlock",
"text": "[{{ $alert.Annotations.description }}]({{ $externalUrl }})",
"size": "Medium",
"fontType": "Monospace",
"separator": true
}
{{- range $key, $value := $alert.Annotations }}
,{
"type": "TextBlock",
"text": "**{{ $key }}**: {{ $value }}",
"size": "Small"
}
{{- end }}
{{- range $key, $value := $alert.Labels }}
,{
"type": "TextBlock",
"text": "**{{ $key }}**: {{ $value }}",
"size": "Small"
}
{{- end }}
{{- end }}
]
}
}
]
}
{{ end }}
#@ end
2 changes: 1 addition & 1 deletion monitoring/prometheus-msteams/templates/deployment.yml
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ spec:
affinity: #@ podAntiAffinity()
containers:
- name: msteams
image: "quay.io/prometheusmsteams/prometheus-msteams:v1.4.1"
image: "docker.io/jamesclonk/prometheus-msteams:workflows"
securityContext:
privileged: false
allowPrivilegeEscalation: false
Loading

0 comments on commit 6feda22

Please sign in to comment.