diff --git a/cmd/tools/grafana/dashboard_test.go b/cmd/tools/grafana/dashboard_test.go index 31427079c..a0d56ecf8 100644 --- a/cmd/tools/grafana/dashboard_test.go +++ b/cmd/tools/grafana/dashboard_test.go @@ -28,6 +28,26 @@ func checkDashboardForDatasource(t *testing.T, path string, data []byte) { } return true }) + + // Check that the variable DS_PROMETHEUS exist + doesDsPromExist := false + gjson.GetBytes(data, "templating.list").ForEach(func(key, value gjson.Result) bool { + if value.Get("name").String() == "DS_PROMETHEUS" { + doesDsPromExist = true + query := value.Get("query").String() + if query != "prometheus" { + t.Errorf("dashboard=%s var=DS_PROMETHEUS query want=prometheus got=%s", path, query) + } + theType := value.Get("type").String() + if theType != "datasource" { + t.Errorf("dashboard=%s var=DS_PROMETHEUS type want=datasource got=%s", path, theType) + } + } + return true + }) + if !doesDsPromExist { + t.Errorf("dashboard=%s should define variable has DS_PROMETHEUS", path) + } } func TestUnitsAndExprMatch(t *testing.T) { diff --git a/grafana/dashboards/storagegrid/overview.json b/grafana/dashboards/storagegrid/overview.json index 4268f7e02..cc0bdb0ea 100644 --- a/grafana/dashboards/storagegrid/overview.json +++ b/grafana/dashboards/storagegrid/overview.json @@ -1600,6 +1600,26 @@ ], "templating": { "list": [ + { + "current": { + "selected": false, + "text": "Prometheus", + "value": "Prometheus" + }, + "description": null, + "error": null, + "hide": 2, + "includeAll": false, + "label": "Data Source", + "multi": false, + "name": "DS_PROMETHEUS", + "options": [], + "query": "prometheus", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, { "allValue": null, "current": {}, diff --git a/grafana/dashboards/storagegrid/tenant.json b/grafana/dashboards/storagegrid/tenant.json index 5b2ee2613..f48b48cc1 100644 --- a/grafana/dashboards/storagegrid/tenant.json +++ b/grafana/dashboards/storagegrid/tenant.json @@ -454,6 +454,26 @@ ], "templating": { "list": [ + { + "current": { + "selected": false, + "text": "Prometheus", + "value": "Prometheus" + }, + "description": null, + "error": null, + "hide": 2, + "includeAll": false, + "label": "Data Source", + "multi": false, + "name": "DS_PROMETHEUS", + "options": [], + "query": "prometheus", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, { "allValue": null, "current": {}, diff --git a/harvest.yml b/harvest.yml index 0c451bc17..fe069ea02 100644 --- a/harvest.yml +++ b/harvest.yml @@ -70,4 +70,13 @@ Pollers: # ssl_key: /path/to/key.key # ca_cert: /path/to/server.crt # exporters: - # - prometheus1 \ No newline at end of file + # - prometheus1 + + # StorageGRID example + # grid-01: + # datacenter: DC-01 + # addr: 10.0.0.3 + # username: myuser + # password: mypass + # collectors: + # - StorageGrid