https://registry.terraform.io/modules/dasmeta/grafana/onpremise/latest
This module is created to manage OnPremise Grafana stack with Terraform. At this moment we support managing
- Grafana Dashboard with
dashboard
submodule - Grafana Alerts with
alerts
submodule - Grafana Contact Points with
contact-points
submodule - Grafana Notification Policies with
notifications
submodule
More parts are coming soon.
module "grafana_monitoring" {
source = "dasmeta/grafana/onpremise"
version = "1.7.0"
name = "Test-dashboard"
application_dashboard = {
rows : [
{ type : "block/sla" },
{ type : "block/ingress" },
{ type : "block/service", name : "service-name-1", host : "example.com" },
{ type : "block/service", name : "service-name-2" },
{ type : "block/service", name : "service-name-3" }
]
data_source = {
uid : "00000"
}
variables = [
{
"name" : "namespace",
"options" : [
{
"selected" : true,
"value" : "prod"
},
{
"value" : "stage"
},
{
"value" : "dev"
}
],
}
]
}
}
module "grafana_alerts" {
source = "dasmeta/grafana/onpremise//modules/alerts"
version = "1.7.0"
alerts = {
rules = [
{
name = "App_1 has 0 available replicas"
folder_name = "Replica Count"
datasource = "prometheus"
metric_name = "kube_deployment_status_replicas_available"
filters = {
deployment = "app-1-microservice"
}
function = "last"
equation = "lt"
threshold = 1
},
{
name = "Nginx Expressions"
folder_name = "Nginx Expressions Group"
datasource = "prometheus"
expr = "sum(rate(nginx_ingress_controller_requests{status=~'5..'}[1m])) by (ingress,cluster) / sum(rate(nginx_ingress_controller_requests[1m]))by (ingress) * 100 > 5"
function = "mean"
equation = "gt"
threshold = 2
},
]
contact_points = {
opsgenie = [
{
name = "opsgenie"
api_key = "xxxxxxxxxxxxxxxx"
auto_close = true
}
]
slack = [
{
name = "slack"
webhook_url = "https://hooks.slack.com/services/xxxxxxxxxxxxxxxx"
}
]
}
notifications = {
contact_point : "slack"
"policies" : [
{
contact_point : "opsgenie"
matchers : [{ label : "priority", match : "=", value : "P1" }]
},
{
"contact_point" : "slack"
}
]
}
}
}
Check ./tests
, modules/alert-rules/tests
, modules/alert-contact-points/tests
and modules/alert-notifications/tests
folders to see more examples.
Name | Version |
---|---|
terraform | >= 1.3.0 |
grafana | >= 3.7.0 |
No providers.
Name | Source | Version |
---|---|---|
alerts | ./modules/alerts | n/a |
application_dashboard | ./modules/dashboard/ | n/a |
No resources.
Name | Description | Type | Default | Required |
---|---|---|---|---|
alerts | n/a | object({ |
{} |
no |
application_dashboard | Dashboard for monitoring applications | object({ |
{ |
no |
name | Dashboard name | string |
n/a | yes |
Name | Description |
---|---|
data | n/a |