Add Prometheus and Alertmanager configurations: implement custom rules, alerting, and Telegram notifications

This commit is contained in:
2025-10-04 18:05:10 +02:00
parent 7cad175406
commit 0d3fb56f78
23 changed files with 416 additions and 235 deletions
@@ -11,15 +11,9 @@ variable "retention_time" {
}
variable "rules" {
description = "Prometheus alerting rules"
type = list(object({
alert = string
expr = string
for = string
labels = map(string)
annotations = map(string)
}))
default = []
description = "Prometheus alerting rules in YAML format"
type = string
default = ""
}
variable "config" {
@@ -32,3 +26,44 @@ variable "persistent_folder" {
description = "The path to the persistent folder"
type = string
}
variable "alertmanager_config" {
description = "Custom Alertmanager configuration in YAML format"
type = string
default = ""
}
variable "cluster_name" {
description = "The name of the Kubernetes cluster"
type = string
default = "kubernetes"
}
variable "email_config" {
description = "Email configuration for Alertmanager in YAML format"
type = object({
to = optional(string, "root@localhost")
from = optional(string, "root@localhost")
smarthost = optional(string, "localhost:25")
auth_username = optional(string, "")
auth_password = optional(string, "")
})
default = {
to = "root@localhost"
from = "root@localhost"
smarthost = "localhost:25"
auth_username = ""
auth_password = ""
}
}
variable "telegram_config" {
description = "Telegram configuration for Alertmanager in YAML format"
type = object({
bot_token = string
chat_id = string
parse_mode = optional(string, "HTML")
message = optional(string, "")
})
default = null
}