Skip to content

Instantly share code, notes, and snippets.

@Gurpartap
Last active March 24, 2020 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gurpartap/430b0fa207207b930d59da31dcf3c484 to your computer and use it in GitHub Desktop.
Save Gurpartap/430b0fa207207b930d59da31dcf3c484 to your computer and use it in GitHub Desktop.
Grafana dashboard for current CPU & Memory Usage Stats for nomad job allocs
{
"annotations": {
"list": [
{
"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": 8,
"links": [],
"panels": [
{
"cacheTimeout": null,
"datasource": "Prometheus",
"gridPos": {
"h": 14,
"w": 12,
"x": 0,
"y": 0
},
"id": 2,
"links": [],
"options": {
"displayMode": "lcd",
"fieldOptions": {
"calcs": [
"last"
],
"defaults": {
"mappings": [],
"nullValueMode": "connected",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "#EAB839",
"value": 75000000
},
{
"color": "red",
"value": 150000000
}
]
},
"title": "",
"unit": "bytes"
},
"overrides": [],
"values": false
},
"orientation": "horizontal",
"showUnfilled": false
},
"pluginVersion": "6.7.1",
"targets": [
{
"expr": "sort_desc(sum by (alloc_id, exported_job, task_group, task) (\n nomad_client_allocs_memory_usage\n))",
"format": "time_series",
"instant": true,
"interval": "",
"intervalFactor": 1,
"legendFormat": "{{task}}",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Current Memory Usage",
"type": "bargauge"
},
{
"cacheTimeout": null,
"datasource": "Prometheus",
"gridPos": {
"h": 14,
"w": 12,
"x": 12,
"y": 0
},
"id": 4,
"links": [],
"options": {
"displayMode": "lcd",
"fieldOptions": {
"calcs": [
"last"
],
"defaults": {
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"title": "",
"unit": "hertz"
},
"overrides": [],
"values": false
},
"orientation": "horizontal",
"showUnfilled": false
},
"pluginVersion": "6.7.1",
"targets": [
{
"expr": "sort_desc(sum by (alloc_id, exported_job, task_group, task) (\n nomad_client_allocs_cpu_user\n)) > 1",
"format": "time_series",
"instant": true,
"interval": "",
"intervalFactor": 1,
"legendFormat": "{{task}}",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Current CPU Usage",
"type": "bargauge"
},
{
"cacheTimeout": null,
"datasource": "Prometheus",
"gridPos": {
"h": 14,
"w": 12,
"x": 0,
"y": 14
},
"id": 5,
"links": [],
"options": {
"displayMode": "lcd",
"fieldOptions": {
"calcs": [
"last"
],
"defaults": {
"mappings": [],
"nullValueMode": "connected",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "#EAB839",
"value": 66
},
{
"color": "red",
"value": 90
}
]
},
"title": "",
"unit": "percent"
},
"overrides": [],
"values": false
},
"orientation": "horizontal",
"showUnfilled": false
},
"pluginVersion": "6.7.1",
"targets": [
{
"expr": "sort_desc(sum by (alloc_id, exported_job, task_group, task) (\n nomad_client_allocs_memory_usage/nomad_client_allocs_memory_allocated\n)) * 100 > 1",
"format": "time_series",
"instant": true,
"interval": "",
"intervalFactor": 1,
"legendFormat": "{{task}}",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Current Memory Usage %",
"type": "bargauge"
},
{
"cacheTimeout": null,
"datasource": "Prometheus",
"gridPos": {
"h": 14,
"w": 12,
"x": 12,
"y": 14
},
"id": 3,
"links": [],
"options": {
"displayMode": "lcd",
"fieldOptions": {
"calcs": [
"last"
],
"defaults": {
"mappings": [],
"nullValueMode": "connected",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "#EAB839",
"value": 66
},
{
"color": "red",
"value": 90
}
]
},
"title": "",
"unit": "percent"
},
"overrides": [],
"values": false
},
"orientation": "horizontal",
"showUnfilled": false
},
"pluginVersion": "6.7.1",
"targets": [
{
"expr": "sort_desc(nomad_client_allocs_cpu_total_percent) > 1",
"format": "time_series",
"instant": true,
"interval": "",
"intervalFactor": 1,
"legendFormat": "{{task}}",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Current CPU Usage > 1% ",
"type": "bargauge"
},
{
"aliasColors": {},
"bars": false,
"cacheTimeout": null,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"fill": 1,
"fillGradient": 10,
"gridPos": {
"h": 14,
"w": 24,
"x": 0,
"y": 28
},
"hiddenSeries": false,
"id": 8,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"hideEmpty": false,
"hideZero": true,
"max": true,
"min": false,
"rightSide": true,
"show": true,
"sort": "max",
"sortDesc": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null as zero",
"options": {
"dataLinks": []
},
"percentage": false,
"pluginVersion": "6.7.1",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": true,
"steppedLine": true,
"targets": [
{
"expr": "sort_desc(sum by (alloc_id, exported_job, task_group, task) (\n nomad_client_allocs_cpu_user\n))",
"format": "time_series",
"instant": false,
"interval": "",
"intervalFactor": 10,
"legendFormat": "{{task}}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "CPU Usage Over Time",
"tooltip": {
"shared": false,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "hertz",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"cacheTimeout": null,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"fill": 1,
"fillGradient": 5,
"gridPos": {
"h": 14,
"w": 24,
"x": 0,
"y": 42
},
"hiddenSeries": false,
"id": 6,
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"max": true,
"min": false,
"rightSide": true,
"show": true,
"sort": "current",
"sortDesc": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pluginVersion": "6.7.1",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": true,
"steppedLine": true,
"targets": [
{
"expr": "(sum by (alloc_id, exported_job, task_group, task) (\n nomad_client_allocs_memory_usage\n))",
"format": "time_series",
"instant": false,
"interval": "",
"intervalFactor": 10,
"legendFormat": "{{task}}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Memory Usage Over Time",
"tooltip": {
"shared": false,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "bytes",
"label": "",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": "",
"logBase": 1,
"max": null,
"min": null,
"show": false
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"cacheTimeout": null,
"datasource": "Prometheus",
"gridPos": {
"h": 21,
"w": 24,
"x": 0,
"y": 56
},
"id": 7,
"links": [],
"options": {
"displayMode": "gradient",
"fieldOptions": {
"calcs": [
"mean"
],
"defaults": {
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "bytes"
},
"overrides": [],
"values": false
},
"orientation": "horizontal",
"showUnfilled": false
},
"pluginVersion": "6.7.1",
"targets": [
{
"expr": "sort_desc(sum by (alloc_id, exported_job, task_group, task) (\n nomad_client_allocs_memory_max_usage > (nomad_client_allocs_memory_allocated * 0.66)\n))",
"format": "time_series",
"instant": true,
"interval": "",
"intervalFactor": 1,
"legendFormat": "{{task}}",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Memory Max Usage > 66% of Allocated",
"type": "bargauge"
}
],
"refresh": "10s",
"schemaVersion": 22,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-15m",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "",
"title": "Nomad Allocs",
"uid": "ihlUbI9Wk",
"variables": {
"list": []
},
"version": 11
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment