feat: organize Grafana dashboards into folders
Enable sidecar folderAnnotation + foldersFromFilesStructure to group 26 dashboards into 5 managed folders: - Cluster (6): k8s health, API server, nodes, pods, kube-state-metrics - Networking (6): CoreDNS, Technitium, Headscale, ingress, network traffic - Hardware (5): node-exporter, proxmox, iDRAC, UPS, NVIDIA GPU - Operations (4): backup health, registry, audit logs, Loki - Applications (2): realestate-crawler, qBittorrent Dashboard-to-folder mapping defined in grafana.tf locals block. External stacks (headscale, technitium) annotated individually.
This commit is contained in:
parent
9c49d4c39b
commit
4b3851829b
4 changed files with 47 additions and 0 deletions
|
|
@ -433,6 +433,9 @@ resource "kubernetes_config_map" "grafana_headscale_dashboard" {
|
||||||
labels = {
|
labels = {
|
||||||
grafana_dashboard = "1"
|
grafana_dashboard = "1"
|
||||||
}
|
}
|
||||||
|
annotations = {
|
||||||
|
grafana_folder = "Networking"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
data = {
|
data = {
|
||||||
"headscale.json" = file("${path.module}/dashboards/headscale.json")
|
"headscale.json" = file("${path.module}/dashboards/headscale.json")
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,41 @@ resource "kubernetes_manifest" "grafana_db_creds" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
locals {
|
||||||
|
# Dashboard folder assignments
|
||||||
|
dashboard_folders = {
|
||||||
|
# Cluster & Kubernetes
|
||||||
|
"api_server.json" = "Cluster"
|
||||||
|
"cluster_health.json" = "Cluster"
|
||||||
|
"nodes.json" = "Cluster"
|
||||||
|
"pods.json" = "Cluster"
|
||||||
|
"kube-state-metrics.json" = "Cluster"
|
||||||
|
# Networking & DNS
|
||||||
|
"caretta-dashboard.json" = "Networking"
|
||||||
|
"core_dns.json" = "Networking"
|
||||||
|
"technitium-dns.json" = "Networking"
|
||||||
|
"nginx_ingress.json" = "Networking"
|
||||||
|
"network_traffic.json" = "Networking"
|
||||||
|
|
||||||
|
# Hardware & Host
|
||||||
|
"node_exporter_full.json" = "Hardware"
|
||||||
|
"proxmox_node_exporter.json" = "Hardware"
|
||||||
|
"idrac.json" = "Hardware"
|
||||||
|
"ups.json" = "Hardware"
|
||||||
|
"nvidia.json" = "Hardware"
|
||||||
|
|
||||||
|
# Operations
|
||||||
|
"backup_health.json" = "Operations"
|
||||||
|
"registry.json" = "Operations"
|
||||||
|
"loki.json" = "Operations"
|
||||||
|
"k8s-audit.json" = "Operations"
|
||||||
|
|
||||||
|
# Applications
|
||||||
|
"qbittorrent.json" = "Applications"
|
||||||
|
"realestate-crawler.json" = "Applications"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resource "kubernetes_config_map" "grafana_dashboards" {
|
resource "kubernetes_config_map" "grafana_dashboards" {
|
||||||
for_each = fileset("${path.module}/dashboards", "*.json")
|
for_each = fileset("${path.module}/dashboards", "*.json")
|
||||||
|
|
||||||
|
|
@ -111,6 +146,9 @@ resource "kubernetes_config_map" "grafana_dashboards" {
|
||||||
labels = {
|
labels = {
|
||||||
grafana_dashboard = "1"
|
grafana_dashboard = "1"
|
||||||
}
|
}
|
||||||
|
annotations = {
|
||||||
|
grafana_folder = lookup(local.dashboard_folders, each.value, "General")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
data = {
|
data = {
|
||||||
(each.value) = file("${path.module}/dashboards/${each.value}")
|
(each.value) = file("${path.module}/dashboards/${each.value}")
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,9 @@ sidecar:
|
||||||
dashboards:
|
dashboards:
|
||||||
enabled: true
|
enabled: true
|
||||||
label: "grafana_dashboard"
|
label: "grafana_dashboard"
|
||||||
|
folderAnnotation: "grafana_folder"
|
||||||
|
provider:
|
||||||
|
foldersFromFilesStructure: true
|
||||||
dashboardProviders:
|
dashboardProviders:
|
||||||
dashboardproviders.yaml:
|
dashboardproviders.yaml:
|
||||||
apiVersion: 1
|
apiVersion: 1
|
||||||
|
|
|
||||||
|
|
@ -352,6 +352,9 @@ resource "kubernetes_config_map" "grafana_technitium_dashboard" {
|
||||||
labels = {
|
labels = {
|
||||||
grafana_dashboard = "1"
|
grafana_dashboard = "1"
|
||||||
}
|
}
|
||||||
|
annotations = {
|
||||||
|
grafana_folder = "Networking"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
data = {
|
data = {
|
||||||
"technitium-dns.json" = file("${path.module}/dashboards/technitium-dns.json")
|
"technitium-dns.json" = file("${path.module}/dashboards/technitium-dns.json")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue