Ceph - OSD Usage
Ceph OSD Usage per device_class
Simple dashboard to view OSD usage.
Need a label with cluster name in prometheus target : "cluster":"mycluster"

Ceph OSD Usage per device_class
{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "panel",
      "id": "bargauge",
      "name": "Bar gauge",
      "version": ""
    },
    {
      "type": "panel",
      "id": "gauge",
      "name": "Gauge",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.5.5"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph (old)",
      "version": ""
    },
    {
      "type": "panel",
      "id": "heatmap",
      "name": "Heatmap",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "datasource",
          "uid": "grafana"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "description": "Ceph OSD Usage per device_class",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "gnetId": 17296,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1666966283682,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 60
              },
              {
                "color": "dark-red",
                "value": 80
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 109,
      "interval": "",
      "links": [],
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "vertical",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "text": {}
      },
      "pluginVersion": "8.5.5",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "sort_desc((ceph_osd_stat_bytes_used{cluster=\"$cluster\",ceph_daemon=~\"$osd\"}/ceph_osd_stat_bytes{cluster=\"$cluster\",ceph_daemon=~\"$osd\"}*100)>$limit)",
          "format": "time_series",
          "instant": true,
          "interval": "60s",
          "legendFormat": "{{ceph_daemon}}",
          "refId": "A"
        }
      ],
      "title": "OSD > $limit %",
      "transparent": true,
      "type": "bargauge"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": []
      },
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "hiddenSeries": false,
      "id": 14,
      "interval": "60s",
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "8.5.5",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "exemplar": true,
          "expr": "(ceph_osd_stat_bytes_used{cluster=\"$cluster\",ceph_daemon=~\"$osd\"}/ceph_osd_stat_bytes{cluster=\"$cluster\",ceph_daemon=~\"$osd\"}*100)>$limit",
          "format": "time_series",
          "interval": "60s",
          "legendFormat": "{{ceph_daemon}}",
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          }
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "OSD > $limit %",
      "tooltip": {
        "shared": true,
        "sort": 2,
        "value_type": "individual"
      },
      "transparent": true,
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "cards": {},
      "color": {
        "cardColor": "#FF9830",
        "colorScale": "sqrt",
        "colorScheme": "interpolateOranges",
        "exponent": 0.3,
        "mode": "opacity"
      },
      "dataFormat": "timeseries",
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "",
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 9
      },
      "heatmap": {},
      "hideZeroBuckets": false,
      "highlightCards": true,
      "id": 114,
      "interval": "",
      "legend": {
        "show": false
      },
      "links": [],
      "pluginVersion": "8.1.3",
      "reverseYBuckets": false,
      "targets": [
        {
          "exemplar": true,
          "expr": "ceph_osd_stat_bytes_used{cluster=\"$cluster\",ceph_daemon=~\"$osd\"}/ceph_osd_stat_bytes{cluster=\"$cluster\",ceph_daemon=~\"$osd\"}",
          "format": "time_series",
          "instant": false,
          "interval": "",
          "intervalFactor": 10,
          "legendFormat": "{{ceph_daemon}}",
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          }
        }
      ],
      "title": "Global Repartition",
      "tooltip": {
        "show": true,
        "showHistogram": false
      },
      "transparent": true,
      "type": "heatmap",
      "xAxis": {
        "show": true
      },
      "xBucketNumber": 20,
      "xBucketSize": "",
      "yAxis": {
        "format": "percentunit",
        "logBase": 1,
        "max": "1",
        "min": "0",
        "show": true
      },
      "yBucketBound": "auto",
      "yBucketSize": 0.1
    },
    {
      "collapsed": true,
      "datasource": {
        "type": "graphite",
        "uid": "000000004"
      },
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 17
      },
      "id": 12,
      "panels": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "thresholds"
              },
              "mappings": [
                {
                  "options": {
                    "match": "null",
                    "result": {
                      "text": "N/A"
                    }
                  },
                  "type": "special"
                }
              ],
              "max": 1,
              "min": 0,
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "rgba(50, 172, 45, 0.97)",
                    "value": null
                  },
                  {
                    "color": "rgba(237, 129, 40, 0.89)",
                    "value": 0.6
                  },
                  {
                    "color": "rgba(245, 54, 54, 0.9)",
                    "value": 0.8
                  }
                ]
              },
              "unit": "percentunit"
            },
            "overrides": []
          },
          "gridPos": {
            "h": 5,
            "w": 3,
            "x": 0,
            "y": 18
          },
          "id": 7,
          "interval": "",
          "links": [],
          "maxDataPoints": 100,
          "maxPerRow": 8,
          "options": {
            "orientation": "horizontal",
            "reduceOptions": {
              "calcs": [
                "lastNotNull"
              ],
              "fields": "",
              "values": false
            },
            "showThresholdLabels": false,
            "showThresholdMarkers": true,
            "text": {}
          },
          "pluginVersion": "8.5.5",
          "repeat": "osd",
          "repeatDirection": "h",
          "targets": [
            {
              "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
              },
              "editorMode": "code",
              "expr": "ceph_osd_stat_bytes_used{cluster=\"$cluster\",ceph_daemon=~\"$osd\"}/ceph_osd_stat_bytes{ceph_daemon=~\"$osd\"}",
              "format": "time_series",
              "interval": "",
              "intervalFactor": 1,
              "legendFormat": "",
              "range": true,
              "refId": "A",
              "step": 60
            }
          ],
          "title": "$osd",
          "transparent": true,
          "type": "gauge"
        }
      ],
      "title": "OSD: $osd",
      "type": "row"
    }
  ],
  "refresh": "15m",
  "schemaVersion": 36,
  "style": "dark",
  "tags": [
    "ceph",
    "osd"
  ],
  "templating": {
    "list": [
      {
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "label_values(cluster)",
        "hide": 0,
        "includeAll": false,
        "label": "cluster",
        "multi": false,
        "name": "cluster",
        "options": [],
        "query": {
          "query": "label_values(cluster)",
          "refId": "prometheus-cluster-Variable-Query"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "label_values(ceph_osd_metadata{cluster=\"$cluster\"}, device_class)",
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "device_class",
        "options": [],
        "query": {
          "query": "label_values(ceph_osd_metadata{cluster=\"$cluster\"}, device_class)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "label_values(ceph_osd_metadata{cluster=\"$cluster\", device_class=\"$device_class\"}, ceph_daemon)",
        "hide": 0,
        "includeAll": true,
        "label": "OSD",
        "multi": true,
        "name": "osd",
        "options": [],
        "query": {
          "query": "label_values(ceph_osd_metadata{cluster=\"$cluster\", device_class=\"$device_class\"}, ceph_daemon)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 3,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "current": {
          "selected": false,
          "text": "60",
          "value": "60"
        },
        "hide": 0,
        "name": "limit",
        "options": [
          {
            "selected": true,
            "text": "60",
            "value": "60"
          }
        ],
        "query": "60",
        "skipUrlSync": false,
        "type": "textbox"
      }
    ]
  },
  "time": {
    "from": "now-2d",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "browser",
  "title": "Ceph - OSD Usage",
  "uid": "w_x1LGtZz",
  "version": 32,
  "weekStart": ""
}