From 10c2759eeda96e1a560419c287047bfd148257a7 Mon Sep 17 00:00:00 2001 From: lhpqaq <657407891@qq.com> Date: Fri, 24 Jan 2025 21:04:50 +0800 Subject: [PATCH] BIGTOP-4339: Move the dashboard configuration content of Grafana to templates --- .../configuration/grafana-dashboard.xml | 1884 ----------------- .../configuration/grafana-datasources.xml | 2 - .../infra/1.0.0/services/grafana/metainfo.xml | 15 + .../grafana/template/cluster-dashboard.json | 878 ++++++++ .../grafana/template/host-dashboard.json | 986 +++++++++ .../infra/v1_0_0/grafana/GrafanaParams.java | 37 +- .../infra/v1_0_0/grafana/GrafanaSetup.java | 49 +- 7 files changed, 1908 insertions(+), 1943 deletions(-) create mode 100644 bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/template/cluster-dashboard.json create mode 100644 bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/template/host-dashboard.json diff --git a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/configuration/grafana-dashboard.xml b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/configuration/grafana-dashboard.xml index 2a50b52d..148220bd 100644 --- a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/configuration/grafana-dashboard.xml +++ b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/configuration/grafana-dashboard.xml @@ -40,1888 +40,4 @@ providers: longtext - - bm_agent_cluster_dashboard - This is the dashboard configuration file for BM agent cluster - =~\"${cluster}\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", - "interval": "", - "legendFormat": "CPU Usage", - "range": true, - "refId": "A" - } - ], - "title": "Global CPU Usage", - "type": "bargauge" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd", - "seriesBy": "last" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "CPU %", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "decimals": 2, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "yellow", - "value": 0.5 - }, - { - "color": "red", - "value": 0.7 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 10, - "w": 12, - "x": 12, - "y": 1 - }, - "id": 72, - "options": { - "legend": { - "calcs": [], - "displayMode": "hidden", - "placement": "right", - "showLegend": false - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "disableTextWrap": false, - "editorMode": "code", - "exemplar": true, - "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "$resolution", - "legendFormat": "__auto", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Cluster CPU Utilization", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "mappings": [], - "noValue": "0", - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "rgb(255, 255, 255)", - "value": null - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 12, - "x": 0, - "y": 8 - }, - "id": 37, - "options": { - "colorMode": "none", - "graphMode": "none", - "justifyMode": "center", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showPercentChange": false, - "text": {}, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "editorMode": "code", - "exemplar": true, - "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_1\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_1\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", - "interval": "", - "legendFormat": "Min_1", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "editorMode": "code", - "exemplar": true, - "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_5\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_5\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", - "interval": "", - "legendFormat": "Min_5", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "editorMode": "code", - "exemplar": true, - "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_15\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_15\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", - "interval": "", - "legendFormat": "Min_15", - "range": true, - "refId": "C" - } - ], - "title": "CPU LoadAvg", - "type": "stat" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 11 - }, - "id": 79, - "panels": [], - "title": "Memory", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "decimals": 2, - "mappings": [], - "max": 1, - "min": 0, - "thresholds": { - "mode": "percentage", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 0, - "y": 12 - }, - "id": 78, - "options": { - "displayMode": "lcd", - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": false - }, - "maxVizHeight": 300, - "minVizHeight": 10, - "minVizWidth": 0, - "namePlacement": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true, - "sizing": "auto", - "text": {}, - "valueMode": "color" - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "editorMode": "code", - "exemplar": true, - "expr": "(sum(\n agent_host_monitoring_mem{memUsage=\"memIdle\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / sum(\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", - "interval": "", - "legendFormat": "Real", - "range": true, - "refId": "A" - } - ], - "title": "Global RAM Usage", - "type": "bargauge" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "MEMORY", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "#EAB839", - "value": 0.5 - }, - { - "color": "red", - "value": 0.7 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 10, - "w": 12, - "x": 12, - "y": 12 - }, - "id": 55, - "options": { - "legend": { - "calcs": [ - "mean", - "lastNotNull", - "max", - "min" - ], - "displayMode": "hidden", - "placement": "right", - "showLegend": false - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "editorMode": "code", - "exemplar": true, - "expr": "(sum(\n agent_host_monitoring_mem{memUsage=\"memIdle\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / sum(\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", - "interval": "$resolution", - "legendFormat": "Memory usage in %", - "range": true, - "refId": "A" - } - ], - "title": "Cluster Memory Utilization", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "mappings": [], - "noValue": "0", - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "rgb(255, 255, 255)", - "value": null - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 12, - "x": 0, - "y": 19 - }, - "id": 39, - "options": { - "colorMode": "none", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showPercentChange": false, - "text": {}, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "editorMode": "code", - "exemplar": true, - "expr": "(sum(\n agent_host_monitoring_mem{memUsage=\"memIdle\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / sum(\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", - "interval": "", - "legendFormat": "Real", - "range": true, - "refId": "A" - } - ], - "title": "RAM Usage", - "type": "stat" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 22 - }, - "id": 81, - "panels": [], - "title": "Storage", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "decimals": 2, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 23 - }, - "id": 87, - "options": { - "minVizHeight": 75, - "minVizWidth": 75, - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showThresholdLabels": false, - "showThresholdMarkers": true, - "sizing": "auto" - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "disableTextWrap": false, - "editorMode": "code", - "exemplar": false, - "expr": "(sum(\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / sum(\n agent_host_monitoring_disk{diskUsage=\"diskTotalSpace\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "interval": "$resolution", - "legendFormat": "{{label_name}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Persistent Volumes - Usage in %", - "type": "gauge" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 25, - "gradientMode": "opacity", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "decimals": 2, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 23 - }, - "id": 82, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "right", - "showLegend": false - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "disableTextWrap": false, - "editorMode": "code", - "exemplar": false, - "expr": "(sum(\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / sum(\n agent_host_monitoring_disk{diskUsage=\"diskTotalSpace\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "interval": "$resolution", - "legendFormat": "{{label_name}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Persistent Volumes - Usage in %", - "type": "timeseries" - } - ], - "preload": false, - "refresh": "30s", - "schemaVersion": 40, - "tags": [], - "templating": { - "list": [ - { - "current": { - "text": "prometheus", - "value": "uid4prometheus" - }, - "includeAll": false, - "name": "datasource", - "label": "Datasource", - "options": [], - "query": "prometheus", - "refresh": 1, - "regex": "", - "type": "datasource" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "type": "query", - "name": "${cluster_label}", - "label": "Cluster", - "options": [], - "query": "label_values(${cluster_label})", - "refresh": 2, - "multi": false, - "includeAll": false, - "current": { - "text": "${default_cluster_name}", - "value": "${default_cluster_name}" - } - }, - { - "current": { - "text": "1m", - "value": "1m" - }, - "includeAll": false, - "name": "resolution", - "label": "Resolution", - "options": [ - { - "selected": false, - "text": "1s", - "value": "1s" - }, - { - "selected": false, - "text": "5s", - "value": "5s" - }, - { - "selected": true, - "text": "1m", - "value": "1m" - }, - { - "selected": false, - "text": "3m", - "value": "3m" - }, - { - "selected": false, - "text": "5m", - "value": "5m" - } - ], - "query": "1s, 5s, 1m, 3m, 5m", - "type": "custom" - } - ] - }, - "time": { - "from": "now-1h", - "to": "now" - }, - "timepicker": {}, - "timezone": "", - "title": "${dashboard_name}", - "uid": "dbuid_${dashboard_name}", - "version": 4, - "weekStart": "" -} -]]> - - - longtext - - - - bm_agent_host_dashboard - This is the dashboard configuration file for BM agent host - =~\"$cluster\", hostname=~\"$host\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", - "interval": "", - "legendFormat": "CPU Usage", - "range": true, - "refId": "A" - } - ], - "title": "CPU Usage", - "type": "bargauge" - }, - { - "id": 88, - "type": "stat", - "title": "CPU Core", - "gridPos": { - "x": 12, - "y": 1, - "h": 3, - "w": 12 - }, - "fieldConfig": { - "defaults": { - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "rgb(255, 255, 255)", - "value": null - } - ] - }, - "noValue": "0", - "unit": "none" - }, - "overrides": [] - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "disableTextWrap": false, - "editorMode": "code", - "exemplar": true, - "expr": "max by (value) (\n label_replace(\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"},\n \"value\", \"$1\", \"physical_cores\", \"(.*)\"\n )\n)", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "", - "legendFormat": "Physical: {{value}}", - "range": true, - "refId": "B", - "useBackend": false, - "format": "time_series" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "disableTextWrap": false, - "editorMode": "builder", - "exemplar": true, - "expr": "max by (value) (\n label_replace(\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"},\n \"value\", \"$1\", \"logical_cores\", \"(.*)\"\n )\n)", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "", - "legendFormat": "Logical: {{value}}", - "range": true, - "refId": "C", - "useBackend": false, - "format": "time_series" - } - ], - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "options": { - "reduceOptions": { - "values": false, - "calcs": [ - "min" - ], - "fields": "" - }, - "orientation": "auto", - "textMode": "name", - "wideLayout": true, - "colorMode": "none", - "graphMode": "none", - "justifyMode": "center", - "showPercentChange": false, - "percentChangeColorMode": "standard", - "text": {} - } - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd", - "seriesBy": "last" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "CPU %", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "decimals": 2, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "yellow", - "value": 0.5 - }, - { - "color": "red", - "value": 0.7 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 12, - "y": 4 - }, - "id": 72, - "options": { - "legend": { - "calcs": [], - "displayMode": "hidden", - "placement": "right", - "showLegend": false - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "disableTextWrap": false, - "editorMode": "code", - "exemplar": true, - "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "$resolution", - "legendFormat": "__auto", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "CPU Utilization", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "mappings": [], - "noValue": "0", - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "rgb(255, 255, 255)", - "value": null - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 12, - "x": 0, - "y": 8 - }, - "id": 37, - "options": { - "colorMode": "none", - "graphMode": "none", - "justifyMode": "center", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showPercentChange": false, - "text": {}, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "editorMode": "code", - "exemplar": true, - "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_1\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_1\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", - "interval": "", - "legendFormat": "Min_1", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "editorMode": "code", - "exemplar": true, - "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_5\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_5\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", - "interval": "", - "legendFormat": "Min_5", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "editorMode": "code", - "exemplar": true, - "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_15\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_15\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", - "interval": "", - "legendFormat": "Min_15", - "range": true, - "refId": "C" - } - ], - "title": "CPU LoadAvg", - "type": "stat" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 11 - }, - "id": 79, - "panels": [], - "title": "Memory", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "decimals": 2, - "mappings": [], - "max": 1, - "min": 0, - "thresholds": { - "mode": "percentage", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 0, - "y": 12 - }, - "id": 78, - "options": { - "displayMode": "lcd", - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": false - }, - "maxVizHeight": 300, - "minVizHeight": 10, - "minVizWidth": 0, - "namePlacement": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true, - "sizing": "auto", - "text": {}, - "valueMode": "color" - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "" - }, - "editorMode": "code", - "exemplar": true, - "expr": "(sum(\n agent_host_monitoring_mem{memUsage=\"memIdle\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / sum(\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", - "interval": "", - "legendFormat": "Real", - "range": true, - "refId": "A" - } - ], - "title": "RAM Usage", - "type": "bargauge" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "MEMORY", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "#EAB839", - "value": 0.5 - }, - { - "color": "red", - "value": 0.7 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 10, - "w": 12, - "x": 12, - "y": 12 - }, - "id": 55, - "options": { - "legend": { - "calcs": [ - "mean", - "lastNotNull", - "max", - "min" - ], - "displayMode": "hidden", - "placement": "right", - "showLegend": false - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "" - }, - "editorMode": "code", - "exemplar": true, - "expr": "(sum(\n agent_host_monitoring_mem{memUsage=\"memIdle\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / sum(\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", - "interval": "$resolution", - "legendFormat": "Memory usage in %", - "range": true, - "refId": "A" - } - ], - "title": "Memory Utilization", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "mappings": [], - "noValue": "0", - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "rgb(255, 255, 255)", - "value": null - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 12, - "x": 0, - "y": 19 - }, - "id": 39, - "options": { - "colorMode": "none", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showPercentChange": false, - "text": {}, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "" - }, - "editorMode": "code", - "exemplar": true, - "expr": "(sum(\n agent_host_monitoring_mem{memUsage=\"memIdle\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / sum(\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", - "interval": "", - "legendFormat": "Real", - "range": true, - "refId": "A" - } - ], - "title": "RAM Usage", - "type": "stat" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 22 - }, - "id": 81, - "panels": [], - "title": "Storage", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "decimals": 2, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 23 - }, - "id": 87, - "options": { - "minVizHeight": 75, - "minVizWidth": 75, - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showThresholdLabels": false, - "showThresholdMarkers": true, - "sizing": "auto" - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "disableTextWrap": false, - "editorMode": "code", - "exemplar": false, - "expr": "(sum(\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / sum(\n agent_host_monitoring_disk{diskUsage=\"diskTotalSpace\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "interval": "$resolution", - "legendFormat": "{{label_name}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Persistent Volumes - Usage in %", - "type": "gauge" - }, - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 25, - "gradientMode": "opacity", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "decimals": 2, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 23 - }, - "id": 82, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "right", - "showLegend": false - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "pluginVersion": "11.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "disableTextWrap": false, - "editorMode": "code", - "exemplar": false, - "expr": "(sum(\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / sum(\n agent_host_monitoring_disk{diskUsage=\"diskTotalSpace\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "interval": "$resolution", - "legendFormat": "{{label_name}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Persistent Volumes - Usage in %", - "type": "timeseries" - } - ], - "preload": false, - "refresh": "30s", - "schemaVersion": 40, - "tags": [], - "templating": { - "list": [ - { - "current": { - "text": "prometheus", - "value": "uid4prometheus" - }, - "includeAll": false, - "label": "Datasource", - "name": "datasource", - "options": [], - "query": "prometheus", - "refresh": 1, - "regex": "", - "type": "datasource" - }, - { - "current": { - "text": "${default_cluster_name}", - "value": "${default_cluster_name}" - }, - "datasource": { - "type": "prometheus", - "uid": "uid4prometheus" - }, - "includeAll": false, - "label": "Cluster", - "name": "${cluster_label}", - "options": [], - "query": "label_values(${cluster_label})", - "refresh": 2, - "type": "query" - }, - { - "current": { - "text": "${default_host_name}", - "value": "${default_host_name}" - }, - "definition": "label_values({${cluster_label}<#noparse>=~\"$cluster\"},hostname)", - "label": "Host", - "name": "host", - "options": [], - "query": { - "qryType": 1, - "query": "label_values({${cluster_label}<#noparse>=~\"$cluster\"},hostname)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "type": "query" - }, - { - "current": { - "text": "1m", - "value": "1m" - }, - "includeAll": false, - "label": "Resolution", - "name": "resolution", - "options": [ - { - "selected": false, - "text": "1s", - "value": "1s" - }, - { - "selected": false, - "text": "5s", - "value": "5s" - }, - { - "selected": true, - "text": "1m", - "value": "1m" - }, - { - "selected": false, - "text": "3m", - "value": "3m" - }, - { - "selected": false, - "text": "5m", - "value": "5m" - } - ], - "query": "1s, 5s, 1m, 3m, 5m", - "type": "custom" - } - ] - }, - "time": { - "from": "now-1h", - "to": "now" - }, - "timepicker": {}, - "timezone": "", - "title": "${dashboard_name}", - "uid": "dbuid_${dashboard_name}", - "version": 19, - "weekStart": "" -} - ]]> - - - longtext - - \ No newline at end of file diff --git a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/configuration/grafana-datasources.xml b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/configuration/grafana-datasources.xml index 1f88c3f4..d0f3fc76 100644 --- a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/configuration/grafana-datasources.xml +++ b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/configuration/grafana-datasources.xml @@ -26,7 +26,6 @@ apiVersion: 1 datasources: -<#if prometheus_url??> - name: prometheus type: prometheus access: proxy @@ -34,7 +33,6 @@ datasources: isDefault: true editable: true uid: uid4prometheus - ]]> diff --git a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/metainfo.xml b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/metainfo.xml index 2c220c9f..e1054bbf 100644 --- a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/metainfo.xml +++ b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/metainfo.xml @@ -64,5 +64,20 @@ + + + + + + + + prometheus + \ No newline at end of file diff --git a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/template/cluster-dashboard.json b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/template/cluster-dashboard.json new file mode 100644 index 00000000..e1593c72 --- /dev/null +++ b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/template/cluster-dashboard.json @@ -0,0 +1,878 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": 10, + "links": [], + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 67, + "panels": [], + "title": "CPU", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "max": 1, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 77, + "options": { + "displayMode": "lcd", + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "maxVizHeight": 300, + "minVizHeight": 10, + "minVizWidth": 0, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", + "interval": "", + "legendFormat": "CPU Usage", + "range": true, + "refId": "A" + } + ], + "title": "Global CPU Usage", + "type": "bargauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd", + "seriesBy": "last" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "CPU %", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "yellow", + "value": 0.5 + }, + { + "color": "red", + "value": 0.7 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 72, + "options": { + "legend": { + "calcs": [], + "displayMode": "hidden", + "placement": "right", + "showLegend": false + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "disableTextWrap": false, + "editorMode": "code", + "exemplar": true, + "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "$resolution", + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Cluster CPU Utilization", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgb(255, 255, 255)", + "value": null + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 37, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "center", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_1\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_1\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", + "interval": "", + "legendFormat": "Min_1", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_5\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_5\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", + "interval": "", + "legendFormat": "Min_5", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_15\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_15\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", + "interval": "", + "legendFormat": "Min_15", + "range": true, + "refId": "C" + } + ], + "title": "CPU LoadAvg", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 11 + }, + "id": 79, + "panels": [], + "title": "Memory", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "decimals": 2, + "mappings": [], + "max": 1, + "min": 0, + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 12 + }, + "id": 78, + "options": { + "displayMode": "lcd", + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "maxVizHeight": 300, + "minVizHeight": 10, + "minVizWidth": 0, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showUnfilled": true, + "sizing": "auto", + "text": {}, + "valueMode": "color" + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "editorMode": "code", + "exemplar": true, + "expr": "(sum(\n agent_host_monitoring_mem{memUsage=\"memIdle\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / sum(\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", + "interval": "", + "legendFormat": "Real", + "range": true, + "refId": "A" + } + ], + "title": "Global RAM Usage", + "type": "bargauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "MEMORY", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "#EAB839", + "value": 0.5 + }, + { + "color": "red", + "value": 0.7 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 12 + }, + "id": 55, + "options": { + "legend": { + "calcs": [ + "mean", + "lastNotNull", + "max", + "min" + ], + "displayMode": "hidden", + "placement": "right", + "showLegend": false + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "editorMode": "code", + "exemplar": true, + "expr": "(sum(\n agent_host_monitoring_mem{memUsage=\"memIdle\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / sum(\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", + "interval": "$resolution", + "legendFormat": "Memory usage in %", + "range": true, + "refId": "A" + } + ], + "title": "Cluster Memory Utilization", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgb(255, 255, 255)", + "value": null + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 12, + "x": 0, + "y": 19 + }, + "id": 39, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "editorMode": "code", + "exemplar": true, + "expr": "(sum(\n agent_host_monitoring_mem{memUsage=\"memIdle\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / sum(\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", + "interval": "", + "legendFormat": "Real", + "range": true, + "refId": "A" + } + ], + "title": "RAM Usage", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 22 + }, + "id": 81, + "panels": [], + "title": "Storage", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 23 + }, + "id": 87, + "options": { + "minVizHeight": 75, + "minVizWidth": 75, + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true, + "sizing": "auto" + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "disableTextWrap": false, + "editorMode": "code", + "exemplar": false, + "expr": "(sum(\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / sum(\n agent_host_monitoring_disk{diskUsage=\"diskTotalSpace\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "$resolution", + "legendFormat": "{{label_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Persistent Volumes - Usage in %", + "type": "gauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 25, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 23 + }, + "id": 82, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "right", + "showLegend": false + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "disableTextWrap": false, + "editorMode": "code", + "exemplar": false, + "expr": "(sum(\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n) / sum(\n agent_host_monitoring_disk{diskUsage=\"diskTotalSpace\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"${cluster}\"}\n )\n)", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "$resolution", + "legendFormat": "{{label_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Persistent Volumes - Usage in %", + "type": "timeseries" + } + ], + "preload": false, + "refresh": "30s", + "schemaVersion": 40, + "tags": [], + "templating": { + "list": [ + { + "current": { + "text": "prometheus", + "value": "uid4prometheus" + }, + "includeAll": false, + "name": "datasource", + "label": "Datasource", + "options": [], + "query": "prometheus", + "refresh": 1, + "regex": "", + "type": "datasource" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "type": "query", + "name": "${cluster_label}", + "label": "Cluster", + "options": [], + "query": "label_values(${cluster_label})", + "refresh": 2, + "multi": false, + "includeAll": false, + "current": { + "text": "${default_cluster_name}", + "value": "${default_cluster_name}" + } + }, + { + "current": { + "text": "1m", + "value": "1m" + }, + "includeAll": false, + "name": "resolution", + "label": "Resolution", + "options": [ + { + "selected": false, + "text": "1s", + "value": "1s" + }, + { + "selected": false, + "text": "5s", + "value": "5s" + }, + { + "selected": true, + "text": "1m", + "value": "1m" + }, + { + "selected": false, + "text": "3m", + "value": "3m" + }, + { + "selected": false, + "text": "5m", + "value": "5m" + } + ], + "query": "1s, 5s, 1m, 3m, 5m", + "type": "custom" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "${cluster_dashboard_name}", + "uid": "dbuid_${cluster_dashboard_name}", + "version": 4, + "weekStart": "" +} \ No newline at end of file diff --git a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/template/host-dashboard.json b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/template/host-dashboard.json new file mode 100644 index 00000000..f61565a6 --- /dev/null +++ b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/grafana/template/host-dashboard.json @@ -0,0 +1,986 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": 3, + "links": [], + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 67, + "panels": [], + "title": "CPU", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "max": 1, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 77, + "options": { + "displayMode": "lcd", + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "maxVizHeight": 300, + "minVizHeight": 10, + "minVizWidth": 0, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", + "interval": "", + "legendFormat": "CPU Usage", + "range": true, + "refId": "A" + } + ], + "title": "CPU Usage", + "type": "bargauge" + }, + { + "id": 88, + "type": "stat", + "title": "CPU Core", + "gridPos": { + "x": 12, + "y": 1, + "h": 3, + "w": 12 + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgb(255, 255, 255)", + "value": null + } + ] + }, + "noValue": "0", + "unit": "none" + }, + "overrides": [] + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "disableTextWrap": false, + "editorMode": "code", + "exemplar": true, + "expr": "max by (value) (\n label_replace(\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"},\n \"value\", \"$1\", \"physical_cores\", \"(.*)\"\n )\n)", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "interval": "", + "legendFormat": "Physical: {{value}}", + "range": true, + "refId": "B", + "useBackend": false, + "format": "time_series" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "exemplar": true, + "expr": "max by (value) (\n label_replace(\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"},\n \"value\", \"$1\", \"logical_cores\", \"(.*)\"\n )\n)", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "interval": "", + "legendFormat": "Logical: {{value}}", + "range": true, + "refId": "C", + "useBackend": false, + "format": "time_series" + } + ], + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "options": { + "reduceOptions": { + "values": false, + "calcs": [ + "min" + ], + "fields": "" + }, + "orientation": "auto", + "textMode": "name", + "wideLayout": true, + "colorMode": "none", + "graphMode": "none", + "justifyMode": "center", + "showPercentChange": false, + "percentChangeColorMode": "standard", + "text": {} + } + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd", + "seriesBy": "last" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "CPU %", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "yellow", + "value": 0.5 + }, + { + "color": "red", + "value": 0.7 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 4 + }, + "id": 72, + "options": { + "legend": { + "calcs": [], + "displayMode": "hidden", + "placement": "right", + "showLegend": false + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "disableTextWrap": false, + "editorMode": "code", + "exemplar": true, + "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuUsage\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "$resolution", + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "CPU Utilization", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgb(255, 255, 255)", + "value": null + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 37, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "center", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_1\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_1\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", + "interval": "", + "legendFormat": "Min_1", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_5\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_5\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", + "interval": "", + "legendFormat": "Min_5", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum(\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_15\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / count(\n count by (instance) (\n agent_host_monitoring_cpu{cpuUsage=\"cpuLoadAvgMin_15\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", + "interval": "", + "legendFormat": "Min_15", + "range": true, + "refId": "C" + } + ], + "title": "CPU LoadAvg", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 11 + }, + "id": 79, + "panels": [], + "title": "Memory", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "decimals": 2, + "mappings": [], + "max": 1, + "min": 0, + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 12 + }, + "id": 78, + "options": { + "displayMode": "lcd", + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "maxVizHeight": 300, + "minVizHeight": 10, + "minVizWidth": 0, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showUnfilled": true, + "sizing": "auto", + "text": {}, + "valueMode": "color" + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "" + }, + "editorMode": "code", + "exemplar": true, + "expr": "(sum(\n agent_host_monitoring_mem{memUsage=\"memIdle\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / sum(\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", + "interval": "", + "legendFormat": "Real", + "range": true, + "refId": "A" + } + ], + "title": "RAM Usage", + "type": "bargauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "MEMORY", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "#EAB839", + "value": 0.5 + }, + { + "color": "red", + "value": 0.7 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 12 + }, + "id": 55, + "options": { + "legend": { + "calcs": [ + "mean", + "lastNotNull", + "max", + "min" + ], + "displayMode": "hidden", + "placement": "right", + "showLegend": false + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "" + }, + "editorMode": "code", + "exemplar": true, + "expr": "(sum(\n agent_host_monitoring_mem{memUsage=\"memIdle\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / sum(\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", + "interval": "$resolution", + "legendFormat": "Memory usage in %", + "range": true, + "refId": "A" + } + ], + "title": "Memory Utilization", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgb(255, 255, 255)", + "value": null + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 12, + "x": 0, + "y": 19 + }, + "id": 39, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "" + }, + "editorMode": "code", + "exemplar": true, + "expr": "(sum(\n agent_host_monitoring_mem{memUsage=\"memIdle\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / sum(\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_mem{memUsage=\"memTotal\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", + "interval": "", + "legendFormat": "Real", + "range": true, + "refId": "A" + } + ], + "title": "RAM Usage", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 22 + }, + "id": 81, + "panels": [], + "title": "Storage", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 23 + }, + "id": 87, + "options": { + "minVizHeight": 75, + "minVizWidth": 75, + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true, + "sizing": "auto" + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "disableTextWrap": false, + "editorMode": "code", + "exemplar": false, + "expr": "(sum(\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / sum(\n agent_host_monitoring_disk{diskUsage=\"diskTotalSpace\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "$resolution", + "legendFormat": "{{label_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Persistent Volumes - Usage in %", + "type": "gauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 25, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 23 + }, + "id": 82, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "right", + "showLegend": false + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "disableTextWrap": false, + "editorMode": "code", + "exemplar": false, + "expr": "(sum(\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n) / sum(\n agent_host_monitoring_disk{diskUsage=\"diskTotalSpace\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n)) /\ncount(\n count by (instance) (\n agent_host_monitoring_disk{diskUsage=\"diskFreeSpace\", ${cluster_label}<#noparse>=~\"$cluster\", hostname=~\"$host\"}\n )\n)", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "$resolution", + "legendFormat": "{{label_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Persistent Volumes - Usage in %", + "type": "timeseries" + } + ], + "preload": false, + "refresh": "30s", + "schemaVersion": 40, + "tags": [], + "templating": { + "list": [ + { + "current": { + "text": "prometheus", + "value": "uid4prometheus" + }, + "includeAll": false, + "label": "Datasource", + "name": "datasource", + "options": [], + "query": "prometheus", + "refresh": 1, + "regex": "", + "type": "datasource" + }, + { + "current": { + "text": "${default_cluster_name}", + "value": "${default_cluster_name}" + }, + "datasource": { + "type": "prometheus", + "uid": "uid4prometheus" + }, + "includeAll": false, + "label": "Cluster", + "name": "${cluster_label}", + "options": [], + "query": "label_values(${cluster_label})", + "refresh": 2, + "type": "query" + }, + { + "current": { + "text": "${default_host_name}", + "value": "${default_host_name}" + }, + "definition": "label_values({${cluster_label}<#noparse>=~\"$cluster\"},hostname)", + "label": "Host", + "name": "host", + "options": [], + "query": { + "qryType": 1, + "query": "label_values({${cluster_label}<#noparse>=~\"$cluster\"},hostname)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "current": { + "text": "1m", + "value": "1m" + }, + "includeAll": false, + "label": "Resolution", + "name": "resolution", + "options": [ + { + "selected": false, + "text": "1s", + "value": "1s" + }, + { + "selected": false, + "text": "5s", + "value": "5s" + }, + { + "selected": true, + "text": "1m", + "value": "1m" + }, + { + "selected": false, + "text": "3m", + "value": "3m" + }, + { + "selected": false, + "text": "5m", + "value": "5m" + } + ], + "query": "1s, 5s, 1m, 3m, 5m", + "type": "custom" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "${host_dashboard_name}", + "uid": "dbuid_${host_dashboard_name}", + "version": 19, + "weekStart": "" +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/grafana/GrafanaParams.java b/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/grafana/GrafanaParams.java index 8e480e94..118471c6 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/grafana/GrafanaParams.java +++ b/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/grafana/GrafanaParams.java @@ -60,12 +60,9 @@ public GrafanaParams(ComponentCommandPayload componentCommandPayload) { globalParamsMap.put("port", grafanaPort); globalParamsMap.put("log_level", grafanaLogLevel); globalParamsMap.put("provisioning_path", provisioningDir()); - if (prometheusServer != null) { - globalParamsMap.put( - "prometheus_url", MessageFormat.format("http://{0}:{1}", prometheusServer, prometheusPort)); - setDashboards(); - globalParamsMap.put("dashboards", dashboards); - } + globalParamsMap.put("prometheus_url", MessageFormat.format("http://{0}:{1}", prometheusServer, prometheusPort)); + setDashboards(); + globalParamsMap.put("dashboards", dashboards); } public String dataDir() { @@ -146,23 +143,22 @@ public List getClusters() { public void setDashboards() { dashboards = new ArrayList<>(); - Map clusterDashboard = new HashMap<>(); // Used for dashboard yaml configuration + Map clusterDashboard = new HashMap<>(); clusterDashboard.put("name", "Cluster"); - clusterDashboard.put("path", dashboardConfigDir("Cluster")); - - // Used for dashboard json configuration - clusterDashboard.put("cluster_label", PrometheusParams.AGENT_TARGET_LABEL); - clusterDashboard.put("dashboard_name", "Cluster"); - clusterDashboard.put("dashboard_config_content", bmAgentClusterDashboardConfig); + clusterDashboard.put("path", dashboardConfigDir("cluster")); Map hostDashboard = new HashMap<>(); hostDashboard.put("name", "Host"); - hostDashboard.put("path", dashboardConfigDir("Host")); + hostDashboard.put("path", dashboardConfigDir("host")); + + dashboards.add(clusterDashboard); + dashboards.add(hostDashboard); - hostDashboard.put("cluster_label", PrometheusParams.AGENT_TARGET_LABEL); - hostDashboard.put("dashboard_name", "Host"); - hostDashboard.put("dashboard_config_content", bmAgentHostDashboardConfig); + // Used for dashboard json configuration + globalParamsMap.put("cluster_label", PrometheusParams.AGENT_TARGET_LABEL); + globalParamsMap.put("cluster_dashboard_name", "Cluster"); + globalParamsMap.put("host_dashboard_name", "Host"); Map> clusterHost = getClusterHosts(); if (clusterHost != null && !clusterHost.isEmpty()) { @@ -171,11 +167,8 @@ public void setDashboards() { ? "" : clusterHost.get(defaultCluster).get(0); clusterDashboard.put("default_cluster_name", defaultCluster); - hostDashboard.put("default_cluster_name", defaultCluster); - hostDashboard.put("default_host_name", defaultHost); + globalParamsMap.put("default_cluster_name", defaultCluster); + globalParamsMap.put("default_host_name", defaultHost); } - - dashboards.add(clusterDashboard); - dashboards.add(hostDashboard); } } diff --git a/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/grafana/GrafanaSetup.java b/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/grafana/GrafanaSetup.java index 8170e140..2f91ad41 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/grafana/GrafanaSetup.java +++ b/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/grafana/GrafanaSetup.java @@ -20,7 +20,6 @@ import org.apache.bigtop.manager.common.constants.Constants; import org.apache.bigtop.manager.common.shell.ShellResult; -import org.apache.bigtop.manager.stack.core.exception.StackException; import org.apache.bigtop.manager.stack.core.spi.param.Params; import org.apache.bigtop.manager.stack.core.utils.linux.LinuxFileUtils; @@ -29,7 +28,6 @@ import lombok.extern.slf4j.Slf4j; import java.text.MessageFormat; -import java.util.Map; @Slf4j @NoArgsConstructor(access = AccessLevel.PRIVATE) @@ -51,40 +49,21 @@ public static ShellResult config(Params params) { Constants.PERMISSION_644, grafanaParams.getGlobalParamsMap()); - if (grafanaParams.getPrometheusServer() != null) { - LinuxFileUtils.toFileByTemplate( - grafanaParams.getDataSourceContent(), - MessageFormat.format("{0}/prometheus.yaml", grafanaParams.dataSourceDir()), - user, - group, - Constants.PERMISSION_644, - grafanaParams.getGlobalParamsMap()); - - LinuxFileUtils.toFileByTemplate( - grafanaParams.getGrafanaDashboardContent(), - MessageFormat.format("{0}/bm-dashboards.yaml", grafanaParams.dashboardsDir()), - user, - group, - Constants.PERMISSION_644, - grafanaParams.getGlobalParamsMap()); - - for (Map dashboard : grafanaParams.getDashboards()) { - String confPath = (String) dashboard.get("path"); - if (confPath == null) { - throw new StackException("Dashboard path is not set"); - } - - LinuxFileUtils.createDirectories(confPath, user, group, Constants.PERMISSION_755, true); + LinuxFileUtils.toFileByTemplate( + grafanaParams.getDataSourceContent(), + MessageFormat.format("{0}/prometheus.yaml", grafanaParams.dataSourceDir()), + user, + group, + Constants.PERMISSION_644, + grafanaParams.getGlobalParamsMap()); - LinuxFileUtils.toFileByTemplate( - (String) dashboard.get("dashboard_config_content"), - MessageFormat.format("{0}/{1}.json", confPath, dashboard.get("name")), - user, - group, - Constants.PERMISSION_644, - dashboard); - } - } + LinuxFileUtils.toFileByTemplate( + grafanaParams.getGrafanaDashboardContent(), + MessageFormat.format("{0}/bm-dashboards.yaml", grafanaParams.dashboardsDir()), + user, + group, + Constants.PERMISSION_644, + grafanaParams.getGlobalParamsMap()); return ShellResult.success("Grafana Configure success!"); }