# k8s/monitoring/dashboards/hardware-overview.yaml
# Trimmed operator at-a-glance view across all nodes — node-exporter already
# powers the deep-dive "Node Exporter Full" (#1860, see grafana-values.yaml),
# this is the quick health-check version, not a replacement for it.
apiVersion: v1
kind: ConfigMap
metadata:
  name: hardware-overview-dashboard
  namespace: logging
  labels:
    grafana_dashboard: "1"
data:
  hardware-overview.json: |
    {
      "title": "Hardware Statistics (Operator Overview)",
      "uid": "hardware-overview",
      "schemaVersion": 39,
      "timezone": "browser",
      "time": { "from": "now-6h", "to": "now" },
      "refresh": "30s",
      "panels": [
        {
          "id": 1,
          "title": "Nodes up / down",
          "type": "stat",
          "gridPos": { "h": 5, "w": 24, "x": 0, "y": 0 },
          "datasource": { "type": "prometheus", "uid": "prometheus" },
          "fieldConfig": {
            "defaults": {
              "mappings": [
                { "type": "value", "options": { "0": { "text": "DOWN", "color": "red" } } },
                { "type": "value", "options": { "1": { "text": "UP", "color": "green" } } }
              ]
            }
          },
          "targets": [
            { "expr": "up{job=~\".*node-exporter.*\"}", "legendFormat": "{{instance}}" }
          ]
        },
        {
          "id": 2,
          "title": "CPU usage % by node",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 0, "y": 5 },
          "datasource": { "type": "prometheus", "uid": "prometheus" },
          "fieldConfig": { "defaults": { "unit": "percent", "max": 100, "min": 0 } },
          "targets": [
            {
              "expr": "(1 - avg(rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) by (instance)) * 100",
              "legendFormat": "{{instance}}"
            }
          ]
        },
        {
          "id": 3,
          "title": "Memory usage % by node",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 12, "y": 5 },
          "datasource": { "type": "prometheus", "uid": "prometheus" },
          "fieldConfig": { "defaults": { "unit": "percent", "max": 100, "min": 0 } },
          "targets": [
            {
              "expr": "(1 - node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) * 100",
              "legendFormat": "{{instance}}"
            }
          ]
        },
        {
          "id": 4,
          "title": "Root filesystem usage % by node",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 0, "y": 13 },
          "datasource": { "type": "prometheus", "uid": "prometheus" },
          "fieldConfig": { "defaults": { "unit": "percent", "max": 100, "min": 0 } },
          "targets": [
            {
              "expr": "(1 - node_filesystem_avail_bytes{mountpoint=\"/\"} / node_filesystem_size_bytes{mountpoint=\"/\"}) * 100",
              "legendFormat": "{{instance}}"
            }
          ]
        },
        {
          "id": 5,
          "title": "Root filesystem space remaining",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 12, "y": 13 },
          "datasource": { "type": "prometheus", "uid": "prometheus" },
          "fieldConfig": { "defaults": { "unit": "bytes" } },
          "targets": [
            {
              "expr": "node_filesystem_avail_bytes{mountpoint=\"/\"}",
              "legendFormat": "{{instance}}"
            }
          ]
        },
        {
          "id": 6,
          "title": "Network errors/drops by node",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 0, "y": 21 },
          "datasource": { "type": "prometheus", "uid": "prometheus" },
          "targets": [
            { "expr": "rate(node_network_receive_errs_total[5m])", "legendFormat": "{{instance}} rx errs" },
            { "expr": "rate(node_network_transmit_errs_total[5m])", "legendFormat": "{{instance}} tx errs" },
            { "expr": "rate(node_network_receive_drop_total[5m])", "legendFormat": "{{instance}} rx drops" },
            { "expr": "rate(node_network_transmit_drop_total[5m])", "legendFormat": "{{instance}} tx drops" }
          ]
        },
        {
          "id": 7,
          "title": "Load average (1m / 5m) by node",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 12, "y": 21 },
          "datasource": { "type": "prometheus", "uid": "prometheus" },
          "targets": [
            { "expr": "node_load1", "legendFormat": "{{instance}} load1" },
            { "expr": "node_load5", "legendFormat": "{{instance}} load5" }
          ]
        }
      ]
    }
