Skip to content

Commit

Permalink
add clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
lhpqaq committed Jan 4, 2025
1 parent 2cce110 commit a44c3fd
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public GrafanaParams(CommandPayload commandPayload) {
if (prometheusServer != null) {
globalParamsMap.put(
"prometheus_url", MessageFormat.format("http://{0}:{1}", prometheusServer, prometheusPort));

setDashboards();
globalParamsMap.put("dashboards", dashboards);
}
}
Expand Down Expand Up @@ -90,11 +90,6 @@ public String dashboardConfigDir(String cluster) {
return MessageFormat.format("{0}/{1}", dashboardsDir(), cluster);
}

/// TODO
public List<String> getClusters() {
return List.of("cluster_name");
}

@GlobalParams
public Map<String, Object> configs() {
Map<String, Object> configuration = LocalSettings.configurations(getServiceName(), "grafana");
Expand Down Expand Up @@ -134,7 +129,19 @@ public Map<String, Object> dashboards() {
grafanaDashboardContent = (String) configuration.get("content");
bmAgentDashboardConfig = (String) configuration.get("bm_agent_dashboard");
prometheusDashboardPath = MessageFormat.format("{0}/prometheus", dashboardsDir());
return configuration;
}

@Override
public String getServiceName() {
return "grafana";
}

public List<String> getClusters() {
return new ArrayList<>(getClusterHosts().keySet());
}

public void setDashboards() {
dashboards = new ArrayList<>();
for (String cluster : getClusters()) {
Map<String, Object> dashboard = new HashMap<>();
Expand All @@ -143,11 +150,5 @@ public Map<String, Object> dashboards() {
dashboard.put("path", dashboardConfigDir(cluster));
dashboards.add(dashboard);
}
return configuration;
}

@Override
public String getServiceName() {
return "grafana";
}
}

0 comments on commit a44c3fd

Please sign in to comment.