From 25518c2ee79420c9bda1bfe275705dd7ef146e1e Mon Sep 17 00:00:00 2001 From: Antonio Scardace <33966051+antonioscardace@users.noreply.github.com> Date: Tue, 11 Jun 2024 15:54:02 +0200 Subject: [PATCH] add: Grafana config files --- grafana-logging/certs/cert.pem | 24 + grafana-logging/certs/key.pem | 28 + grafana-logging/dashboard.json | 492 ++++++++++++++++++ grafana-logging/grafana.ini | 19 + .../provisioning/dashboards/default.yml | 13 + .../provisioning/datasources/default.yml | 14 + 6 files changed, 590 insertions(+) create mode 100644 grafana-logging/certs/cert.pem create mode 100644 grafana-logging/certs/key.pem create mode 100644 grafana-logging/dashboard.json create mode 100644 grafana-logging/grafana.ini create mode 100644 grafana-logging/provisioning/dashboards/default.yml create mode 100644 grafana-logging/provisioning/datasources/default.yml diff --git a/grafana-logging/certs/cert.pem b/grafana-logging/certs/cert.pem new file mode 100644 index 0000000..1650cc3 --- /dev/null +++ b/grafana-logging/certs/cert.pem @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIID8TCCAtmgAwIBAgIUPtfKfSVzWl0qp9LlTR9wLYaEIAwwDQYJKoZIhvcNAQEL +BQAwgYcxCzAJBgNVBAYTAml0MQ4wDAYDVQQIDAVpdGFseTEQMA4GA1UEBwwHY2F0 +YW5pYTENMAsGA1UECgwEbm9uZTENMAsGA1UECwwEbm9uZTENMAsGA1UEAwwEbm9u +ZTEpMCcGCSqGSIb3DQEJARYac2NhcmRhY2UuYW50b25pb0BnbWFpbC5jb20wHhcN +MjMwMzIzMDkzNzQ2WhcNMzMwMzIwMDkzNzQ2WjCBhzELMAkGA1UEBhMCaXQxDjAM +BgNVBAgMBWl0YWx5MRAwDgYDVQQHDAdjYXRhbmlhMQ0wCwYDVQQKDARub25lMQ0w +CwYDVQQLDARub25lMQ0wCwYDVQQDDARub25lMSkwJwYJKoZIhvcNAQkBFhpzY2Fy +ZGFjZS5hbnRvbmlvQGdtYWlsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +AQoCggEBAKiw7nV11ZyZvJkz0dLb5nOCpa6YR4Ey82xBNKZT/0dL3UM2eI/ksNTH +paDaVocRZWfz9Hoq3MH7xG6K4ksj8jqFD4Kt1AA2pAbjG7ypAjzU32sDlcoo14i2 +OslE/gMzXNB8F+YDMwJe4Ija7QqR7X6/b5r0jnByde0iT4h43CFKE5GsjE9crpHw +GpyFYlwXx6EDF0H5iMHStPQ6cietBfXdd97zaiaZi4mtUmDpfvdHoR0tUEBYWR5Y +OXnehjm1Kr1t2TBDXAsEP0LXRzGC66rvoDnSncREEzgKH8zyR0Dw80xBcLnKUwGa +ScJxKIrsJtLoa3oB37RN4/DGE/h99CsCAwEAAaNTMFEwHQYDVR0OBBYEFDthr5op +5gijXBQCbE+zRAxcPmplMB8GA1UdIwQYMBaAFDthr5op5gijXBQCbE+zRAxcPmpl +MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAIBBFnIO+B0HJv1Z +X6vomazAY5t1kW2TrRpgahEKwiFIQfvJeGbdEazNxH7PsgGF3aOL0PAHEr6yLCvk +yyC8fqqSnQNHPcOKzWJ2VaT5BYzYtfhdA4Bnx/1b1+a6Nz177vTuqYuxHLSuDiep +5vPnYsaMxJk9U710U5QpJP7qQ7ZrLoNQLbmvQZRf1LkpbqEjGwylLbA18fdjRYsi +qHRw4N8hpYBorwZuosYjKlPZY+6ZoGDIJ6wKHHJM2X83PLANWYOfhL/UUUv+Rwr+ +2X8ZFLjsKgaqzmA+Ydi/C0souZRBpr9Yy/YtYXePBgmh9SWe9QoVGO26/rXu4MC0 +zu6I5lE= +-----END CERTIFICATE----- diff --git a/grafana-logging/certs/key.pem b/grafana-logging/certs/key.pem new file mode 100644 index 0000000..9091276 --- /dev/null +++ b/grafana-logging/certs/key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCosO51ddWcmbyZ +M9HS2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GVIfPl+ZdRegjuuGG71GAEc +Rdr7FFyn3jHVR/zHEBiqBmcJtBpVnPtG6u3KP1lNYDc9mV3eyL05grwmZnF92UR6 +oA7z4hJxgTwaNNBXVDClyYXkKLqhhDSvduPsavW7WFnKsVoDhWSf7f+TAoGAIfiM +yMUtTNJUmIO4Oz850rRwLtIz44xf6ZomOvuTShv6/Vs+okjnr95ln3sugX+faLAp +vUgIqs2ItDklM4tzg7T38v0l9O72OTY+uc70b0ALH7NzoOLcU+Hswh9YGEyDpZrt +slxpq3GqteRaRxogqFxsIlqnb6Sf2NAQo10rLJECgYEAs4jPLRbPsUWUtwa7lrXU ++tkD9sBfwj3Z/gEaGXNun4+N129aI8Lx3A1vQcav+BRPvRrYPtkCx49H2R359ZoI +16XOS4s6uN2CoolLSsEFutiVEJ1dhmJF/d0JmBCxDWJHndNLgZl8gJncZqnHLG9E +k+/IdzJ+7wHJVgKZ66NqZRI= +-----END PRIVATE KEY----- diff --git a/grafana-logging/dashboard.json b/grafana-logging/dashboard.json new file mode 100644 index 0000000..69dbcf0 --- /dev/null +++ b/grafana-logging/dashboard.json @@ -0,0 +1,492 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- 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, + "gnetId": null, + "graphTooltip": 0, + "id": 1, + "links": [], + "liveNow": true, + "panels": [ + { + "datasource": "NetWatch-Notifics", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "center", + "displayMode": "auto", + "filterable": true + }, + "mappings": [ + { + "options": { + "pattern": "/(.*?)<\\/b>/", + "result": { + "index": 0, + "text": "$1" + } + }, + "type": "regex" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "contact_type" + }, + "properties": [ + { + "id": "custom.width", + "value": 211 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "contact" + }, + "properties": [ + { + "id": "custom.width", + "value": 491 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "@timestamp" + }, + "properties": [ + { + "id": "custom.width", + "value": 261 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Contact Type" + }, + "properties": [ + { + "id": "custom.width", + "value": 227 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Send At" + }, + "properties": [ + { + "id": "custom.width", + "value": 278 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Contact Value" + }, + "properties": [ + { + "id": "custom.width", + "value": 498 + } + ] + } + ] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "8.2.6", + "targets": [ + { + "alias": "", + "bucketAggs": [], + "metrics": [ + { + "id": "1", + "settings": { + "size": "10" + }, + "type": "raw_data" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Last 10 Logs", + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": { + "_id": true, + "_index": true, + "_type": true, + "highlight": true, + "sort": true + }, + "indexByName": { + "@timestamp": 0, + "_id": 4, + "_index": 5, + "_type": 6, + "contact": 1, + "contact_type": 2, + "highlight": 7, + "message": 3, + "sort": 8 + }, + "renameByName": { + "@timestamp": "Logged At", + "_id": "", + "_index": "", + "contact": "Contact Value", + "contact_type": "Contact Type", + "message": "Notification Text" + } + } + } + ], + "type": "table" + }, + { + "datasource": "NetWatch-Notifics", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "#fbb13c", + "mode": "fixed" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "yellow", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 11, + "w": 5, + "x": 0, + "y": 13 + }, + "id": 5, + "options": { + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "count" + ], + "fields": "/^Count$/", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true, + "text": {} + }, + "pluginVersion": "8.2.6", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "message.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1", + "size": "10" + }, + "type": "terms" + }, + { + "field": "contact.keyword", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + } + ], + "metrics": [ + { + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Logs Counting", + "transformations": [], + "type": "gauge" + }, + { + "datasource": "NetWatch-Notifics", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "#73d2de", + "mode": "fixed" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [] + }, + "overrides": [] + }, + "gridPos": { + "h": 11, + "w": 4, + "x": 5, + "y": 13 + }, + "id": 7, + "options": { + "displayLabels": [], + "legend": { + "displayMode": "hidden", + "placement": "right" + }, + "pieType": "donut", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^Count$/", + "limit": 10, + "values": true + }, + "tooltip": { + "mode": "single" + } + }, + "pluginVersion": "8.2.6", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "contact.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + } + ], + "metrics": [ + { + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Top 10 Most Frequent Contacts", + "type": "piechart" + }, + { + "datasource": "NetWatch-Notifics", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "#ab2346", + "mode": "fixed" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "hidden", + "axisSoftMin": 0, + "fillOpacity": 75, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 0 + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 11, + "w": 15, + "x": 9, + "y": 13 + }, + "id": 4, + "options": { + "barWidth": 0.75, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "hidden", + "placement": "right" + }, + "orientation": "vertical", + "showValue": "never", + "stacking": "none", + "text": {}, + "tooltip": { + "mode": "single" + } + }, + "pluginVersion": "8.2.6", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "contact_type.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1", + "size": "10" + }, + "type": "terms" + } + ], + "metrics": [ + { + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Contact Types Counting", + "transformations": [], + "type": "barchart" + } + ], + "refresh": "5s", + "schemaVersion": 32, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-24h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "timezone": "browser", + "title": "NetWatch Logs", + "uid": "2xZ6SccSz", + "version": 2 +} \ No newline at end of file diff --git a/grafana-logging/grafana.ini b/grafana-logging/grafana.ini new file mode 100644 index 0000000..b6d9dc7 --- /dev/null +++ b/grafana-logging/grafana.ini @@ -0,0 +1,19 @@ +[security] +admin_user = ${GRAFANA_USER} +admin_password = ${GRAFANA_PASSWORD} +hide_version = true +disable_login_form = true +allow_embedding = true + +[users] +default_theme = dark + +[server] +protocol = https +cert_file = /etc/grafana/certs/cert.pem +cert_key = /etc/grafana/certs/key.pem +cookie_secure = true + +[auth.anonymous] +enabled = true +org_role = Viewer \ No newline at end of file diff --git a/grafana-logging/provisioning/dashboards/default.yml b/grafana-logging/provisioning/dashboards/default.yml new file mode 100644 index 0000000..7092730 --- /dev/null +++ b/grafana-logging/provisioning/dashboards/default.yml @@ -0,0 +1,13 @@ +apiVersion: 1 + +providers: + - name: 'NetWatch-Main' + orgId: 1 + folder: '' + folderUid: '' + type: file + disableDeletion: false + updateIntervalSeconds: 3 + allowUiUpdates: true + options: + path: /var/lib/grafana/dashboards \ No newline at end of file diff --git a/grafana-logging/provisioning/datasources/default.yml b/grafana-logging/provisioning/datasources/default.yml new file mode 100644 index 0000000..6ddfa5f --- /dev/null +++ b/grafana-logging/provisioning/datasources/default.yml @@ -0,0 +1,14 @@ +apiVersion: 1 + +datasources: + - name: NetWatch-Notifics + type: elasticsearch + url: http://elasticsearch:9200/ + access: proxy + jsonData: + indexName: 'notifics' + timeField: '@timestamp' + esVersion: '7.10.0' + maxConcurrentShardRequests: 10 + tlsSkipVerify: true + timeout: 200 \ No newline at end of file