diff --git a/dashboards/loki-quick-search.json b/dashboards/loki-quick-search.json new file mode 100644 index 0000000..c678879 --- /dev/null +++ b/dashboards/loki-quick-search.json @@ -0,0 +1,288 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Loki logs panel with prometheus variables (testing)", + "editable": true, + "gnetId": 12019, + "graphTooltip": 0, + "id": 30, + "iteration": 1607456888970, + "links": [], + "panels": [ + { + "aliasColors": {}, + "bars": true, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "loki" + }, + "fieldConfig": { + "defaults": { + "custom": {}, + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 3, + "w": 24, + "x": 0, + "y": 0 + }, + "hiddenSeries": false, + "id": 6, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": false, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.2.0", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(count_over_time({namespace=\"$namespace\", instance=~\"$pod\"} |~ \"$search\"[$__interval]))", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "datasource": { + "type": "loki" + }, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "gridPos": { + "h": 25, + "w": 24, + "x": 0, + "y": 3 + }, + "id": 2, + "maxDataPoints": "", + "options": { + "showLabels": false, + "showTime": true, + "sortOrder": "Descending", + "wrapLogMessage": true + }, + "targets": [ + { + "expr": "{namespace=\"$namespace\", instance=~\"$pod\"} |~ \"$search\"", + "refId": "A" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Logs Panel", + "type": "logs" + }, + { + "content": "
For Grafana Loki blog example
\n\n\n", + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 24, + "x": 0, + "y": 28 + }, + "id": 4, + "mode": "html", + "options": { + "content": "
For Grafana Loki blog example
\n\n\n", + "mode": "html" + }, + "pluginVersion": "7.1.0", + "timeFrom": null, + "timeShift": null, + "title": "", + "transparent": true, + "type": "text" + } + ], + "schemaVersion": 26, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "allValue": null, + "current": { + "selected": false, + "text": "monitoring", + "value": "monitoring" + }, + "datasource": { + "type": "prometheus" + }, + "definition": "label_values(kube_pod_info, namespace)", + "hide": 0, + "includeAll": false, + "label": null, + "multi": false, + "name": "namespace", + "options": [], + "query": "label_values(kube_pod_info, namespace)", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "allValue": ".*", + "current": { + "selected": false, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "prometheus" + }, + "definition": "label_values(container_network_receive_bytes_total{namespace=~\"$namespace\"},pod)", + "hide": 0, + "includeAll": true, + "label": null, + "multi": true, + "name": "pod", + "options": [], + "query": "label_values(container_network_receive_bytes_total{namespace=~\"$namespace\"},pod)", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "current": { + "selected": false, + "text": "level=warn", + "value": "level=warn" + }, + "hide": 0, + "label": null, + "name": "search", + "options": [ + { + "selected": true, + "text": "level=warn", + "value": "level=warn" + } + ], + "query": "level=warn", + "skipUrlSync": false, + "type": "textbox" + } + ] + }, + "time": { + "from": "now-30m", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "timezone": "", + "title": "Loki Dashboard (testing)", + "uid": "liz0yRCZg", + "version": 2 + } \ No newline at end of file diff --git a/deploy-cm.sh b/deploy-cm.sh new file mode 100755 index 0000000..eda8aae --- /dev/null +++ b/deploy-cm.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +dashboardproviders="dbconn garpa test" + +dbconn="dbconn-default loki-quick-search" +garpa="loki-quick-search" +test="dbconn-default loki-quick-search" + +for dashboardprovider in $dashboardproviders +do + echo "Creating ConfigMap ${dashboardprovider}-dashboards" + dashboards="" + for dashboard in ${!dashboardprovider} + do + echo " ... with dashboard ${dashboard}" + dashboards="$dashboards --from-file=dashboards/${dashboard}.json" + done + kubectl delete configmap ${dashboardprovider}-dashboards -n mla + kubectl create configmap ${dashboardprovider}-dashboards -n mla $dashboards +done \ No newline at end of file