Skip to content

Commit

Permalink
fix(grafana-dashboard): use ${datasource} variable
Browse files Browse the repository at this point in the history
Fixes: #84
  • Loading branch information
uhthomas authored and Rory-Z committed Apr 12, 2024
1 parent 6343da4 commit 4810f2b
Show file tree
Hide file tree
Showing 26 changed files with 294 additions and 294 deletions.
6 changes: 3 additions & 3 deletions grafana-dashboard/grafanalib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ make
- Generate EMQX 5.x Community Edition Dashboard

```shell
make E_ARG=ce V_ARG=5
make EDITION_ARG=ce VERSION_ARG=5
```

- Generate EMQX 4.x Enterprise Dashboard

```shell
make E_ARG=ee V_ARG=4
make EDITION_ARG=ee VERSION_ARG=4
```

- Generate EMQX 4.x Community Edition Dashboard

```shell
make E_ARG=ce V_ARG=4
make EDITION_ARG=ce VERSION_ARG=4
```

## Remove Dashboard JSON
Expand Down
26 changes: 13 additions & 13 deletions grafana-dashboard/grafanalib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def create_template_list():
G.Template(
name="cluster",
type="query",
dataSource="$datasource",
dataSource="${datasource}",
query="label_values(up, cluster)",
includeAll=False,
multi=False,
Expand Down Expand Up @@ -192,7 +192,7 @@ def create_nodes_template_list():
G.Template(
dataSource={
"type": "prometheus",
"uid": "$datasource"
"uid": "${datasource}"
},
hide=0,
includeAll=False,
Expand All @@ -211,7 +211,7 @@ def create_nodes_template_list():
G.Template(
dataSource={
"type": "prometheus",
"uid": "$datasource"
"uid": "${datasource}"
},
hide=0,
includeAll=True,
Expand Down Expand Up @@ -247,7 +247,7 @@ def create_auth_template_list():
G.Template(
dataSource={
"type": "prometheus",
"uid": "$datasource"
"uid": "${datasource}"
},
hide=0,
includeAll=False,
Expand All @@ -266,7 +266,7 @@ def create_auth_template_list():
G.Template(
dataSource={
"type": "prometheus",
"uid": "$datasource"
"uid": "${datasource}"
},
hide=0,
includeAll=True,
Expand All @@ -285,7 +285,7 @@ def create_auth_template_list():
G.Template(
dataSource={
"type": "prometheus",
"uid": "$datasource"
"uid": "${datasource}"
},
hide=0,
includeAll=True,
Expand Down Expand Up @@ -321,7 +321,7 @@ def create_rule_engine_template_list():
G.Template(
dataSource={
"type": "prometheus",
"uid": "$datasource"
"uid": "${datasource}"
},
hide=0,
includeAll=False,
Expand All @@ -340,7 +340,7 @@ def create_rule_engine_template_list():
G.Template(
dataSource={
"type": "prometheus",
"uid": "$datasource"
"uid": "${datasource}"
},
hide=0,
includeAll=True,
Expand All @@ -359,7 +359,7 @@ def create_rule_engine_template_list():
G.Template(
dataSource={
"type": "prometheus",
"uid": "$datasource"
"uid": "${datasource}"
},
hide=0,
includeAll=True,
Expand Down Expand Up @@ -417,7 +417,7 @@ def create_gridpos(pos):

def create_timeseries(**kwargs):
default_kwargs = {
"dataSource": "prometheus",
"dataSource": "${datasource}",
"gridPos": create_gridpos({"h": 8, "w": 6, "x": 0, "y": 14}),
"span": 2,
"scaleDistributionType": "linear",
Expand All @@ -436,7 +436,7 @@ def create_timeseries(**kwargs):

def create_stat(**kwargs):
default_kwargs = {
"dataSource": "prometheus",
"dataSource": "${datasource}",
"gridPos": create_gridpos({"h": 3, "w": 6, "x": 0, "y": 1}),
"span": "2",
"mappings": [
Expand Down Expand Up @@ -477,7 +477,7 @@ def create_stat(**kwargs):

def create_gauge(**kwargs):
default_kwargs = {
"dataSource": "prometheus",
"dataSource": "${datasource}",
"gridPos": create_gridpos({"h": 6, "w": 4, "x": 6, "y": 1}),
"span": 2,
"max": None,
Expand All @@ -491,7 +491,7 @@ def create_gauge(**kwargs):

def create_table(**kwargs):
default_kwargs = {
"dataSource": "prometheus",
"dataSource": "${datasource}",
"gridPos": create_gridpos({"h": 6, "w": 10, "x": 0, "y": 42}),
"span": 2,
"thresholds": thresholds_2_steps,
Expand Down
18 changes: 9 additions & 9 deletions grafana-dashboard/template/emqx-4/client-events.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"panels": [
{
"cacheTimeout": null,
"datasource": "prometheus",
"datasource": "${datasource}",
"description": null,
"editable": true,
"error": false,
Expand Down Expand Up @@ -132,7 +132,7 @@
},
{
"cacheTimeout": null,
"datasource": "prometheus",
"datasource": "${datasource}",
"description": null,
"editable": true,
"error": false,
Expand Down Expand Up @@ -244,7 +244,7 @@
},
{
"cacheTimeout": null,
"datasource": "prometheus",
"datasource": "${datasource}",
"description": null,
"editable": true,
"error": false,
Expand Down Expand Up @@ -356,7 +356,7 @@
},
{
"cacheTimeout": null,
"datasource": "prometheus",
"datasource": "${datasource}",
"description": null,
"editable": true,
"error": false,
Expand Down Expand Up @@ -468,7 +468,7 @@
},
{
"cacheTimeout": null,
"datasource": "prometheus",
"datasource": "${datasource}",
"description": null,
"editable": true,
"error": false,
Expand Down Expand Up @@ -580,7 +580,7 @@
},
{
"cacheTimeout": null,
"datasource": "prometheus",
"datasource": "${datasource}",
"description": null,
"editable": true,
"error": false,
Expand Down Expand Up @@ -692,7 +692,7 @@
},
{
"cacheTimeout": null,
"datasource": "prometheus",
"datasource": "${datasource}",
"description": null,
"editable": true,
"error": false,
Expand Down Expand Up @@ -857,7 +857,7 @@
},
"datasource": {
"type": "prometheus",
"uid": "$datasource"
"uid": "${datasource}"
},
"hide": 0,
"includeAll": false,
Expand Down Expand Up @@ -890,7 +890,7 @@
},
"datasource": {
"type": "prometheus",
"uid": "$datasource"
"uid": "${datasource}"
},
"hide": 0,
"includeAll": true,
Expand Down
10 changes: 5 additions & 5 deletions grafana-dashboard/template/emqx-4/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"panels": [
{
"cacheTimeout": null,
"datasource": "prometheus",
"datasource": "${datasource}",
"description": null,
"editable": true,
"error": false,
Expand Down Expand Up @@ -123,7 +123,7 @@
},
{
"cacheTimeout": null,
"datasource": "prometheus",
"datasource": "${datasource}",
"description": null,
"editable": true,
"error": false,
Expand Down Expand Up @@ -226,7 +226,7 @@
},
{
"cacheTimeout": null,
"datasource": "prometheus",
"datasource": "${datasource}",
"description": null,
"editable": true,
"error": false,
Expand Down Expand Up @@ -382,7 +382,7 @@
},
"datasource": {
"type": "prometheus",
"uid": "$datasource"
"uid": "${datasource}"
},
"hide": 0,
"includeAll": false,
Expand Down Expand Up @@ -415,7 +415,7 @@
},
"datasource": {
"type": "prometheus",
"uid": "$datasource"
"uid": "${datasource}"
},
"hide": 0,
"includeAll": true,
Expand Down
Loading

0 comments on commit 4810f2b

Please sign in to comment.