Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Runbook URL on alertmanager template #124

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ The following providers are used by this module:

- [[provider_random]] <<provider_random,random>> (>= 3)

- [[provider_null]] <<provider_null,null>> (>= 3)

- [[provider_kubernetes]] <<provider_kubernetes,kubernetes>> (>= 2)

- [[provider_utils]] <<provider_utils,utils>> (>= 1)

- [[provider_argocd]] <<provider_argocd,argocd>> (>= 5)

- [[provider_null]] <<provider_null,null>> (>= 3)

=== Resources

The following resources are used by this module:
Expand Down Expand Up @@ -358,10 +358,10 @@ Description: The admin password for Grafana.
[cols="a,a",options="header,autowidth"]
|===
|Name |Version
|[[provider_random]] <<provider_random,random>> |>= 3
|[[provider_null]] <<provider_null,null>> |>= 3
|[[provider_argocd]] <<provider_argocd,argocd>> |>= 5
|[[provider_kubernetes]] <<provider_kubernetes,kubernetes>> |>= 2
|[[provider_random]] <<provider_random,random>> |>= 3
|[[provider_utils]] <<provider_utils,utils>> |>= 1
|===

Expand Down
39 changes: 21 additions & 18 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,27 @@ locals {

alertmanager_template_files = length(local.alertmanager.slack_routes) > 0 ? {
"slack.tmpl" = <<-EOT
{{ define "slack.title" -}}
[{{ .Status | toUpper }}
{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{- end -}}
] {{ .CommonLabels.alertname }}
{{ end }}
{{ define "slack.text" -}}
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
{{- if .Annotations.description }}
*Severity:* `{{ .Labels.severity }}`
*Description:* {{ .Annotations.description }}
{{- end }}
*Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:>
*Labels:*
{{ range .Labels.SortedPairs }} - *{{ .Name }}:* `{{ .Value }}`
{{ end }}
{{ end }}
{{ end }}
{{ define "slack.title" -}}
[{{ .Status | toUpper }}
{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{- end -}}
] {{ .CommonLabels.alertname }}
{{ end }}
{{ define "slack.text" -}}
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
{{- if .Annotations.description }}
*Severity:* `{{ .Labels.severity }}`
*Description:* {{ .Annotations.description }}
{{- end }}
*Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:>
*Labels:*
{{ range .Labels.SortedPairs }} - *{{ .Name }}:* `{{ .Value }}`
{{ end }}
{{- if .Annotations.runbook_url }}
*Runbook URL:* <{{ .Annotations.runbook_url }}|Click here>
{{- end }}
{{ end }}
{{ end }}
EOT
} : {}

Expand Down