From 86839491326eaf1fa4f69e6d908aead92142041b Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Thu, 29 Aug 2024 13:06:47 +0200 Subject: [PATCH] added grafana dashboard to the helm chart. --- .../converge/grafana/converge-sessions.json | 485 ++++++++++++++++++ kubernetes/converge/templates/dashboards.yaml | 12 + 2 files changed, 497 insertions(+) create mode 100644 kubernetes/converge/grafana/converge-sessions.json create mode 100644 kubernetes/converge/templates/dashboards.yaml diff --git a/kubernetes/converge/grafana/converge-sessions.json b/kubernetes/converge/grafana/converge-sessions.json new file mode 100644 index 0000000..6967528 --- /dev/null +++ b/kubernetes/converge/grafana/converge-sessions.json @@ -0,0 +1,485 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 1009, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "red", + "mode": "palette-classic-by-name" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisGridShow": false, + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "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": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byFrameRefID", + "options": "A" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 13 + }, + { + "id": "custom.lineStyle", + "value": { + "dash": [ + 0, + 10 + ], + "fill": "dot" + } + } + ] + }, + { + "matcher": { + "id": "byFrameRefID", + "options": "B" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 63 + } + ] + } + ] + }, + "gridPos": { + "h": 5, + "w": 23, + "x": 0, + "y": 0 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "sum(converge_agent_count)", + "instant": false, + "legendFormat": "#agents", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "sum(converge_client_count)", + "hide": false, + "instant": false, + "legendFormat": "#clients", + "range": true, + "refId": "B" + } + ], + "title": "number of agents and clients", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "filterable": true, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "start_time" + }, + "properties": [ + { + "id": "custom.width", + "value": 217 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "duration" + }, + "properties": [ + { + "id": "custom.width", + "value": 97 + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/.*/" + }, + "properties": [ + { + "id": "filterable" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "sessiontype" + }, + "properties": [ + { + "id": "custom.width", + "value": 117 + } + ] + } + ] + }, + "gridPos": { + "h": 11, + "w": 23, + "x": 0, + "y": 5 + }, + "id": 1, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [ + { + "desc": true, + "displayName": "start_time" + } + ] + }, + "pluginVersion": "10.0.3", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "exemplar": false, + "expr": "last_over_time(converge_client_info{client_sessiontype!=\"\"}[$__range]) * on(agent_guid) group_left(agent_hostname, agent_username, agent_os, agent_pwd, agent_address) last_over_time(converge_agent_info[$__range])", + "format": "table", + "hide": false, + "instant": true, + "range": false, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "exemplar": false, + "expr": "last_over_time(converge_client_start_time_millis[$__range])", + "format": "table", + "hide": false, + "instant": true, + "range": false, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "exemplar": false, + "expr": "last_over_time(converge_client_duration_seconds[$__range])", + "format": "table", + "hide": false, + "instant": true, + "range": false, + "refId": "C" + } + ], + "title": "Sessions", + "transformations": [ + { + "id": "joinByField", + "options": { + "byField": "client_guid", + "mode": "inner" + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time 1": true, + "Time 2": true, + "Time 3": true, + "Value #A": true, + "__name__ 1": true, + "__name__ 2": true, + "agent_address": true, + "agent_guid": true, + "agent_pwd": true, + "agent_username": true, + "app 1": true, + "app 2": true, + "app 3": true, + "client_address": true, + "client_guid": true, + "client_hostname": true, + "client_id": true, + "client_os": true, + "client_pwd": true, + "client_shell": true, + "client_username": false, + "container 1": true, + "container 2": true, + "container 3": true, + "endpoint 1": true, + "endpoint 2": true, + "endpoint 3": true, + "instance 1": true, + "instance 2": true, + "instance 3": true, + "job 1": true, + "job 2": true, + "job 3": true, + "namespace 1": true, + "namespace 2": true, + "namespace 3": true, + "pod 1": true, + "pod 2": true, + "pod 3": true, + "service 1": true, + "service 2": true, + "service 3": true + }, + "indexByName": { + "Time 1": 5, + "Time 2": 26, + "Time 3": 36, + "Value #A": 25, + "Value #B": 0, + "Value #C": 1, + "__name__ 1": 27, + "__name__ 2": 37, + "agent_address": 46, + "agent_guid": 6, + "agent_hostname": 8, + "agent_id": 7, + "agent_os": 9, + "agent_pwd": 10, + "agent_username": 11, + "app 1": 12, + "app 2": 28, + "app 3": 38, + "client_address": 47, + "client_guid": 4, + "client_hostname": 13, + "client_id": 14, + "client_os": 15, + "client_pwd": 16, + "client_sessiontype": 2, + "client_shell": 17, + "client_username": 3, + "container 1": 18, + "container 2": 29, + "container 3": 39, + "endpoint 1": 19, + "endpoint 2": 30, + "endpoint 3": 40, + "instance 1": 20, + "instance 2": 31, + "instance 3": 41, + "job 1": 21, + "job 2": 32, + "job 3": 42, + "namespace 1": 22, + "namespace 2": 33, + "namespace 3": 43, + "pod 1": 23, + "pod 2": 34, + "pod 3": 44, + "service 1": 24, + "service 2": 35, + "service 3": 45 + }, + "renameByName": { + "Value #B": "start_time", + "Value #C": "duration", + "agent_id": "rendez-vous id", + "client_sessiontype": "sessiontype", + "client_username": "username" + } + } + }, + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "dateFormat": "time(unit_ms)", + "destinationType": "time", + "targetField": "Value #B" + } + ], + "fields": {} + } + } + ], + "type": "table" + } + ], + "refresh": "30s", + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "filters": [], + "hide": 0, + "name": "Filters", + "skipUrlSync": false, + "type": "adhoc" + } + ] + }, + "time": { + "from": "now-15m", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "converge sessions", + "uid": "f353fa8f-888b-4106-8645-8f8d8796baa7", + "version": 30, + "weekStart": "" +} \ No newline at end of file diff --git a/kubernetes/converge/templates/dashboards.yaml b/kubernetes/converge/templates/dashboards.yaml new file mode 100644 index 0000000..139708f --- /dev/null +++ b/kubernetes/converge/templates/dashboards.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-grafana-dashboards + labels: + grafana_dashboard: "1" +data: + {{- $files := .Files.Glob "grafana/*.json" }} + {{- range $path, $data := $files }} + {{ base $path }}: | + {{- toString $data | nindent 4 }} + {{- end }} \ No newline at end of file