configure alertmanager smtp alert

This commit is contained in:
vincent 2023-10-07 17:34:17 +02:00
parent 614e237d45
commit a8637576eb
3 changed files with 33 additions and 1 deletions

View File

@ -5,7 +5,9 @@ job "alertmanager" {
meta { meta {
forcedeploy = "0" forcedeploy = "0"
} }
vault {
policies = ["alertmanager"]
}
group "alertmanager" { group "alertmanager" {
network { network {
mode = "host" mode = "host"
@ -39,8 +41,33 @@ job "alertmanager" {
config { config {
image = "prom/alertmanager" image = "prom/alertmanager"
args= ["--log.level=debug", "--config.file=/etc/alertmanager/alertmanager.yml"]
ports = ["http"] ports = ["http"]
volumes = [
"local/alertmanager.yml:/etc/alertmanager/alertmanager.yml"
]
}
template {
data = <<EOH
global:
smtp_from: alert@ducamps.eu
smtp_smarthost: 135.181.150.203:25
smtp_hello: "mail.ducamps.win"
smtp_require_tls: false
{{with secret "secrets/data/nomad/alertmanager/mail"}}
smtp_auth_username: {{.Data.data.username}}
smtp_auth_password: {{.Data.data.password}}
{{end}}
route:
group_by: ['alertname']
receiver: "default"
receivers:
- name: "default"
email_configs:
- to: "vincent@ducamps.eu"
EOH
destination = "local/alertmanager.yml"
} }
resources { resources {
memory = 75 memory = 75

View File

@ -166,6 +166,10 @@ groups:
severity: warning severity: warning
annotations: annotations:
summary: Nomad batch {{ $labels.parent_id}} error summary: Nomad batch {{ $labels.parent_id}} error
- alert: test gitea
expr: nomad_nomad_job_summary_running{exported_job="git"}==0
labels:
severity: warning
EOH EOH

View File

@ -21,6 +21,7 @@ locals {
"wikijs", "wikijs",
"vikunja", "vikunja",
"ghostfolio", "ghostfolio",
"alertmanager",
] ]
} }