From b03b913dec57c4285ad832427998df3d1468e755 Mon Sep 17 00:00:00 2001 From: Arseniy Kuznetsov Date: Fri, 21 Oct 2022 10:02:01 +0100 Subject: [PATCH] Initial Commit --- .../mikrotik/mikrotik_loki_logs.json | 65 ++++++++------ .../mikrotik/mikrotik_mktxp_exporter.json | 85 +++++++++++-------- promtail/promtail-config.yml | 6 +- 3 files changed, 91 insertions(+), 65 deletions(-) diff --git a/grafana/dashboards/mikrotik/mikrotik_loki_logs.json b/grafana/dashboards/mikrotik/mikrotik_loki_logs.json index 89b33bb..507dd4a 100644 --- a/grafana/dashboards/mikrotik/mikrotik_loki_logs.json +++ b/grafana/dashboards/mikrotik/mikrotik_loki_logs.json @@ -26,7 +26,7 @@ "fiscalYearStartMonth": 0, "gnetId": 17139, "graphTooltip": 0, - "id": 7, + "id": 6, "links": [ { "asDropdown": true, @@ -111,7 +111,7 @@ "uid": "P8E80F9AEF21F6940" }, "editorMode": "code", - "expr": "count_over_time({job=\"syslog\"} [$__interval] |~\"(?i)$topics\" |~\"(?i)$searchable_pattern\" !~\"$exclude_pattern\")", + "expr": "count_over_time({job=\"syslog\", routerboard=\"$routerboard\"} [$__interval] |~\"(?i)$topics\" |~\"(?i)$searchable_pattern\")", "legendFormat": "{{host}}", "queryType": "range", "refId": "A" @@ -210,7 +210,7 @@ "uid": "P8E80F9AEF21F6940" }, "editorMode": "code", - "expr": "count_over_time({job=\"syslog\"} [$__interval] | pattern \":<_>\" |~\"(?i)$topics\" |~\"(?i)$searchable_pattern\" !~\"$exclude_pattern\")", + "expr": "count_over_time({job=\"syslog\", routerboard=\"$routerboard\"} [$__interval] | pattern \":<_>\" |~\"(?i)$topics\" |~\"(?i)$searchable_pattern\")", "legendFormat": "{{prefix}}", "queryType": "range", "refId": "A" @@ -251,7 +251,7 @@ "uid": "P8E80F9AEF21F6940" }, "editorMode": "code", - "expr": "{job=\"syslog\"} |~\"(?i)$topics\" |~\"(?i)$searchable_pattern\" !~\"$exclude_pattern\"", + "expr": "{job=\"syslog\", routerboard=\"$routerboard\"} |~\"(?i)$topics\" |~\"(?i)$searchable_pattern\"", "legendFormat": "", "queryType": "range", "refId": "A" @@ -272,7 +272,40 @@ "list": [ { "current": { - "selected": false, + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "loki", + "uid": "P8E80F9AEF21F6940" + }, + "definition": "", + "hide": 0, + "includeAll": true, + "label": "Routerboard", + "multi": true, + "name": "routerboard", + "options": [], + "query": { + "label": "routerboard", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "", + "type": 1 + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": true, "text": [ "All" ], @@ -419,26 +452,6 @@ "queryValue": "", "skipUrlSync": false, "type": "custom" - }, - { - "current": { - "selected": false, - "text": "@@", - "value": "@@" - }, - "hide": 0, - "label": "Exclude", - "name": "exclude_pattern", - "options": [ - { - "selected": true, - "text": "@@", - "value": "@@" - } - ], - "query": "@@", - "skipUrlSync": false, - "type": "textbox" } ] }, @@ -450,6 +463,6 @@ "timezone": "", "title": "Mikrotik Loki Logs", "uid": "awslix6doiakp-mkt-loki", - "version": 1, + "version": 6, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/mikrotik/mikrotik_mktxp_exporter.json b/grafana/dashboards/mikrotik/mikrotik_mktxp_exporter.json index 76f2d9b..e684774 100644 --- a/grafana/dashboards/mikrotik/mikrotik_mktxp_exporter.json +++ b/grafana/dashboards/mikrotik/mikrotik_mktxp_exporter.json @@ -1453,7 +1453,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "yellow", @@ -1488,7 +1489,7 @@ "showThresholdMarkers": true, "text": {} }, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "targets": [ { "datasource": { @@ -1519,7 +1520,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1553,7 +1555,7 @@ "showUnfilled": true, "text": {} }, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "targets": [ { "application": { @@ -1616,7 +1618,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "yellow", @@ -1653,7 +1656,7 @@ "showUnfilled": true, "text": {} }, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "targets": [ { "datasource": { @@ -1718,7 +1721,7 @@ }, "paceLength": 10, "percentage": false, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "pointradius": 5, "points": false, "renderer": "flot", @@ -1830,7 +1833,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "yellow", @@ -1867,7 +1871,7 @@ "showUnfilled": true, "text": {} }, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "targets": [ { "datasource": { @@ -1903,7 +1907,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1932,7 +1937,7 @@ }, "showHeader": true }, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "targets": [ { "datasource": { @@ -1995,7 +2000,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2101,7 +2107,7 @@ } ] }, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "targets": [ { "datasource": { @@ -2213,7 +2219,7 @@ }, "paceLength": 10, "percentage": false, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "pointradius": 5, "points": false, "renderer": "flot", @@ -2408,7 +2414,7 @@ }, "paceLength": 10, "percentage": false, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "pointradius": 5, "points": false, "renderer": "flot", @@ -2537,7 +2543,7 @@ }, "paceLength": 10, "percentage": false, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "pointradius": 5, "points": false, "renderer": "flot", @@ -2666,7 +2672,7 @@ }, "paceLength": 10, "percentage": false, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "pointradius": 5, "points": false, "renderer": "flot", @@ -2795,7 +2801,7 @@ }, "paceLength": 10, "percentage": false, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "pointradius": 5, "points": false, "renderer": "flot", @@ -2916,7 +2922,7 @@ "alertThreshold": false }, "percentage": false, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "pointradius": 2, "points": false, "renderer": "flot", @@ -3017,7 +3023,7 @@ "alertThreshold": false }, "percentage": false, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "pointradius": 2, "points": false, "renderer": "flot", @@ -3137,6 +3143,7 @@ "x": 0, "y": 79 }, + "hideBranding": false, "highlightCards": true, "id": 87, "legend": { @@ -3233,7 +3240,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -3300,7 +3308,7 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "targets": [ { "datasource": { @@ -4436,7 +4444,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -4503,7 +4512,7 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "targets": [ { "datasource": { @@ -4572,7 +4581,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -4666,7 +4676,7 @@ } ] }, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "targets": [ { "datasource": { @@ -4735,7 +4745,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "#EAB839", @@ -4773,7 +4784,7 @@ "showUnfilled": true, "text": {} }, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "targets": [ { "application": { @@ -4837,7 +4848,8 @@ "mode": "absolute", "steps": [ { - "color": "red" + "color": "red", + "value": null }, { "color": "orange", @@ -4884,7 +4896,7 @@ "showUnfilled": true, "text": {} }, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "targets": [ { "application": { @@ -4968,7 +4980,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "pointradius": 2, "points": false, "renderer": "flot", @@ -5095,7 +5107,7 @@ }, "paceLength": 10, "percentage": false, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "pointradius": 5, "points": false, "renderer": "flot", @@ -5252,7 +5264,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "yellow", @@ -5295,7 +5308,7 @@ "showUnfilled": true, "text": {} }, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "targets": [ { "application": { @@ -5384,7 +5397,7 @@ }, "paceLength": 10, "percentage": false, - "pluginVersion": "9.1.4", + "pluginVersion": "9.2.0", "pointradius": 5, "points": false, "renderer": "flot", @@ -5503,7 +5516,7 @@ "definition": "label_values(mktxp_system_identity_info, routerboard_address)", "hide": 0, "includeAll": false, - "label": "node", + "label": "Routerboard", "multi": false, "name": "node", "options": [], diff --git a/promtail/promtail-config.yml b/promtail/promtail-config.yml index d22e396..f6ad5d2 100755 --- a/promtail/promtail-config.yml +++ b/promtail/promtail-config.yml @@ -19,12 +19,12 @@ scrape_configs: job: "syslog" relabel_configs: - source_labels: ['__syslog_message_hostname'] - target_label: 'host' + target_label: 'routerboard' - source_labels: ['__syslog_message_severity'] target_label: 'severity' - source_labels: ['__syslog_message_facility'] target_label: 'facility' - source_labels: ['__syslog_connection_hostname'] - target_label: 'syslog_srv' + target_label: 'syslog_host' - source_labels: ['__syslog_connection_ip_address'] - target_label: 'syslog_srv_ip' + target_label: 'syslog_host_ip'