Skip to content

Instantly share code, notes, and snippets.

@jodli
Created August 18, 2017 11:14
Show Gist options
  • Select an option

  • Save jodli/e7b240735b9211a349c845b2ef62b3d5 to your computer and use it in GitHub Desktop.

Select an option

Save jodli/e7b240735b9211a349c845b2ef62b3d5 to your computer and use it in GitHub Desktop.
{
"__inputs": [
{
"name": "DS_TELEGRAF",
"label": "Telegraf",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "4.2.0"
},
{
"type": "panel",
"id": "grafana-piechart-panel",
"name": "Pie Chart",
"version": "1.1.4"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "datasource",
"id": "influxdb",
"name": "InfluxDB",
"version": "1.0.0"
},
{
"type": "panel",
"id": "singlestat",
"name": "Singlestat",
"version": ""
}
],
"annotations": {
"list": []
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"hideControls": false,
"id": null,
"links": [],
"refresh": "1m",
"rows": [
{
"collapse": false,
"height": "250px",
"panels": [
{
"aliasColors": {},
"cacheTimeout": null,
"combine": {
"label": "Others",
"threshold": 0
},
"datasource": "${DS_TELEGRAF}",
"editable": true,
"error": false,
"fontSize": "80%",
"format": "short",
"id": 5,
"interval": null,
"legend": {
"percentage": false,
"show": true,
"values": true
},
"legendType": "Right side",
"links": [],
"maxDataPoints": 3,
"nullPointMode": "connected",
"pieType": "pie",
"span": 4,
"strokeWidth": "5",
"targets": [
{
"alias": "$col",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "docker",
"policy": "default",
"query": "SELECT last(\"n_containers_running\") as running, last(\"n_containers_paused\") as paused, last(\"n_containers_stopped\") as stopped FROM \"docker\" WHERE $timeFilter GROUP BY time($interval) fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"n_containers_running"
],
"type": "field"
},
{
"params": [],
"type": "last"
}
]
],
"tags": []
}
],
"title": "Containers",
"type": "grafana-piechart-panel",
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_TELEGRAF}",
"editable": true,
"error": false,
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 6,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 4,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"targets": [
{
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "docker_container_cpu",
"policy": "default",
"query": "SELECT last(\"usage_percent\") FROM \"docker_container_cpu\" WHERE $timeFilter GROUP BY time($interval) fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"usage_percent"
],
"type": "field"
},
{
"params": [],
"type": "sum"
}
]
],
"tags": []
}
],
"thresholds": "50,80",
"title": "Total CPU usage",
"type": "singlestat",
"valueFontSize": "100%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_TELEGRAF}",
"editable": true,
"error": false,
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 7,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 4,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"targets": [
{
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "docker_container_mem",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"usage_percent"
],
"type": "field"
},
{
"params": [],
"type": "last"
}
]
],
"tags": []
}
],
"thresholds": "50,80",
"title": "Total memory usage",
"type": "singlestat",
"valueFontSize": "100%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": true,
"title": "Summary",
"titleSize": "h6"
},
{
"collapse": false,
"height": "250px",
"panels": [
{
"alert": {
"conditions": [
{
"evaluator": {
"params": [
90
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"datasourceId": 1,
"model": {
"alias": "$tag_container_name",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "docker_container_cpu",
"policy": "default",
"query": "SELECT last(\"usage_percent\") as \"usage\" FROM \"docker_container_cpu\" WHERE $timeFilter GROUP BY time($interval),* fill(null)",
"rawQuery": true,
"refId": "E",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"usage_percent"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
},
"params": [
"E",
"5m",
"now"
]
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"executionErrorState": "alerting",
"frequency": "60s",
"handler": 1,
"name": "CPU Usage per Container alert",
"noDataState": "keep_state",
"notifications": []
},
"aliasColors": {},
"bars": false,
"datasource": "${DS_TELEGRAF}",
"editable": true,
"error": false,
"fill": 0,
"grid": {},
"id": 2,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"hideEmpty": false,
"max": true,
"min": true,
"rightSide": true,
"show": true,
"sort": "avg",
"sortDesc": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "$tag_container_name",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "docker_container_cpu",
"policy": "default",
"query": "SELECT last(\"usage_percent\") as \"usage\" FROM \"docker_container_cpu\" WHERE $timeFilter GROUP BY time($interval),* fill(null)",
"rawQuery": true,
"refId": "E",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"usage_percent"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"thresholds": [
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "gt",
"value": 90
}
],
"timeFrom": null,
"timeShift": null,
"title": "CPU Usage per Container",
"tooltip": {
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "percent",
"label": "",
"logBase": 1,
"max": null,
"min": 0,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"alert": {
"conditions": [
{
"evaluator": {
"params": [
2326498420
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"datasourceId": 1,
"model": {
"alias": "$tag_container_name",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"policy": "default",
"query": "SELECT mean(\"usage\") as \"usage\" FROM \"docker_container_mem\" WHERE $timeFilter GROUP BY time($interval),* fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
},
"params": [
"A",
"1m",
"now"
]
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"executionErrorState": "alerting",
"frequency": "60s",
"handler": 1,
"name": "Memory Usage per Container alert",
"noDataState": "keep_state",
"notifications": []
},
"aliasColors": {},
"bars": false,
"datasource": "${DS_TELEGRAF}",
"editable": true,
"error": false,
"fill": 1,
"grid": {},
"height": "300",
"id": 3,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"rightSide": true,
"show": true,
"sort": "current",
"sortDesc": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 12,
"stack": true,
"steppedLine": true,
"targets": [
{
"alias": "$tag_container_name",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"policy": "default",
"query": "SELECT mean(\"usage\") as \"usage\" FROM \"docker_container_mem\" WHERE $timeFilter GROUP BY time($interval),* fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"thresholds": [
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "gt",
"value": 2326498420
}
],
"timeFrom": null,
"timeShift": null,
"title": "Memory Usage per Container",
"tooltip": {
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": 0,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"alert": {
"conditions": [
{
"evaluator": {
"params": [
128735,
-128338
],
"type": "outside_range"
},
"operator": {
"type": "and"
},
"query": {
"datasourceId": 1,
"model": {
"alias": "$tag_container_name: $col",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"auto"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"measurement": "docker_container_net",
"policy": "default",
"query": "SELECT non_negative_derivative(mean(\"rx_bytes\"),1s)/8 as \"rx\" FROM \"docker_container_net\" WHERE $timeFilter GROUP BY time($interval),* fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"rx_bytes"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
},
"params": [
"A",
"1m",
"now"
]
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"executionErrorState": "alerting",
"frequency": "60s",
"handler": 1,
"name": "Network usage by container / second alert",
"noDataState": "keep_state",
"notifications": []
},
"aliasColors": {},
"bars": false,
"datasource": "${DS_TELEGRAF}",
"editable": true,
"error": false,
"fill": 0,
"grid": {},
"id": 1,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"hideEmpty": false,
"hideZero": false,
"max": true,
"min": true,
"rightSide": true,
"show": true,
"sort": "max",
"sortDesc": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 1,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"alias": "/rx/",
"stack": "A",
"transform": "negative-Y"
},
{
"alias": "/tx/",
"stack": "B"
}
],
"span": 12,
"stack": true,
"steppedLine": false,
"targets": [
{
"alias": "$tag_container_name: $col",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"auto"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"measurement": "docker_container_net",
"policy": "default",
"query": "SELECT non_negative_derivative(mean(\"rx_bytes\"),1s)/8 as \"rx\" FROM \"docker_container_net\" WHERE $timeFilter GROUP BY time($interval),* fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"rx_bytes"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
},
{
"alias": "$tag_container_name: $col",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"auto"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"measurement": "docker_container_net",
"policy": "default",
"query": "SELECT non_negative_derivative(mean(\"tx_bytes\"),1s)/8 as \"tx\" FROM \"docker_container_net\" WHERE $timeFilter GROUP BY time($interval),* fill(null)",
"rawQuery": true,
"refId": "B",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"tx_bytes"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"* -1"
],
"type": "math"
}
]
],
"tags": []
}
],
"thresholds": [
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "gt",
"value": 128735
},
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "lt",
"value": -128338
}
],
"timeFrom": null,
"timeShift": null,
"title": "Network usage by container / second",
"tooltip": {
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "Bps",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "Bps",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": false
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": true,
"title": "Details",
"titleSize": "h6"
}
],
"schemaVersion": 14,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-30m",
"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": "Docker Metrics",
"version": 36
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment