New Grafana Dashboard

This commit is contained in:
nicolargo 2018-04-02 21:54:47 +02:00
parent 80db8225c4
commit 5266a62d0c
7 changed files with 3008 additions and 2788 deletions

22
NEWS
View File

@ -25,6 +25,11 @@ Enhancements and new features:
* Add a new output mode to stdout #1168 * Add a new output mode to stdout #1168
* Huge refactor of the WebUI packaging thanks to @spike008t #1239 * Huge refactor of the WebUI packaging thanks to @spike008t #1239
One more thing ! A new Grafana Dash is available with:
* Network interface variable
* Disk variable
* Container CPU
Bugs corrected: Bugs corrected:
* Crash in the Wifi plugin on my Laptop #1151 * Crash in the Wifi plugin on my Laptop #1151
@ -68,6 +73,23 @@ News command line options:
News configuration keys in the glances.conf file: News configuration keys in the glances.conf file:
Graph:
[graph]
# Configuration for the --export graph option
# Set the path where the graph (.svg files) will be created
# Can be overwrite by the --graph-path command line option
path=/tmp
# It is possible to generate the graphs automatically by setting the
# generate_every to a non zero value corresponding to the seconds between
# two generation. Set it to 0 to disable graph auto generation.
generate_every=60
# See followings configuration keys definitions in the Pygal lib documentation
# http://pygal.org/en/stable/documentation/index.html
width=800
height=600
style=DarkStyle
Processes list Nice value: Processes list Nice value:
[processlist] [processlist]

View File

