homelab/nomad-job/platform/alertmanager.nomad

84 lines
1.9 KiB
Plaintext
Raw Normal View History

2022-05-13 18:17:20 +00:00
job "alertmanager" {
datacenters = ["homelab"]
2022-10-29 08:40:01 +00:00
type = "service"
2022-05-13 18:17:20 +00:00
meta {
forcedeploy = "0"
}
2023-10-07 15:34:17 +00:00
vault {
policies = ["alertmanager"]
}
2024-02-21 18:03:31 +00:00
constraint {
attribute = "${node.class}"
operator = "set_contains"
value = "cluster"
}
2022-10-29 08:40:01 +00:00
group "alertmanager" {
2022-05-13 18:17:20 +00:00
network {
mode = "host"
port "http" {
static = 9093
}
}
task "alertmanager" {
driver = "docker"
service {
name = "alertmanager"
port = "http"
2022-05-23 19:44:34 +00:00
tags = [
"urlprefix-/alertmanager strip=/alertmanager",
"homer.enable=true",
"homer.name=AlertManager",
"homer.service=Monitoring",
2024-04-12 06:56:12 +00:00
"homer.logo=http://${NOMAD_ADDR_http}/favicon.ico",
2022-05-23 19:44:34 +00:00
"homer.target=_blank",
"homer.url=http://${NOMAD_ADDR_http}",
2022-10-29 08:40:01 +00:00
]
2022-05-13 18:17:20 +00:00
check {
name = "alertmanager_ui port alive"
type = "http"
path = "/-/healthy"
interval = "10s"
timeout = "2s"
}
}
config {
2024-03-17 17:58:24 +00:00
image = "docker.service.consul:5000/prom/alertmanager"
2023-10-07 15:34:17 +00:00
args= ["--log.level=debug", "--config.file=/etc/alertmanager/alertmanager.yml"]
2022-05-13 18:17:20 +00:00
ports = ["http"]
2023-10-07 15:34:17 +00:00
volumes = [
"local/alertmanager.yml:/etc/alertmanager/alertmanager.yml"
]
}
2022-05-13 18:17:20 +00:00
2023-10-07 15:34:17 +00:00
template {
data = <<EOH
global:
smtp_from: alert@ducamps.eu
2023-10-07 15:35:27 +00:00
smtp_smarthost: mail.ducamps.eu:465
smtp_hello: "mail.ducamps.eu"
2023-10-07 15:34:17 +00:00
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:
2023-10-08 14:50:19 +00:00
- send_resolved: true
to: "vincent@ducamps.eu"
2023-10-07 15:34:17 +00:00
EOH
destination = "local/alertmanager.yml"
2022-05-13 18:17:20 +00:00
}
resources {
memory = 75
}
}
}
}