# Modules for Grafana alerts and dashboards ## Alerting Please check documentation about Grafana alerting [here](https://itdoc.schwarz/x/X11nf) and [official documentation](https://grafana.com/docs/grafana/latest/alerting/) for deeper look. The Terraform modules are separated per resource type, check README in each module directory for spefic examples. Below is example for alerts using „**Prometheus/Thanos**“ datasorce and sending notification to „**Google Chat**“. ```hcl title="main.tf" # Datasource module "datasource" { source = "git::https://commerce-platform.git.onstackit.cloud/commerce-platform-public/terraform-modules//grafana/datasource?ref=main" datasource_name = "Thanos - Myteam" datasource_url = var.datasource_url datasource_username = var.datasource_username datasource_password = var.datasource_password } # Alert Receiver / Contact Point module "google-chat-contact-point" { source = "git::https://commerce-platform.git.onstackit.cloud/commerce-platform-public/terraform-modules//grafana/contact-point-gchat?ref=main" google-chat-url = var.google_chat_url contact-point-name = "gchat" } # Alert Rule Folders module "alert-folder" { source = "git::https://commerce-platform.git.onstackit.cloud/commerce-platform-public/terraform-modules//grafana/alert-folder?ref=main" alert-folder = "Alerts" } # Template for messages module "message-templates" { source = "git::https://commerce-platform.git.onstackit.cloud/commerce-platform-public/terraform-modules//grafana/message-template?ref=main" templates_dir = "templates" disable_provenance = true } # Notification policies module "notification-policy" { source = "git::https://commerce-platform.git.onstackit.cloud/commerce-platform-public/terraform-modules//grafana/notification-policy?ref=main" default_contact_point_uid = module.google-chat-contact-point.contact_name group_by = ["alertname"] folder_policies = { "Alerts" = module.google-chat-contact-point.contact_name } } # Alert definition module "alerting" { source = "git::https://commerce-platform.git.onstackit.cloud/commerce-platform-public/terraform-modules//grafana/alerts?ref=main" alerts_dir = "alerts" default_datasource_uid = module.datasource.datasource_uid default_receiver = module.google-chat-contact-point.contact_name default_folder_uid = module.alert-folder.folder_uid default_interval_seconds = 60 disable_provenance = true } ``` With this configuration you need to place your notification templates into `templates` folder and alert definitions in YAML format to `alerts` folder in same directoty where `main.tf`is located. You can example for both in [examples](./examples/) folder. ## Dashboard TODO