@ -1,55 +1,8 @@
{ {
"__inputs": [
{
"name": "DS_GLANCES",
"label": "glances",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "4.6.0-beta3"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "panel",
"id": "heatmap",
"name": "Heatmap",
"version": ""
},
{
"type": "datasource",
"id": "influxdb",
"name": "InfluxDB",
"version": "1.0.0"
},
{
"type": "panel",
"id": "singlestat",
"name": "Singlestat",
"version": ""
},
{
"type": "panel",
"id": "text",
"name": "Text",
"version": ""
}
],
"annotations": { "annotations": {
"list": [ "list": [
{ {
"$$hashKey": "object:2676",
"builtIn": 1, "builtIn": 1,
"datasource": "-- Grafana --", "datasource": "-- Grafana --",
"enable": true, "enable": true,
@ -63,14 +16,9 @@
"editable": true, "editable": true,
"gnetId": null, "gnetId": null,
"graphTooltip": 0, "graphTooltip": 0,
"hideControls": false, "id": 2,
"id": null, "iteration": 1522698566936,
"links": [], "links": [],
"refresh": false,
"rows": [
{
"collapse": false,
"height": 229,
"panels": [ "panels": [
{ {
"cacheTimeout": null, "cacheTimeout": null,
@ -81,7 +29,7 @@
"rgba(237, 129, 40, 0.89)", "rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)" "rgba(50, 172, 45, 0.97)"
], ],
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"format": "none", "format": "none",
@ -92,6 +40,12 @@
"thresholdLabels": false, "thresholdLabels": false,
"thresholdMarkers": true "thresholdMarkers": true
}, },
"gridPos": {
"h": 6,
"w": 2,
"x": 0,
"y": 0
},
"id": 5, "id": 5,
"interval": null, "interval": null,
"links": [], "links": [],
@ -120,7 +74,6 @@
"to": "null" "to": "null"
} }
], ],
"span": 1,
"sparkline": { "sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)", "fillColor": "rgba(31, 118, 189, 0.18)",
"full": false, "full": false,
@ -184,12 +137,18 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_GLANCES}", "datasource": "glances",
"fill": 1, "fill": 1,
"grid": { "grid": {
"max": null, "max": null,
"min": null "min": null
}, },
"gridPos": {
"h": 6,
"w": 20,
"x": 2,
"y": 0
},
"id": 4, "id": 4,
"interactive": true, "interactive": true,
"legend": { "legend": {
@ -217,7 +176,6 @@
"scale": 1, "scale": 1,
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"span": 10,
"spyable": true, "spyable": true,
"stack": true, "stack": true,
"steppedLine": false, "steppedLine": false,
@ -397,7 +355,7 @@
"rgba(237, 129, 40, 0.89)", "rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)" "rgba(245, 54, 54, 0.9)"
], ],
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"format": "none", "format": "none",
@ -408,6 +366,12 @@
"thresholdLabels": false, "thresholdLabels": false,
"thresholdMarkers": true "thresholdMarkers": true
}, },
"gridPos": {
"h": 6,
"w": 2,
"x": 22,
"y": 0
},
"id": 18, "id": 18,
"interval": null, "interval": null,
"links": [], "links": [],
@ -436,7 +400,6 @@
"to": "null" "to": "null"
} }
], ],
"span": 1,
"sparkline": { "sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)", "fillColor": "rgba(31, 118, 189, 0.18)",
"full": false, "full": false,
@ -493,29 +456,23 @@
} }
], ],
"valueName": "avg" "valueName": "avg"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "test",
"titleSize": "h6"
}, },
{
"collapse": false,
"height": "250px",
"panels": [
{ {
"aliasColors": {}, "aliasColors": {},
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 0, "fill": 0,
"grid": {}, "grid": {},
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 6
},
"id": 6, "id": 6,
"legend": { "legend": {
"avg": true, "avg": true,
@ -537,7 +494,6 @@
"renderer": "flot", "renderer": "flot",
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"span": 6,
"stack": false, "stack": false,
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
@ -711,11 +667,17 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 0, "fill": 0,
"grid": {}, "grid": {},
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 6
},
"id": 7, "id": 7,
"legend": { "legend": {
"avg": false, "avg": false,
@ -736,7 +698,6 @@
"renderer": "flot", "renderer": "flot",
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"span": 6,
"stack": false, "stack": false,
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
@ -849,29 +810,23 @@
"show": true "show": true
} }
] ]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "New row",
"titleSize": "h6"
}, },
{
"collapse": false,
"height": "250px",
"panels": [
{ {
"aliasColors": {}, "aliasColors": {},
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 3, "fill": 3,
"grid": {}, "grid": {},
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 13
},
"id": 9, "id": 9,
"legend": { "legend": {
"avg": true, "avg": true,
@ -897,7 +852,6 @@
} }
], ],
"spaceLength": 10, "spaceLength": 10,
"span": 6,
"stack": false, "stack": false,
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
@ -924,7 +878,7 @@
"measurement": "localhost.network", "measurement": "localhost.network",
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT mean(\"wlp2s0.rx\")/mean(\"wlp2s0.time_since_update\")*8 FROM \"localhost.network\" WHERE $timeFilter GROUP BY time($interval) fill(none)", "query": "SELECT mean(\"$interface.rx\")/mean(\"$interface.time_since_update\")*8 FROM \"localhost.network\" WHERE $timeFilter GROUP BY time($interval) fill(none)",
"rawQuery": true, "rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",
@ -967,7 +921,7 @@
"measurement": "localhost.network", "measurement": "localhost.network",
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT mean(\"wlp2s0.tx\")/mean(\"wlp2s0.time_since_update\")*8 FROM \"localhost.network\" WHERE $timeFilter GROUP BY time($interval) fill(none)", "query": "SELECT mean(\"$interface.tx\")/mean(\"$interface.time_since_update\")*8 FROM \"localhost.network\" WHERE $timeFilter GROUP BY time($interval) fill(none)",
"rawQuery": true, "rawQuery": true,
"refId": "B", "refId": "B",
"resultFormat": "time_series", "resultFormat": "time_series",
@ -993,7 +947,7 @@
"thresholds": [], "thresholds": [],
"timeFrom": null, "timeFrom": null,
"timeShift": null, "timeShift": null,
"title": "Net", "title": "$interface network interface",
"tooltip": { "tooltip": {
"shared": false, "shared": false,
"sort": 0, "sort": 0,
@ -1032,11 +986,17 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 0, "fill": 0,
"grid": {}, "grid": {},
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 13
},
"id": 8, "id": 8,
"legend": { "legend": {
"avg": false, "avg": false,
@ -1057,7 +1017,6 @@
"renderer": "flot", "renderer": "flot",
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"span": 6,
"stack": false, "stack": false,
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
@ -1170,29 +1129,23 @@
"show": true "show": true
} }
] ]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "New row",
"titleSize": "h6"
}, },
{
"collapse": false,
"height": "250px",
"panels": [
{ {
"aliasColors": {}, "aliasColors": {},
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 0, "fill": 0,
"grid": {}, "grid": {},
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 20
},
"id": 10, "id": 10,
"legend": { "legend": {
"avg": true, "avg": true,
@ -1213,7 +1166,6 @@
"renderer": "flot", "renderer": "flot",
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"span": 6,
"stack": false, "stack": false,
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
@ -1239,7 +1191,8 @@
"measurement": "localhost.diskio", "measurement": "localhost.diskio",
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT mean(\"sda2.read_bytes\")/mean(\"sda2.time_since_update\")*8 FROM \"localhost.diskio\" WHERE $timeFilter GROUP BY time($interval) fill(null)", "query": "SELECT mean(\"$disk.read_bytes\") FROM \"localhost.diskio\" WHERE $timeFilter GROUP BY time($__interval) fill(none)",
"rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",
"select": [ "select": [
@ -1281,7 +1234,8 @@
"measurement": "localhost.diskio", "measurement": "localhost.diskio",
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT mean(\"sda2.write_bytes\")/mean(\"sda2.time_since_update\")*8 FROM \"localhost.diskio\" WHERE $timeFilter GROUP BY time($interval) fill(null)", "query": "SELECT mean(\"$disk.write_bytes\") FROM \"localhost.diskio\" WHERE $timeFilter GROUP BY time($__interval) fill(none)",
"rawQuery": true,
"refId": "B", "refId": "B",
"resultFormat": "time_series", "resultFormat": "time_series",
"select": [ "select": [
@ -1306,7 +1260,7 @@
"thresholds": [], "thresholds": [],
"timeFrom": null, "timeFrom": null,
"timeShift": null, "timeShift": null,
"title": "sda2 disk IO", "title": "$disk disk IO",
"tooltip": { "tooltip": {
"shared": false, "shared": false,
"sort": 0, "sort": 0,
@ -1344,11 +1298,17 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 0, "fill": 0,
"grid": {}, "grid": {},
"gridPos": {
"h": 7,
"w": 8,
"x": 12,
"y": 20
},
"id": 11, "id": 11,
"legend": { "legend": {
"avg": false, "avg": false,
@ -1369,7 +1329,6 @@
"renderer": "flot", "renderer": "flot",
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"span": 4,
"stack": false, "stack": false,
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
@ -1502,7 +1461,7 @@
"rgba(245, 150, 40, 0.73)", "rgba(245, 150, 40, 0.73)",
"rgba(225, 40, 40, 0.59)" "rgba(225, 40, 40, 0.59)"
], ],
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"format": "percent", "format": "percent",
@ -1513,6 +1472,12 @@
"thresholdLabels": false, "thresholdLabels": false,
"thresholdMarkers": true "thresholdMarkers": true
}, },
"gridPos": {
"h": 7,
"w": 2,
"x": 20,
"y": 20
},
"id": 16, "id": 16,
"interval": null, "interval": null,
"links": [], "links": [],
@ -1541,7 +1506,6 @@
"to": "null" "to": "null"
} }
], ],
"span": 1,
"sparkline": { "sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)", "fillColor": "rgba(31, 118, 189, 0.18)",
"full": false, "full": false,
@ -1606,7 +1570,7 @@
"rgba(245, 150, 40, 0.73)", "rgba(245, 150, 40, 0.73)",
"rgba(225, 40, 40, 0.59)" "rgba(225, 40, 40, 0.59)"
], ],
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"format": "percent", "format": "percent",
@ -1617,6 +1581,12 @@
"thresholdLabels": false, "thresholdLabels": false,
"thresholdMarkers": true "thresholdMarkers": true
}, },
"gridPos": {
"h": 7,
"w": 2,
"x": 22,
"y": 20
},
"id": 17, "id": 17,
"interval": null, "interval": null,
"links": [], "links": [],
@ -1645,7 +1615,6 @@
"to": "null" "to": "null"
} }
], ],
"span": 1,
"sparkline": { "sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)", "fillColor": "rgba(31, 118, 189, 0.18)",
"full": false, "full": false,
@ -1702,43 +1671,164 @@
} }
], ],
"valueName": "avg" "valueName": "avg"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "New row",
"titleSize": "h6"
}, },
{
"collapse": false,
"height": "25px",
"panels": [
{ {
"content": "", "content": "",
"editable": true, "editable": true,
"error": false, "error": false,
"gridPos": {
"h": 3,
"w": 24,
"x": 0,
"y": 27
},
"id": 13, "id": 13,
"links": [], "links": [],
"mode": "markdown", "mode": "markdown",
"span": 12, "style": {},
"title": "Containers",
"type": "text"
},
{
"aliasColors": {
"localhost.docker.mean": "#ba43a9"
},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "glances",
"fill": 1,
"gridPos": {
"h": 8,
"w": 24,
"x": 0,
"y": 30
},
"id": 25,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": false,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"repeat": "container",
"repeatDirection": "v",
"scopedVars": {
"container": {
"selected": true,
"text": "grafana",
"value": "grafana"
}
},
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"hide": false,
"measurement": "localhost.docker",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT mean(\"$container.cpu_percent\") FROM \"localhost.docker\" WHERE $timeFilter GROUP BY time($__interval) fill(none)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"grafana.cpu_percent"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "$container container CPU consumption",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"content": "",
"editable": true,
"error": false,
"gridPos": {
"h": 3,
"w": 24,
"x": 0,
"y": 38
},
"id": 26,
"links": [],
"mode": "markdown",
"style": {}, "style": {},
"title": "CPU details", "title": "CPU details",
"type": "text" "type": "text"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "New row",
"titleSize": "h6"
}, },
{
"collapse": false,
"height": "150px",
"panels": [
{ {
"aliasColors": { "aliasColors": {
"max": "#890F02" "max": "#890F02"
@ -1746,11 +1836,17 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 0, "fill": 0,
"grid": {}, "grid": {},
"gridPos": {
"h": 4,
"w": 24,
"x": 0,
"y": 41
},
"id": 12, "id": 12,
"legend": { "legend": {
"avg": false, "avg": false,
@ -1786,7 +1882,6 @@
} }
], ],
"spaceLength": 10, "spaceLength": 10,
"span": 12,
"stack": false, "stack": false,
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
@ -1967,11 +2062,17 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 0, "fill": 0,
"grid": {}, "grid": {},
"gridPos": {
"h": 4,
"w": 24,
"x": 0,
"y": 45
},
"id": 14, "id": 14,
"legend": { "legend": {
"avg": false, "avg": false,
@ -2007,7 +2108,6 @@
} }
], ],
"spaceLength": 10, "spaceLength": 10,
"span": 12,
"stack": false, "stack": false,
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
@ -2188,11 +2288,17 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 0, "fill": 0,
"grid": {}, "grid": {},
"gridPos": {
"h": 4,
"w": 24,
"x": 0,
"y": 49
},
"id": 15, "id": 15,
"legend": { "legend": {
"alignAsTable": false, "alignAsTable": false,
@ -2230,7 +2336,6 @@
} }
], ],
"spaceLength": 10, "spaceLength": 10,
"span": 12,
"stack": false, "stack": false,
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
@ -2411,11 +2516,17 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 0, "fill": 0,
"grid": {}, "grid": {},
"gridPos": {
"h": 4,
"w": 24,
"x": 0,
"y": 53
},
"id": 19, "id": 19,
"legend": { "legend": {
"alignAsTable": false, "alignAsTable": false,
@ -2438,7 +2549,6 @@
"renderer": "flot", "renderer": "flot",
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"span": 12,
"stack": false, "stack": false,
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
@ -2529,11 +2639,17 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_GLANCES}", "datasource": "glances",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 0, "fill": 0,
"grid": {}, "grid": {},
"gridPos": {
"h": 4,
"w": 24,
"x": 0,
"y": 57
},
"id": 20, "id": 20,
"legend": { "legend": {
"alignAsTable": false, "alignAsTable": false,
@ -2556,7 +2672,6 @@
"renderer": "flot", "renderer": "flot",
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"span": 12,
"stack": false, "stack": false,
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
@ -2639,40 +2754,21 @@
"show": true "show": true
} }
] ]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "New row",
"titleSize": "h6"
}, },
{
"collapse": false,
"height": 4,
"panels": [
{ {
"content": "", "content": "",
"gridPos": {
"h": 3,
"w": 24,
"x": 0,
"y": 61
},
"id": 22, "id": 22,
"links": [], "links": [],
"mode": "markdown", "mode": "markdown",
"span": 12,
"title": "Sensors", "title": "Sensors",
"type": "text" "type": "text"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6"
}, },
{
"collapse": false,
"height": 250,
"panels": [
{ {
"cards": { "cards": {
"cardPadding": null, "cardPadding": null,
@ -2686,7 +2782,13 @@
"mode": "opacity" "mode": "opacity"
}, },
"dataFormat": "timeseries", "dataFormat": "timeseries",
"datasource": "${DS_GLANCES}", "datasource": "glances",
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 64
},
"heatmap": {}, "heatmap": {},
"highlightCards": true, "highlightCards": true,
"id": 21, "id": 21,
@ -2694,7 +2796,6 @@
"show": false "show": false
}, },
"links": [], "links": [],
"span": 12,
"targets": [ "targets": [
{ {
"alias": "AmbientTemperature", "alias": "AmbientTemperature",
@ -2757,19 +2858,7 @@
}, },
"yBucketNumber": null, "yBucketNumber": null,
"yBucketSize": null "yBucketSize": null
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6"
}, },
{
"collapse": false,
"height": 250,
"panels": [
{ {
"cards": { "cards": {
"cardPadding": null, "cardPadding": null,
@ -2783,7 +2872,13 @@
"mode": "opacity" "mode": "opacity"
}, },
"dataFormat": "timeseries", "dataFormat": "timeseries",
"datasource": "${DS_GLANCES}", "datasource": "glances",
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 71
},
"heatmap": {}, "heatmap": {},
"highlightCards": true, "highlightCards": true,
"id": 23, "id": 23,
@ -2791,7 +2886,6 @@
"show": false "show": false
}, },
"links": [], "links": [],
"span": 12,
"targets": [ "targets": [
{ {
"alias": "CpuTemperature", "alias": "CpuTemperature",
@ -2856,19 +2950,84 @@
"yBucketSize": null "yBucketSize": null
} }
], ],
"repeat": null, "refresh": false,
"repeatIteration": null, "schemaVersion": 16,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6"
}
],
"schemaVersion": 14,
"style": "dark", "style": "dark",
"tags": [], "tags": [],
"templating": { "templating": {
"list": [] "list": [
{
"allValue": null,
"current": {
"text": "grafana",
"value": [
"grafana"
]
},
"datasource": "glances",
"hide": 0,
"includeAll": false,
"label": null,
"multi": true,
"name": "container",
"options": [],
"query": "show field keys on glances from \"localhost.docker\"",
"refresh": 1,
"regex": "/(.*)\\..*/",
"sort": 1,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {
"text": "wlp2s0",
"value": "wlp2s0"
},
"datasource": "glances",
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "interface",
"options": [],
"query": "show field keys on glances from \"localhost.network\"",
"refresh": 1,
"regex": "/(.*)\\..*/",
"sort": 1,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {
"text": "dm-0",
"value": "dm-0"
},
"datasource": "glances",
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "disk",
"options": [],
"query": "show field keys on glances from \"localhost.diskio\"",
"refresh": 1,
"regex": "/(.*)\\..*/",
"sort": 1,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
}, },
"time": { "time": {
"from": "now-15m", "from": "now-15m",
@ -2906,6 +3065,7 @@
"type": "timepicker" "type": "timepicker"
}, },
"timezone": "browser", "timezone": "browser",
"title": "Glances", "title": "Glances_20180117",
"version": 2 "uid": "000000002",
"version": 4
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -92,10 +92,10 @@ class GlancesExport(object):
for opt in mandatories: for opt in mandatories:
setattr(self, opt, self.config.get_value(section, opt)) setattr(self, opt, self.config.get_value(section, opt))
except NoSectionError: except NoSectionError:
logger.critical("No {} configuration found".format(section)) logger.error("No {} configuration found".format(section))
return False return False
except NoOptionError as e: except NoOptionError as e:
logger.critical("Error in the {} configuration ({})".format(section, e)) logger.error("Error in the {} configuration ({})".format(section, e))
return False return False
# Load options # Load options

View File

@ -39,6 +39,31 @@ except ImportError as e:
else: else:
import_error_tag = False import_error_tag = False
# Define the items history list (list of items to add to history)
# TODO: For the moment limited to the CPU. Had to change the graph exports
# method to display one graph per container.
# items_history_list = [{'name': 'cpu_percent',
# 'description': 'Container CPU consumption in %',
# 'y_unit': '%'},
# {'name': 'memory_usage',
# 'description': 'Container memory usage in bytes',
# 'y_unit': 'B'},
# {'name': 'network_rx',
# 'description': 'Container network RX bitrate in bits per second',
# 'y_unit': 'bps'},
# {'name': 'network_tx',
# 'description': 'Container network TX bitrate in bits per second',
# 'y_unit': 'bps'},
# {'name': 'io_r',
# 'description': 'Container IO bytes read per second',
# 'y_unit': 'Bps'},
# {'name': 'io_w',
# 'description': 'Container IO bytes write per second',
# 'y_unit': 'Bps'}]
items_history_list = [{'name': 'cpu_percent',
'description': 'Container CPU consumption in %',
'y_unit': '%'}]
class Plugin(GlancesPlugin): class Plugin(GlancesPlugin):
"""Glances Docker plugin. """Glances Docker plugin.
@ -48,7 +73,8 @@ class Plugin(GlancesPlugin):
def __init__(self, args=None): def __init__(self, args=None):
"""Init the plugin.""" """Init the plugin."""
super(Plugin, self).__init__(args=args) super(Plugin, self).__init__(args=args,
items_history_list=items_history_list)
# The plgin can be disable using: args.disable_docker # The plgin can be disable using: args.disable_docker
self.args = args self.args = args
@ -198,14 +224,26 @@ class Plugin(GlancesPlugin):
# Standards stats # Standards stats
if container_stats['Status'] in ('running', 'paused'): if container_stats['Status'] in ('running', 'paused'):
container_stats['cpu'] = self.get_docker_cpu(container.id, self.thread_list[container.id].stats) container_stats['cpu'] = self.get_docker_cpu(container.id, self.thread_list[container.id].stats)
container_stats['cpu_percent'] = container_stats['cpu'].get('total', None)
container_stats['memory'] = self.get_docker_memory(container.id, self.thread_list[container.id].stats) container_stats['memory'] = self.get_docker_memory(container.id, self.thread_list[container.id].stats)
container_stats['network'] = self.get_docker_network(container.id, self.thread_list[container.id].stats) container_stats['memory_usage'] = container_stats['memory'].get('usage', None)
container_stats['io'] = self.get_docker_io(container.id, self.thread_list[container.id].stats) container_stats['io'] = self.get_docker_io(container.id, self.thread_list[container.id].stats)
container_stats['io_r'] = container_stats['io'].get('ior', None)
container_stats['io_w'] = container_stats['io'].get('iow', None)
container_stats['network'] = self.get_docker_network(container.id, self.thread_list[container.id].stats)
container_stats['network_rx'] = container_stats['network'].get('rx', None)
container_stats['network_tx'] = container_stats['network'].get('tx', None)
else: else:
container_stats['cpu'] = {} container_stats['cpu'] = {}
container_stats['cpu_percent'] = None
container_stats['memory'] = {} container_stats['memory'] = {}
container_stats['network'] = {} container_stats['memory_percent'] = None
container_stats['io'] = {} container_stats['io'] = {}
container_stats['io_r'] = None
container_stats['io_w'] = None
container_stats['network'] = {}
container_stats['network_rx'] = None
container_stats['network_tx'] = None
# Add current container stats to the stats list # Add current container stats to the stats list
self.stats['containers'].append(container_stats) self.stats['containers'].append(container_stats)
@ -537,9 +575,10 @@ class Plugin(GlancesPlugin):
msg = '{:>7}'.format('_') msg = '{:>7}'.format('_')
ret.append(self.curse_add_line(msg)) ret.append(self.curse_add_line(msg))
# IO R/W # IO R/W
unit = 'B'
for r in ['ior', 'iow']: for r in ['ior', 'iow']:
try: try:
value = self.auto_unit(int(container['io'][r] // container['io']['time_since_update'] * 8)) + "b" value = self.auto_unit(int(container['io'][r] // container['io']['time_since_update'])) + unit
msg = '{:>7}'.format(value) msg = '{:>7}'.format(value)
except KeyError: except KeyError:
msg = '{:>7}'.format('_') msg = '{:>7}'.format('_')

View File

@ -35,7 +35,6 @@ snmp_oid = {'default': {'interface_name': '1.3.6.1.2.1.2.2.1.2',
'cumulative_tx': '1.3.6.1.2.1.2.2.1.16'}} 'cumulative_tx': '1.3.6.1.2.1.2.2.1.16'}}
# Define the history items list # Define the history items list
# All items in this list will be historised if the --enable-history tag is set
items_history_list = [{'name': 'rx', items_history_list = [{'name': 'rx',
'description': 'Download rate per second', 'description': 'Download rate per second',
'y_unit': 'bit/s'}, 'y_unit': 'bit/s'},

View File

@ -162,13 +162,13 @@ class GlancesPlugin(object):
else: else:
item_name = self.get_key() item_name = self.get_key()
# Build the history # Build the history
if self.stats and self._history_enable(): if self.get_export() and self._history_enable():
for i in self.get_items_history_list(): for i in self.get_items_history_list():
if isinstance(self.stats, list): if isinstance(self.get_export(), list):
# Stats is a list of data # Stats is a list of data
# Iter throught it (for exemple, iter throught network # Iter throught it (for exemple, iter throught network
# interface) # interface)
for l in self.stats: for l in self.get_export():
self.stats_history.add( self.stats_history.add(
str(l[item_name]) + '_' + i['name'], str(l[item_name]) + '_' + i['name'],
l[i['name']], l[i['name']],
@ -178,7 +178,7 @@ class GlancesPlugin(object):
# Stats is not a list # Stats is not a list
# Add the item to the history directly # Add the item to the history directly
self.stats_history.add(i['name'], self.stats_history.add(i['name'],
self.stats[i['name']], self.get_export()[i['name']],
description=i['description'], description=i['description'],
history_max_size=self._limits['history_size']) history_max_size=self._limits['history_size'])