feat: add unified homelab observability dashboard
This commit is contained in:
parent
37267e2e30
commit
4ed2ebdf4f
|
|
@ -70,6 +70,21 @@ services:
|
||||||
- /sys:/host/sys:ro
|
- /sys:/host/sys:ro
|
||||||
- /:/rootfs:ro
|
- /:/rootfs:ro
|
||||||
|
|
||||||
|
cadvisor:
|
||||||
|
image: gcr.io/cadvisor/cadvisor:v0.49.1
|
||||||
|
restart: unless-stopped
|
||||||
|
privileged: true
|
||||||
|
ports:
|
||||||
|
- "0.0.0.0:9101:8080/tcp"
|
||||||
|
devices:
|
||||||
|
- /dev/kmsg:/dev/kmsg
|
||||||
|
volumes:
|
||||||
|
- /:/rootfs:ro
|
||||||
|
- /var/run:/var/run:ro
|
||||||
|
- /sys:/sys:ro
|
||||||
|
- /var/lib/docker:/var/lib/docker:ro
|
||||||
|
- /dev/disk:/dev/disk:ro
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
nginx_cache:
|
nginx_cache:
|
||||||
nginx_dynamic_cache:
|
nginx_dynamic_cache:
|
||||||
|
|
|
||||||
|
|
@ -372,6 +372,21 @@ resource "oci_core_network_security_group_security_rule" "edge_monitoring" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "oci_core_network_security_group_security_rule" "edge_container_monitoring" {
|
||||||
|
count = var.enabled && var.edge_enabled && var.monitoring_enabled ? 1 : 0
|
||||||
|
network_security_group_id = oci_core_network_security_group.edge[0].id
|
||||||
|
direction = "INGRESS"
|
||||||
|
protocol = "6"
|
||||||
|
source = trimspace(var.monitoring_cidr) != "" ? var.monitoring_cidr : var.admin_cidr
|
||||||
|
source_type = "CIDR_BLOCK"
|
||||||
|
tcp_options {
|
||||||
|
destination_port_range {
|
||||||
|
min = 9101
|
||||||
|
max = 9101
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resource "oci_core_network_security_group_security_rule" "email_monitoring" {
|
resource "oci_core_network_security_group_security_rule" "email_monitoring" {
|
||||||
count = var.enabled && var.email_enabled && var.monitoring_enabled ? 1 : 0
|
count = var.enabled && var.email_enabled && var.monitoring_enabled ? 1 : 0
|
||||||
network_security_group_id = oci_core_network_security_group.email[0].id
|
network_security_group_id = oci_core_network_security_group.email[0].id
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
{
|
||||||
|
"annotations": {"list": []},
|
||||||
|
"editable": true,
|
||||||
|
"graphTooltip": 1,
|
||||||
|
"id": null,
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||||
|
"fieldConfig": {"defaults": {"color": {"mode": "thresholds"}, "thresholds": {"mode": "absolute", "steps": [{"color": "red", "value": null}, {"color": "green", "value": 1}]}}, "overrides": []},
|
||||||
|
"gridPos": {"h": 5, "w": 6, "x": 0, "y": 0},
|
||||||
|
"id": 1,
|
||||||
|
"options": {"colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
|
||||||
|
"targets": [{"expr": "sum(up{job=~\"oci-edge-node|oci-email-node|oci-edge-containers|rpi-node|jeannie-self-heal\"})", "refId": "A"}],
|
||||||
|
"title": "External Monitoring Targets Up",
|
||||||
|
"type": "stat"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||||
|
"fieldConfig": {"defaults": {"unit": "percent", "min": 0, "max": 100}, "overrides": []},
|
||||||
|
"gridPos": {"h": 8, "w": 12, "x": 6, "y": 0},
|
||||||
|
"id": 2,
|
||||||
|
"targets": [{"expr": "100 - (avg by (instance, job) (rate(node_cpu_seconds_total{job=~\"oci-edge-node|oci-email-node|rpi-node\",mode=\"idle\"}[5m])) * 100)", "legendFormat": "{{job}} {{instance}}", "refId": "A"}],
|
||||||
|
"title": "VM CPU Utilization",
|
||||||
|
"type": "timeseries"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||||
|
"fieldConfig": {"defaults": {"unit": "bytes", "min": 0}, "overrides": []},
|
||||||
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 8},
|
||||||
|
"id": 3,
|
||||||
|
"targets": [{"expr": "(1 - node_memory_MemAvailable_bytes{job=~\"oci-edge-node|oci-email-node|rpi-node\"} / node_memory_MemTotal_bytes{job=~\"oci-edge-node|oci-email-node|rpi-node\"}) * node_memory_MemTotal_bytes{job=~\"oci-edge-node|oci-email-node|rpi-node\"}", "legendFormat": "{{job}} {{instance}}", "refId": "A"}],
|
||||||
|
"title": "VM Memory Used",
|
||||||
|
"type": "timeseries"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||||
|
"fieldConfig": {"defaults": {"unit": "percent", "min": 0, "max": 100}, "overrides": []},
|
||||||
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 8},
|
||||||
|
"id": 4,
|
||||||
|
"targets": [{"expr": "100 * (1 - node_filesystem_avail_bytes{job=~\"oci-edge-node|oci-email-node|rpi-node\",fstype!~\"tmpfs|overlay|squashfs\"} / node_filesystem_size_bytes{job=~\"oci-edge-node|oci-email-node|rpi-node\",fstype!~\"tmpfs|overlay|squashfs\"})", "legendFormat": "{{job}} {{instance}} {{mountpoint}}", "refId": "A"}],
|
||||||
|
"title": "VM Filesystem Used",
|
||||||
|
"type": "timeseries"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||||
|
"fieldConfig": {"defaults": {"unit": "cores", "min": 0}, "overrides": []},
|
||||||
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 16},
|
||||||
|
"id": 5,
|
||||||
|
"targets": [{"expr": "sum by (name) (rate(container_cpu_usage_seconds_total{container!=\"\",image!=\"\"}[5m]))", "legendFormat": "{{name}}", "refId": "A"}],
|
||||||
|
"title": "Kubernetes Container CPU",
|
||||||
|
"type": "timeseries"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||||
|
"fieldConfig": {"defaults": {}, "overrides": []},
|
||||||
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 16},
|
||||||
|
"id": 6,
|
||||||
|
"targets": [{"expr": "ALERTS{alertstate=\"firing\"}", "legendFormat": "{{alertname}} {{instance}}", "refId": "A"}],
|
||||||
|
"title": "Firing Alerts",
|
||||||
|
"type": "table"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refresh": "30s",
|
||||||
|
"schemaVersion": 39,
|
||||||
|
"tags": ["homelab", "overview", "oci"],
|
||||||
|
"templating": {"list": []},
|
||||||
|
"time": {"from": "now-6h", "to": "now"},
|
||||||
|
"title": "Homelab Overview",
|
||||||
|
"uid": "homelab-overview",
|
||||||
|
"version": 1
|
||||||
|
}
|
||||||
|
|
@ -2078,6 +2078,14 @@ resource "helm_release" "prometheus_stack" {
|
||||||
}]
|
}]
|
||||||
metrics_path = "/metrics"
|
metrics_path = "/metrics"
|
||||||
scheme = "http"
|
scheme = "http"
|
||||||
|
}], var.oci_edge_container_metrics_target == "" ? [] : [{
|
||||||
|
job_name = "oci-edge-containers"
|
||||||
|
static_configs = [{
|
||||||
|
targets = [var.oci_edge_container_metrics_target]
|
||||||
|
labels = { host_group = "public-edge" }
|
||||||
|
}]
|
||||||
|
metrics_path = "/metrics"
|
||||||
|
scheme = "http"
|
||||||
}], var.oci_email_metrics_target == "" ? [] : [{
|
}], var.oci_email_metrics_target == "" ? [] : [{
|
||||||
job_name = "oci-email-node"
|
job_name = "oci-email-node"
|
||||||
static_configs = [{
|
static_configs = [{
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,12 @@ variable "oci_edge_metrics_target" {
|
||||||
default = ""
|
default = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "oci_edge_container_metrics_target" {
|
||||||
|
description = "Optional private/restricted host:port for the OCI edge cAdvisor endpoint."
|
||||||
|
type = string
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
variable "oci_email_metrics_target" {
|
variable "oci_email_metrics_target" {
|
||||||
description = "Optional private/restricted host:port for the OCI email VM node exporter."
|
description = "Optional private/restricted host:port for the OCI email VM node exporter."
|
||||||
type = string
|
type = string
|
||||||
|
|
|
||||||
|
|
@ -4028,6 +4028,7 @@ oci_foundation_manage() {
|
||||||
fi
|
fi
|
||||||
if [[ -n "${discovered_edge_ip}" && "${discovered_edge_ip}" != "null" ]]; then
|
if [[ -n "${discovered_edge_ip}" && "${discovered_edge_ip}" != "null" ]]; then
|
||||||
export LAB_OCI_EDGE_METRICS_TARGET="${discovered_edge_ip}:9100"
|
export LAB_OCI_EDGE_METRICS_TARGET="${discovered_edge_ip}:9100"
|
||||||
|
export LAB_OCI_EDGE_CONTAINER_METRICS_TARGET="${discovered_edge_ip}:9101"
|
||||||
fi
|
fi
|
||||||
oci_foundation_save_config
|
oci_foundation_save_config
|
||||||
if ((post_apply_failures > 0)); then
|
if ((post_apply_failures > 0)); then
|
||||||
|
|
|
||||||
|
|
@ -283,6 +283,7 @@ export_homelab_inventory_tf_vars() {
|
||||||
export_if_unset TF_VAR_jeannie_api_metrics_target "${LAB_JEANNIE_API_METRICS_TARGET:-api.${LAB_DOMAIN:-lab2025.duckdns.org}:443}"
|
export_if_unset TF_VAR_jeannie_api_metrics_target "${LAB_JEANNIE_API_METRICS_TARGET:-api.${LAB_DOMAIN:-lab2025.duckdns.org}:443}"
|
||||||
export_if_unset TF_VAR_jeannie_api_metrics_token "${JEANNIE_SERVER_TOKEN:-${JEANNIE_REMOTE_TOKEN:-}}"
|
export_if_unset TF_VAR_jeannie_api_metrics_token "${JEANNIE_SERVER_TOKEN:-${JEANNIE_REMOTE_TOKEN:-}}"
|
||||||
export_if_unset TF_VAR_oci_edge_metrics_target "${LAB_OCI_EDGE_METRICS_TARGET:-}"
|
export_if_unset TF_VAR_oci_edge_metrics_target "${LAB_OCI_EDGE_METRICS_TARGET:-}"
|
||||||
|
export_if_unset TF_VAR_oci_edge_container_metrics_target "${LAB_OCI_EDGE_CONTAINER_METRICS_TARGET:-}"
|
||||||
export_if_unset TF_VAR_oci_email_metrics_target "${LAB_OCI_EMAIL_METRICS_TARGET:-}"
|
export_if_unset TF_VAR_oci_email_metrics_target "${LAB_OCI_EMAIL_METRICS_TARGET:-}"
|
||||||
export_if_unset TF_VAR_backend_host "${LAB_TRAEFIK_LB_IP:-}"
|
export_if_unset TF_VAR_backend_host "${LAB_TRAEFIK_LB_IP:-}"
|
||||||
export_if_unset TF_VAR_gitea_backend_host "${LAB_GITEA_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-}}"
|
export_if_unset TF_VAR_gitea_backend_host "${LAB_GITEA_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-}}"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue