{
  "uid": "incus-instance-deep-dive",
  "title": "Instance Deep Dive",
  "description": "Single-instance drill-down: CPU, memory, network, and disk metrics with detailed timeseries and utilization gauges.",
  "tags": ["incus", "cluster", "containers"],
  "timezone": "browser",
  "schemaVersion": 39,
  "refresh": "30s",
  "time": { "from": "now-1h", "to": "now" },
  "fiscalYearStartMonth": 0,
  "liveNow": false,
  "editable": true,
  "graphTooltip": 1,
  "links": [
    {
      "asDropdown": true,
      "icon": "external link",
      "includeVars": true,
      "keepTime": true,
      "tags": ["incus"],
      "targetBlank": false,
      "title": "Incus Dashboards",
      "tooltip": "Navigate to other Incus dashboards",
      "type": "dashboards"
    },
    {
      "title": "Back to Cluster Overview",
      "url": "/d/incus-cluster-overview?${__url_time_range}",
      "targetBlank": false,
      "type": "link",
      "icon": "arrow-left"
    }
  ],
  "templating": {
    "list": [
      {
        "current": {},
        "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
        "definition": "label_values(incus_cpu_effective_total, name)",
        "includeAll": false,
        "multi": false,
        "name": "instance",
        "query": "label_values(incus_cpu_effective_total, name)",
        "refresh": 2,
        "regex": "",
        "sort": 1,
        "type": "query",
        "label": "Instance"
      }
    ]
  },
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": { "type": "grafana", "uid": "-- Grafana --" },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "panels": [
    {
      "type": "row",
      "title": "Instance Status",
      "collapsed": false,
      "gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 },
      "id": 1,
      "panels": []
    },
    {
      "type": "stat",
      "title": "Processes",
      "description": "Number of running processes in this instance.",
      "gridPos": { "h": 4, "w": 6, "x": 0, "y": 1 },
      "id": 2,
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [
        {
          "expr": "incus_procs_total{name=~\"$instance\"}",
          "legendFormat": "Processes",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "thresholds": {
            "mode": "absolute",
            "steps": [{ "color": "green", "value": null }]
          },
          "unit": "short",
          "color": { "mode": "thresholds" }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
        "orientation": "auto",
        "textMode": "auto",
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto"
      }
    },
    {
      "type": "stat",
      "title": "Effective CPUs",
      "description": "Number of effective CPUs allocated to this instance.",
      "gridPos": { "h": 4, "w": 6, "x": 6, "y": 1 },
      "id": 3,
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [
        {
          "expr": "incus_cpu_effective_total{name=~\"$instance\"}",
          "legendFormat": "CPUs",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "thresholds": {
            "mode": "absolute",
            "steps": [{ "color": "green", "value": null }]
          },
          "unit": "none",
          "color": { "mode": "thresholds" }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
        "orientation": "auto",
        "textMode": "auto",
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto"
      }
    },
    {
      "type": "stat",
      "title": "Total Memory",
      "description": "Total memory allocated to this instance.",
      "gridPos": { "h": 4, "w": 6, "x": 12, "y": 1 },
      "id": 4,
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [
        {
          "expr": "incus_memory_MemTotal_bytes{name=~\"$instance\"}",
          "legendFormat": "Total Memory",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "thresholds": {
            "mode": "absolute",
            "steps": [{ "color": "green", "value": null }]
          },
          "unit": "bytes",
          "color": { "mode": "thresholds" }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
        "orientation": "auto",
        "textMode": "auto",
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto"
      }
    },
    {
      "type": "gauge",
      "title": "Memory Utilization",
      "description": "Current memory utilization (Active / Total) for this instance.",
      "gridPos": { "h": 4, "w": 6, "x": 18, "y": 1 },
      "id": 5,
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [
        {
          "expr": "(incus_memory_Active_bytes{name=~\"$instance\"} / incus_memory_MemTotal_bytes{name=~\"$instance\"}) * 100",
          "legendFormat": "Utilization",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "green", "value": null },
              { "color": "yellow", "value": 60 },
              { "color": "orange", "value": 80 },
              { "color": "red", "value": 90 }
            ]
          },
          "unit": "percent",
          "min": 0,
          "max": 100,
          "color": { "mode": "thresholds" }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
        "showThresholdLabels": false,
        "showThresholdMarkers": true,
        "orientation": "auto"
      }
    },
    {
      "type": "row",
      "title": "CPU",
      "collapsed": false,
      "gridPos": { "h": 1, "w": 24, "x": 0, "y": 5 },
      "id": 10,
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "CPU Usage Over Time",
      "description": "Per-second CPU time consumed by this instance over time.",
      "gridPos": { "h": 8, "w": 24, "x": 0, "y": 6 },
      "id": 11,
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [
        {
          "expr": "sum by (name) (rate(incus_cpu_seconds_total{name=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "{{name}}",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "smooth",
            "lineWidth": 1,
            "fillOpacity": 25,
            "gradientMode": "scheme",
            "spanNulls": false,
            "showPoints": "never",
            "pointSize": 5,
            "stacking": { "mode": "none", "group": "A" },
            "axisPlacement": "auto",
            "axisLabel": "",
            "scaleDistribution": { "type": "linear" },
            "thresholdsStyle": { "mode": "off" }
          },
          "unit": "short",
          "color": { "mode": "palette-classic" },
          "thresholds": {
            "mode": "absolute",
            "steps": [{ "color": "green", "value": null }]
          }
        },
        "overrides": []
      },
      "options": {
        "tooltip": { "mode": "multi", "sort": "desc" },
        "legend": { "displayMode": "table", "placement": "right", "calcs": ["mean", "max", "lastNotNull"] }
      }
    },
    {
      "type": "row",
      "title": "Memory",
      "collapsed": false,
      "gridPos": { "h": 1, "w": 24, "x": 0, "y": 14 },
      "id": 20,
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "Active Memory Over Time",
      "description": "Active memory usage for this instance over time.",
      "gridPos": { "h": 8, "w": 14, "x": 0, "y": 15 },
      "id": 21,
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [
        {
          "expr": "incus_memory_Active_bytes{name=~\"$instance\"}",
          "legendFormat": "{{name}}",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "smooth",
            "lineWidth": 1,
            "fillOpacity": 15,
            "gradientMode": "none",
            "spanNulls": false,
            "showPoints": "never",
            "pointSize": 5,
            "stacking": { "mode": "none", "group": "A" },
            "axisPlacement": "auto",
            "axisLabel": "",
            "scaleDistribution": { "type": "linear" },
            "thresholdsStyle": { "mode": "off" }
          },
          "unit": "bytes",
          "color": { "mode": "palette-classic" },
          "thresholds": {
            "mode": "absolute",
            "steps": [{ "color": "green", "value": null }]
          }
        },
        "overrides": []
      },
      "options": {
        "tooltip": { "mode": "multi", "sort": "desc" },
        "legend": { "displayMode": "table", "placement": "right", "calcs": ["mean", "max", "lastNotNull"] }
      }
    },
    {
      "type": "timeseries",
      "title": "Memory Utilization %",
      "description": "Memory utilization percentage (Active / Total) for this instance over time.",
      "gridPos": { "h": 8, "w": 10, "x": 14, "y": 15 },
      "id": 22,
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [
        {
          "expr": "(incus_memory_Active_bytes{name=~\"$instance\"} / incus_memory_MemTotal_bytes{name=~\"$instance\"}) * 100",
          "legendFormat": "{{name}}",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "smooth",
            "lineWidth": 2,
            "fillOpacity": 25,
            "gradientMode": "scheme",
            "spanNulls": false,
            "showPoints": "never",
            "pointSize": 5,
            "stacking": { "mode": "none", "group": "A" },
            "axisPlacement": "auto",
            "axisLabel": "",
            "scaleDistribution": { "type": "linear" },
            "thresholdsStyle": { "mode": "line" }
          },
          "unit": "percent",
          "min": 0,
          "max": 100,
          "color": { "mode": "continuous-GrYlRd" },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "green", "value": null },
              { "color": "yellow", "value": 60 },
              { "color": "orange", "value": 80 },
              { "color": "red", "value": 90 }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "tooltip": { "mode": "multi", "sort": "desc" },
        "legend": { "displayMode": "table", "placement": "right", "calcs": ["mean", "max", "lastNotNull"] }
      }
    },
    {
      "type": "row",
      "title": "Network",
      "collapsed": false,
      "gridPos": { "h": 1, "w": 24, "x": 0, "y": 23 },
      "id": 30,
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "Network Traffic",
      "description": "Network receive and transmit throughput for this instance. Transmit is shown as negative (below axis).",
      "gridPos": { "h": 8, "w": 24, "x": 0, "y": 24 },
      "id": 31,
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [
        {
          "expr": "sum by (name) (rate(incus_network_receive_bytes_total{name=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "Receive",
          "refId": "A"
        },
        {
          "expr": "-sum by (name) (rate(incus_network_transmit_bytes_total{name=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "Transmit",
          "refId": "B"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "smooth",
            "lineWidth": 1,
            "fillOpacity": 15,
            "gradientMode": "none",
            "spanNulls": false,
            "showPoints": "never",
            "pointSize": 5,
            "stacking": { "mode": "none", "group": "A" },
            "axisPlacement": "auto",
            "axisLabel": "",
            "scaleDistribution": { "type": "linear" },
            "thresholdsStyle": { "mode": "off" }
          },
          "unit": "Bps",
          "color": { "mode": "palette-classic" },
          "thresholds": {
            "mode": "absolute",
            "steps": [{ "color": "green", "value": null }]
          }
        },
        "overrides": [
          {
            "matcher": { "id": "byName", "options": "Receive" },
            "properties": [
              { "id": "color", "value": { "mode": "fixed", "fixedColor": "green" } }
            ]
          },
          {
            "matcher": { "id": "byName", "options": "Transmit" },
            "properties": [
              { "id": "color", "value": { "mode": "fixed", "fixedColor": "blue" } }
            ]
          }
        ]
      },
      "options": {
        "tooltip": { "mode": "multi", "sort": "desc" },
        "legend": { "displayMode": "table", "placement": "right", "calcs": ["mean", "max", "lastNotNull"] }
      }
    },
    {
      "type": "row",
      "title": "Disk I/O",
      "collapsed": false,
      "gridPos": { "h": 1, "w": 24, "x": 0, "y": 32 },
      "id": 40,
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "Disk Read/Write Rate",
      "description": "Disk read and write throughput for this instance.",
      "gridPos": { "h": 8, "w": 24, "x": 0, "y": 33 },
      "id": 41,
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [
        {
          "expr": "sum by (name) (rate(incus_disk_read_bytes_total{name=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "Read",
          "refId": "A"
        },
        {
          "expr": "sum by (name) (rate(incus_disk_written_bytes_total{name=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "Write",
          "refId": "B"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "smooth",
            "lineWidth": 1,
            "fillOpacity": 15,
            "gradientMode": "none",
            "spanNulls": false,
            "showPoints": "never",
            "pointSize": 5,
            "stacking": { "mode": "none", "group": "A" },
            "axisPlacement": "auto",
            "axisLabel": "",
            "scaleDistribution": { "type": "linear" },
            "thresholdsStyle": { "mode": "off" }
          },
          "unit": "Bps",
          "color": { "mode": "palette-classic" },
          "thresholds": {
            "mode": "absolute",
            "steps": [{ "color": "green", "value": null }]
          }
        },
        "overrides": []
      },
      "options": {
        "tooltip": { "mode": "multi", "sort": "desc" },
        "legend": { "displayMode": "table", "placement": "right", "calcs": ["mean", "max", "lastNotNull"] }
      }
    }
  ]
}
