From 0b35b8f6d61ca6cd8b06e31e3451ae2ad23b01e1 Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Tue, 13 Jul 2021 10:19:20 -0400 Subject: [PATCH] add cpu row --- salt/grafana/defaults.yaml | 39 ++--- .../panels/cpu_usage_tasks_graph.json.jinja | 146 ++++++++++++++++++ .../panels/load_averages_graph.json.jinja | 137 ++++++++++++++++ .../panels/process_status_graph.json.jinja | 143 +++++++++++++++++ salt/grafana/panels/row_cpu.json.jinja | 15 ++ .../panels/row_docker_details.json.jinja | 2 +- salt/grafana/panels/row_memory.json.jinja | 15 ++ 7 files changed, 466 insertions(+), 31 deletions(-) create mode 100644 salt/grafana/panels/cpu_usage_tasks_graph.json.jinja create mode 100644 salt/grafana/panels/load_averages_graph.json.jinja create mode 100644 salt/grafana/panels/process_status_graph.json.jinja create mode 100644 salt/grafana/panels/row_cpu.json.jinja create mode 100644 salt/grafana/panels/row_memory.json.jinja diff --git a/salt/grafana/defaults.yaml b/salt/grafana/defaults.yaml index 288a90c16..1eed1bb93 100644 --- a/salt/grafana/defaults.yaml +++ b/salt/grafana/defaults.yaml @@ -52,7 +52,6 @@ grafana: y: 1 h: 4 w: 4 - zeek_packet_loss_singlestat: gridPos: x: 8 @@ -77,7 +76,6 @@ grafana: y: 1 h: 4 w: 4 - io_wait_singlestat: gridPos: x: 0 @@ -127,45 +125,26 @@ grafana: h: 4 w: 2 - row_docker_details: - gridPos: + row_cpu: x: 0 y: 9 h: 1 w: 24 - cpu_docker_combined_current_graph: + cpu_usage_tasks_graph: gridPos: x: 0 y: 10 h: 8 w: 24 - cpu_docker_combined_trend_graph: + load_average_graph: gridPos: x: 0 - y: 18 + y: 10 h: 8 - w: 24 - memory_used_docker_combined_current_graph: + w: 12 + process_status_graph: gridPos: - x: 0 - y: 26 + x: 12 + y: 10 h: 8 - w: 24 - memory_used_docker_combined_trend_graph: - gridPos: - x: 0 - y: 34 - h: 8 - w: 24 - network_usage_docker_combined_current_graph: - gridPos: - x: 0 - y: 42 - h: 8 - w: 24 - network_usage_docker_combined_trend_graph: - gridPos: - x: 0 - y: 50 - h: 8 - w: 24 + w: 12 diff --git a/salt/grafana/panels/cpu_usage_tasks_graph.json.jinja b/salt/grafana/panels/cpu_usage_tasks_graph.json.jinja new file mode 100644 index 000000000..607c9e3c1 --- /dev/null +++ b/salt/grafana/panels/cpu_usage_tasks_graph.json.jinja @@ -0,0 +1,146 @@ +{ + "aliasColors": {}, + "dashLength": 10, + "datasource": "InfluxDB", + "editable": true, + "fill": 1, + "grid": {}, + "gridPos": { + "x": {{ PANELS.cpu_usage_tasks_graph.gridPos.x }}, + "y": {{ PANELS.cpu_usage_tasks_graph.gridPos.y }}, + "w": {{ PANELS.cpu_usage_tasks_graph.gridPos.w }}, + "h": {{ PANELS.cpu_usage_tasks_graph.gridPos.h }} + }, + "height": "300", + "id": 28239, + "interval": "$inter", + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "hideEmpty": true, + "hideZero": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "pointradius": 5, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "targets": [ + { + "alias": "$tag_host: $col", + "dsType": "influxdb", + "function": "mean", + "groupBy": [ + { + "interval": "auto", + "params": [ + "auto" + ], + "type": "time" + }, + { + "key": "host", + "params": [ + "tag" + ], + "type": "tag" + } + ], + "hide": false, + "measurement": "cpu_percentageBusy", + "policy": "default", + "query": "SELECT mean(usage_user) as \"user\", mean(usage_system) as \"system\", mean(usage_softirq) as \"softirq\", mean(usage_steal) as \"steal\", mean(usage_nice) as \"nice\", mean(usage_irq) as \"irq\", mean(usage_iowait) as \"iowait\", mean(usage_guest) as \"guest\", mean(usage_guest_nice) as \"guest_nice\" FROM \"cpu\" WHERE \"host\" =~ /$servername$/ and cpu = 'cpu-total' AND $timeFilter GROUP BY time($interval), *", + "rawQuery": true, + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [], + "orderByTime": "ASC" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "CPU usage", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "percent", + "logBase": 1, + "max": 100, + "min": 0, + "show": true, + "$$hashKey": "object:1007" + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true, + "$$hashKey": "object:1008" + } + ], + "yaxis": { + "align": false, + "alignLevel": null + }, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "pluginVersion": "7.5.4", + "bars": false, + "dashes": false, + "error": false, + "fillGradient": 0, + "percentage": false, + "points": false, + "stack": false, + "steppedLine": false, + "timeFrom": null, + "timeShift": null, + "hiddenSeries": false +} diff --git a/salt/grafana/panels/load_averages_graph.json.jinja b/salt/grafana/panels/load_averages_graph.json.jinja new file mode 100644 index 000000000..0911ffc1b --- /dev/null +++ b/salt/grafana/panels/load_averages_graph.json.jinja @@ -0,0 +1,137 @@ +{ + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "InfluxDB", + "editable": true, + "error": false, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "x": {{ PANELS.load_averages_graph.gridPos.x }}, + "y": {{ PANELS.load_averages_graph.gridPos.y }}, + "w": {{ PANELS.load_averages_graph.gridPos.w }}, + "h": {{ PANELS.load_averages_graph.gridPos.h }} + }, + "height": "350", + "id": 54694, + "interval": "$inter", + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "$tag_host: $col", + "dsType": "influxdb", + "function": "mean", + "groupBy": [ + { + "interval": "auto", + "params": [ + "auto" + ], + "type": "time" + }, + { + "key": "host", + "params": [ + "tag" + ], + "type": "tag" + } + ], + "measurement": "system_load1", + "policy": "default", + "query": "SELECT mean(load1) as 1m,mean(load5) as 5m,mean(load15) as 15m FROM \"system\" WHERE host =~ /$servername$/ AND $timeFilter GROUP BY time($interval), * ORDER BY asc", + "rawQuery": true, + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Load averages", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + }, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "pluginVersion": "7.5.4", + "hiddenSeries": false +} diff --git a/salt/grafana/panels/process_status_graph.json.jinja b/salt/grafana/panels/process_status_graph.json.jinja new file mode 100644 index 000000000..61ea03d1e --- /dev/null +++ b/salt/grafana/panels/process_status_graph.json.jinja @@ -0,0 +1,143 @@ +{ + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "InfluxDB", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "x": {{ PANELS.process_status_graph.gridPos.x }}, + "y": {{ PANELS.process_status_graph.gridPos.y }}, + "w": {{ PANELS.process_status_graph.gridPos.w }}, + "h": {{ PANELS.process_status_graph.gridPos.h }} + }, + "height": "350", + "id": 61852, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "hideEmpty": true, + "hideZero": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "$tag_host: $col", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "processes", + "policy": "default", + "query": "SELECT mean(running) as running, mean(blocked) as blocked, mean(sleeping) as sleeping, mean(stopped) as stopped, mean(zombies) as zombies, mean(paging) as paging, mean(unknown) as unknown FROM \"processes\" WHERE host =~ /$servername$/ AND $timeFilter GROUP BY time($interval), host ORDER BY asc", + "rawQuery": true, + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "blocked" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "host", + "operator": "=~", + "value": "/^$server$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Process Status", + "tooltip": { + "msResolution": false, + "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 + } + ], + "yaxis": { + "align": false, + "alignLevel": null + }, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "pluginVersion": "7.5.4", + "hiddenSeries": false +} diff --git a/salt/grafana/panels/row_cpu.json.jinja b/salt/grafana/panels/row_cpu.json.jinja new file mode 100644 index 000000000..6384048d6 --- /dev/null +++ b/salt/grafana/panels/row_cpu.json.jinja @@ -0,0 +1,15 @@ +{ + "collapsed": false, + "datasource": null, + "gridPos": { + "x": {{ PANELS.row_cpu.gridPos.x }}, + "y": {{ PANELS.row_cpu.gridPos.y }}, + "w": {{ PANELS.row_cpu.gridPos.w }}, + "h": {{ PANELS.row_cpu.gridPos.h }} + }, + "id": 2, + "panels": [], + "repeat": null, + "title": "CPU", + "type": "row" + } diff --git a/salt/grafana/panels/row_docker_details.json.jinja b/salt/grafana/panels/row_docker_details.json.jinja index 55eb4db93..bb06a57ed 100644 --- a/salt/grafana/panels/row_docker_details.json.jinja +++ b/salt/grafana/panels/row_docker_details.json.jinja @@ -7,7 +7,7 @@ "w": {{ PANELS.row_docker_details.gridPos.w }}, "h": {{ PANELS.row_docker_details.gridPos.h }} }, - "id": 2, + "id": 4, "panels": [], "repeat": null, "title": "Docker Details", diff --git a/salt/grafana/panels/row_memory.json.jinja b/salt/grafana/panels/row_memory.json.jinja new file mode 100644 index 000000000..33d203138 --- /dev/null +++ b/salt/grafana/panels/row_memory.json.jinja @@ -0,0 +1,15 @@ +{ + "collapsed": false, + "datasource": null, + "gridPos": { + "x": {{ PANELS.row_memory.gridPos.x }}, + "y": {{ PANELS.row_memory.gridPos.y }}, + "w": {{ PANELS.row_memory.gridPos.w }}, + "h": {{ PANELS.row_memory.gridPos.h }} + }, + "id": 3, + "panels": [], + "repeat": null, + "title": "Memory", + "type": "row" + }