Skip to content

Instantly share code, notes, and snippets.

@pcuzner
Created July 19, 2021 21:36
Show Gist options
  • Save pcuzner/1034f1fa2f424732bc4247e5c0598f82 to your computer and use it in GitHub Desktop.
Save pcuzner/1034f1fa2f424732bc4247e5c0598f82 to your computer and use it in GitHub Desktop.
Grafana Dashboard to visualise Ceph container resource utilisation from cadvisor metrics
{
"annotations": {
"list": [
{
"$$hashKey": "object:140",
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 16,
"iteration": 1626672078293,
"links": [],
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Dashboard1",
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 12,
"w": 11,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": 2,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": true,
"steppedLine": false,
"targets": [
{
"expr": "label_replace(sum by(id) (rate(container_cpu_usage_seconds_total{instance=~\"$hostname.*\",id=~\".*(ceph-.*)($container)\"}[30s])),\"shortname\",\"$2\", \"id\", \"(.*)@(.*)\")",
"hide": false,
"instant": false,
"interval": "",
"legendFormat": "{{shortname}}",
"refId": "B"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Ceph Container CPU Core Load : $hostname",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:195",
"decimals": 2,
"format": "percentunit",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"$$hashKey": "object:196",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Dashboard1",
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 12,
"w": 10,
"x": 11,
"y": 0
},
"hiddenSeries": false,
"id": 13,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": true,
"steppedLine": false,
"targets": [
{
"expr": "sum by(shortname) (label_replace(sum by(id) (container_memory_rss{instance=~\"$hostname.*\",id=~\".*(ceph-.*)($container)\"}),\"shortname\",\"$2\", \"id\", \"(.*)@(.*)\"))",
"hide": false,
"instant": false,
"interval": "",
"legendFormat": "{{ shortname }}",
"refId": "B"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Ceph Container Memory Load ($hostname)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:195",
"decimals": 1,
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"$$hashKey": "object:196",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"content": "\n<h1 style=\"text-align:center\">$hostname </h1>\n\n\n\n\n",
"datasource": null,
"gridPos": {
"h": 3,
"w": 3,
"x": 21,
"y": 0
},
"id": 29,
"mode": "html",
"timeFrom": null,
"timeShift": null,
"title": "Host",
"type": "text"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"datasource": "Dashboard1",
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 3,
"w": 3,
"x": 21,
"y": 3
},
"id": 21,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"$$hashKey": "object:13357",
"name": "value to text",
"value": 1
},
{
"$$hashKey": "object:13358",
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"pluginVersion": "6.7.4",
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false,
"ymax": null,
"ymin": null
},
"tableColumn": "",
"targets": [
{
"expr": "count without(cpu,mode) (node_cpu_seconds_total{instance=~\"$hostname.*\",mode=\"idle\"})",
"interval": "",
"legendFormat": "",
"refId": "B"
}
],
"thresholds": "",
"timeFrom": null,
"timeShift": null,
"title": "CPU Cores",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"$$hashKey": "object:13360",
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"datasource": "Dashboard1",
"gridPos": {
"h": 4,
"w": 3,
"x": 21,
"y": 6
},
"id": 31,
"options": {
"fieldOptions": {
"calcs": [
"lastNotNull"
],
"defaults": {
"decimals": 0,
"mappings": [],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "#EAB839",
"value": 80
},
{
"color": "red",
"value": 90
}
]
},
"title": "CPU Load",
"unit": "percent"
},
"overrides": [],
"values": false
},
"orientation": "auto",
"showThresholdLabels": false,
"showThresholdMarkers": true
},
"pluginVersion": "6.7.4",
"targets": [
{
"expr": "sum (\n rate(node_cpu{instance=~\"$hostname.*\", mode=~\"(irq|nice|softirq|steal|system|user|iowait)\"}[30s]) or\n rate(node_cpu_seconds_total{instance=~\"$hostname.*\", mode=~\"(irq|nice|softirq|steal|system|user|iowait)\"}[30s])\n) / scalar(\n sum(rate(node_cpu{instance=~\"$hostname(.*)\"}[30s]) or\n rate(node_cpu_seconds_total{instance=~\"$hostname.*\"}[30s]))\n) * 100",
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "",
"type": "gauge"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"datasource": "Dashboard1",
"format": "bytes",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 3,
"w": 3,
"x": 21,
"y": 10
},
"id": 24,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"$$hashKey": "object:13357",
"name": "value to text",
"value": 1
},
{
"$$hashKey": "object:13358",
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"pluginVersion": "6.7.4",
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false,
"ymax": null,
"ymin": null
},
"tableColumn": "",
"targets": [
{
"expr": "node_memory_MemTotal_bytes{instance=~\"$hostname.*\"}",
"interval": "",
"legendFormat": "",
"refId": "B"
}
],
"thresholds": "",
"timeFrom": null,
"timeShift": null,
"title": "Host Memory",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"$$hashKey": "object:13360",
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Dashboard1",
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 10,
"w": 11,
"x": 0,
"y": 12
},
"hiddenSeries": false,
"id": 19,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "sum by (mode) (\n rate(node_cpu{instance=~\"$hostname.*\", mode=~\"(irq|nice|softirq|steal|system|user|iowait)\"}[30s]) or\n rate(node_cpu_seconds_total{instance=~\"$hostname.*\", mode=~\"(irq|nice|softirq|steal|system|user|iowait)\"}[30s])\n) / scalar(\n sum(rate(node_cpu{instance=~\"$hostname(.*)\"}[30s]) or\n rate(node_cpu_seconds_total{instance=~\"$hostname.*\"}[30s]))\n) * 100",
"interval": "",
"legendFormat": "{{mode}}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "CPU Utilization (All cores) : $hostname",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:2511",
"decimals": 0,
"format": "short",
"label": null,
"logBase": 1,
"max": "100",
"min": "0",
"show": true
},
{
"$$hashKey": "object:2512",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": false
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
"Available": "#508642",
"Free": "#508642",
"Total": "#bf1b00",
"Used": "#bf1b00",
"total": "#bf1b00",
"used": "#0a50a1"
},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Dashboard1",
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 10,
"w": 10,
"x": 11,
"y": 12
},
"hiddenSeries": false,
"id": 23,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"$$hashKey": "object:13570",
"alias": "Total",
"color": "#bf1b00",
"fill": 0,
"linewidth": 2,
"stack": false
}
],
"spaceLength": 10,
"stack": true,
"steppedLine": false,
"targets": [
{
"expr": "(node_memory_MemTotal{instance=~\"$hostname.*\"} or node_memory_MemTotal_bytes{instance=~\"$hostname.*\"})- (\n (node_memory_MemFree{instance=~\"$hostname.*\"} or node_memory_MemFree_bytes{instance=~\"$hostname.*\"}) + \n (node_memory_Cached{instance=~\"$hostname.*\"} or node_memory_Cached_bytes{instance=~\"$hostname.*\"}) + \n (node_memory_Buffers{instance=~\"$hostname.*\"} or node_memory_Buffers_bytes{instance=~\"$hostname.*\"}) +\n (node_memory_Slab{instance=~\"$hostname.*\"} or node_memory_Slab_bytes{instance=~\"$hostname.*\"})\n )",
"interval": "",
"legendFormat": "used",
"refId": "A"
},
{
"expr": "(node_memory_Cached{instance=~\"$hostname.*\"} or node_memory_Cached_bytes{instance=~\"$hostname.*\"}) + \n(node_memory_Buffers{instance=~\"$hostname.*\"} or node_memory_Buffers_bytes{instance=~\"$hostname.*\"}) +\n(node_memory_Slab{instance=~\"$hostname.*\"} or node_memory_Slab_bytes{instance=~\"$hostname.*\"}) ",
"interval": "",
"legendFormat": "buffers/cache",
"refId": "B"
},
{
"expr": "node_memory_MemTotal{instance=~\"$hostname.*\"} or node_memory_MemTotal_bytes{instance=~\"$hostname.*\"} ",
"interval": "",
"legendFormat": "Total",
"refId": "C"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "RAM Usage : $hostname",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:13589",
"format": "bytes",
"label": "RAM used",
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"$$hashKey": "object:13590",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": false
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"datasource": "Dashboard1",
"gridPos": {
"h": 4,
"w": 3,
"x": 21,
"y": 13
},
"id": 32,
"options": {
"fieldOptions": {
"calcs": [
"last"
],
"defaults": {
"decimals": 0,
"mappings": [],
"max": 1,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "#EAB839",
"value": 0.8
},
{
"color": "red",
"value": 0.9
}
]
},
"title": "RAM Usage",
"unit": "percentunit"
},
"overrides": [],
"values": false
},
"orientation": "auto",
"showThresholdLabels": false,
"showThresholdMarkers": true
},
"pluginVersion": "6.7.4",
"targets": [
{
"expr": "1- (node_memory_MemFree_bytes{instance=~\"$hostname.*\"} / node_memory_MemTotal_bytes{instance=~\"$hostname.*\"})",
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "",
"type": "gauge"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"datasource": "Dashboard1",
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 3,
"w": 3,
"x": 21,
"y": 17
},
"id": 27,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"$$hashKey": "object:13357",
"name": "value to text",
"value": 1
},
{
"$$hashKey": "object:13358",
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"pluginVersion": "6.7.4",
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false,
"ymax": null,
"ymin": null
},
"tableColumn": "",
"targets": [
{
"expr": "count (sum(container_cpu_usage_seconds_total{instance=~\"$hostname.*\",id=~\".*(ceph-.*/container).*\"}) by(id) )",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "B"
}
],
"thresholds": "",
"timeFrom": null,
"timeShift": null,
"title": "# Ceph Containers",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"$$hashKey": "object:13360",
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
}
],
"refresh": "10s",
"schemaVersion": 22,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"allValue": null,
"current": {
"text": "rhs-srv-01",
"value": "rhs-srv-01"
},
"datasource": "Dashboard1",
"definition": "label_values(container_cpu_usage_seconds_total, instance)",
"hide": 0,
"includeAll": false,
"index": -1,
"label": null,
"multi": false,
"name": "hostname",
"options": [],
"query": "label_values(container_cpu_usage_seconds_total, instance)",
"refresh": 1,
"regex": "/(.+?)(?=\\.)/",
"skipUrlSync": false,
"sort": 1,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {
"tags": [],
"text": "mgr.rhs-srv-01.ceph-dev.lab.eng.rdu2.redhat.com.yotoov.service",
"value": "mgr.rhs-srv-01.ceph-dev.lab.eng.rdu2.redhat.com.yotoov.service"
},
"datasource": "Dashboard1",
"definition": "label_values(container_cpu_usage_seconds_total{instance=~\"$hostname.*\",id=~\".*(ceph-.*/container).*\"}, id)",
"hide": 0,
"includeAll": true,
"index": -1,
"label": "Container",
"multi": false,
"name": "container",
"options": [
{
"$$hashKey": "object:1066",
"selected": false,
"text": "All",
"value": "$__all"
},
{
"$$hashKey": "object:1067",
"selected": false,
"text": "alertmanager.rhs-srv-01.service",
"value": "alertmanager.rhs-srv-01.service"
},
{
"$$hashKey": "object:1068",
"selected": false,
"text": "container.cadvisor.rhs-srv-01.service",
"value": "container.cadvisor.rhs-srv-01.service"
},
{
"$$hashKey": "object:1069",
"selected": false,
"text": "crash.rhs-srv-01.service",
"value": "crash.rhs-srv-01.service"
},
{
"$$hashKey": "object:1070",
"selected": false,
"text": "grafana.rhs-srv-01.service",
"value": "grafana.rhs-srv-01.service"
},
{
"$$hashKey": "object:1071",
"selected": true,
"text": "mgr.rhs-srv-01.ceph-dev.lab.eng.rdu2.redhat.com.yotoov.service",
"value": "mgr.rhs-srv-01.ceph-dev.lab.eng.rdu2.redhat.com.yotoov.service"
},
{
"$$hashKey": "object:1072",
"selected": false,
"text": "mon.rhs-srv-01.ceph-dev.lab.eng.rdu2.redhat.com.service",
"value": "mon.rhs-srv-01.ceph-dev.lab.eng.rdu2.redhat.com.service"
},
{
"$$hashKey": "object:1073",
"selected": false,
"text": "node-exporter.rhs-srv-01.service",
"value": "node-exporter.rhs-srv-01.service"
},
{
"$$hashKey": "object:1074",
"selected": false,
"text": "osd.0.service",
"value": "osd.0.service"
},
{
"$$hashKey": "object:1075",
"selected": false,
"text": "osd.1.service",
"value": "osd.1.service"
},
{
"$$hashKey": "object:1076",
"selected": false,
"text": "osd.10.service",
"value": "osd.10.service"
},
{
"$$hashKey": "object:1077",
"selected": false,
"text": "osd.2.service",
"value": "osd.2.service"
},
{
"$$hashKey": "object:1078",
"selected": false,
"text": "osd.3.service",
"value": "osd.3.service"
},
{
"$$hashKey": "object:1079",
"selected": false,
"text": "osd.4.service",
"value": "osd.4.service"
},
{
"$$hashKey": "object:1080",
"selected": false,
"text": "osd.5.service",
"value": "osd.5.service"
},
{
"$$hashKey": "object:1081",
"selected": false,
"text": "osd.6.service",
"value": "osd.6.service"
},
{
"$$hashKey": "object:1082",
"selected": false,
"text": "osd.7.service",
"value": "osd.7.service"
},
{
"$$hashKey": "object:1083",
"selected": false,
"text": "osd.8.service",
"value": "osd.8.service"
},
{
"$$hashKey": "object:1084",
"selected": false,
"text": "osd.9.service",
"value": "osd.9.service"
},
{
"$$hashKey": "object:1085",
"selected": false,
"text": "prometheus.rhs-srv-01.service",
"value": "prometheus.rhs-srv-01.service"
}
],
"query": "label_values(container_cpu_usage_seconds_total{instance=~\"$hostname.*\",id=~\".*(ceph-.*/container).*\"}, id)",
"refresh": 0,
"regex": "/.*@(.*\\.service).*/",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-30m",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "",
"title": "Container Analysis",
"uid": "GBGjRgjGz",
"variables": {
"list": []
},
"version": 11
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment