From e5241081f6faf4bc8d49aa71beec996c299ed1b8 Mon Sep 17 00:00:00 2001 From: MathiasDPX <56231137+MathiasDPX@users.noreply.github.com> Date: Fri, 21 Feb 2025 20:48:14 +0100 Subject: [PATCH] Add grafana-export --- grafana-export.json | 677 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 677 insertions(+) create mode 100644 grafana-export.json diff --git a/grafana-export.json b/grafana-export.json new file mode 100644 index 0000000..5cbaaef --- /dev/null +++ b/grafana-export.json @@ -0,0 +1,677 @@ +{ + "_comment": "C'est un export du Grafana utilisé par le modules monitoring.py", + "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": 9, + "links": [ + { + "asDropdown": false, + "icon": "external link", + "includeVars": false, + "keepTime": false, + "tags": [], + "targetBlank": false, + "title": "New link", + "tooltip": "", + "type": "dashboards", + "url": "" + } + ], + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "aeb0euf3wei9sb" + }, + "description": "Le nombre de vue pour chaque jour", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [], + "unit": "views" + }, + "overrides": [] + }, + "gridPos": { + "h": 20, + "w": 8, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "displayLabels": [ + "name" + ], + "legend": { + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "pieType": "pie", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "de8hecv9a3chsb" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT \r\n COUNT(*) FILTER (WHERE day = 0) AS \"Δ0\",\r\n COUNT(*) FILTER (WHERE day = 1) AS \"Δ1\",\r\n COUNT(*) FILTER (WHERE day = 2) AS \"Δ2\",\r\n COUNT(*) FILTER (WHERE day = 3) AS \"Δ3\",\r\n COUNT(*) FILTER (WHERE day = 4) AS \"Δ4\",\r\n COUNT(*) FILTER (WHERE day = 5) AS \"Δ5\",\r\n COUNT(*) FILTER (WHERE day = 6) AS \"Δ6\"\r\nFROM cinema_queries\r\nWHERE time BETWEEN TO_TIMESTAMP($__from/1000) AND TO_TIMESTAMP($__to/1000);\r\n", + "refId": "A", + "sql": { + "columns": [ + { + "name": "COUNT", + "parameters": [ + { + "name": "*", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "cinema_queries" + } + ], + "title": "Jours regardés", + "type": "piechart" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "aeb0euf3wei9sb" + }, + "description": "Liste des utilisateurs actifs (représentés par leurs IP) triée par nombre de visites", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "IP" + }, + "properties": [ + { + "id": "custom.width", + "value": 280 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Visits" + }, + "properties": [ + { + "id": "custom.width", + "value": 89 + } + ] + } + ] + }, + "gridPos": { + "h": 20, + "w": 5, + "x": 8, + "y": 0 + }, + "id": 2, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "de8hecv9a3chsb" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\r\n ip as \"IP\",\r\n COUNT(*) as \"Visits\"\r\nFROM\r\n cinema_queries\r\nWHERE\r\n time BETWEEN TO_TIMESTAMP($__from/1000) AND TO_TIMESTAMP($__to/1000)\r\nGROUP BY\r\n ip\r\nORDER BY\r\n 2 DESC\r\nLIMIT 10", + "refId": "A", + "sql": { + "columns": [ + { + "name": "COUNT", + "parameters": [ + { + "name": "*", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "name": "ip", + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50, + "orderBy": { + "property": { + "name": "COUNT(*)", + "type": "string" + }, + "type": "property" + } + }, + "table": "cinema_queries" + } + ], + "title": "Utilisateurs actifs", + "type": "table" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "aeb0euf3wei9sb" + }, + "description": "Camembert des OS les plus utilisés", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [] + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Windows" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#0078d7", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "unknown" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "super-light-green", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 10, + "w": 5, + "x": 13, + "y": 0 + }, + "id": 4, + "options": { + "legend": { + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "pieType": "pie", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "de8hecv9a3chsb" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\r\n os,\r\n COUNT(*) as usage_count\r\nFROM\r\n cinema_queries \r\nWHERE\r\n time BETWEEN TO_TIMESTAMP($__from/1000) AND TO_TIMESTAMP($__to/1000)\r\nGROUP BY\r\n os\r\nORDER BY\r\n usage_count DESC", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "OS", + "type": "piechart" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "aeb0euf3wei9sb" + }, + "description": "Camembert des navigateurs les plus utilisés", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [] + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Firefox" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#ff9500", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Chrome" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#1374e9", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "unknown" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "super-light-green", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 10, + "w": 5, + "x": 18, + "y": 0 + }, + "id": 3, + "options": { + "legend": { + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "pieType": "pie", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "de8hecv9a3chsb" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\r\n browser,\r\n COUNT(*) as usage_count\r\nFROM\r\n cinema_queries \r\nWHERE\r\n time BETWEEN TO_TIMESTAMP($__from/1000) AND TO_TIMESTAMP($__to/1000)\r\nGROUP BY\r\n browser\r\nORDER BY\r\n usage_count DESC\r\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Navigateurs", + "type": "piechart" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "aeb0euf3wei9sb" + }, + "description": "Visites au fil du temps, avec les IP uniques et visites", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 3, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 10, + "x": 13, + "y": 10 + }, + "id": 5, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "timezone": [ + "utc" + ], + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "de8hecv9a3chsb" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\r\n $__timeGroupAlias(time, 1d),\r\n COUNT(DISTINCT ip) AS \"IP Uniques\"\r\nFROM\r\n cinema_queries \r\nGROUP BY\r\n 1\r\nORDER BY\r\n 1 ASC;\r\n", + "refId": "Unique Visitors", + "sql": { + "columns": [ + { + "alias": "\"visites\"", + "name": "COUNT", + "parameters": [ + { + "name": "", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "name": "\"time\"", + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "cinema_queries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "de8hecv9a3chsb" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\r\n DATE_TRUNC('day', time),\r\n COUNT(*) AS \"Visites\"\r\nFROM\r\n cinema_queries \r\nGROUP BY\r\n 1\r\nORDER BY\r\n 1 ASC;\r\n", + "refId": "Views", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Visites", + "type": "timeseries" + } + ], + "preload": false, + "schemaVersion": 40, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "2025-02-20T11:56:51.356Z", + "to": "2025-02-21T00:00:00.000Z" + }, + "timepicker": {}, + "timezone": "browser", + "title": "CinéBrest", + "uid": "fe8hgd0ydm6m8b", + "version": 10, + "weekStart": "monday" +} \ No newline at end of file