String clusters = getSetString(clusterSet, -1);
String hosts = getSetString(hostSet, -1);
String metrics = getSetString(metricSet, -1);
URIBuilder uriBuilder = new URIBuilder();
if (configuration.isGangliaSSL()) {
uriBuilder.setScheme("https");
} else {
uriBuilder.setScheme("http");
}
uriBuilder.setHost(hostProvider.getGangliaCollectorHostName(clusterName));
uriBuilder.setPath("/cgi-bin/rrd.py");
uriBuilder.setParameter("c", clusters);
if (hosts.length() > 0) {
uriBuilder.setParameter("h", hosts);
}
if (metrics.length() > 0) {
uriBuilder.setParameter("m", metrics);
} else {
// get all metrics
uriBuilder.setParameter("m", ".*");
}
if (temporalInfo != null) {
long startTime = temporalInfo.getStartTime();
if (startTime != -1) {
uriBuilder.setParameter("s", String.valueOf(startTime));
}
long endTime = temporalInfo.getEndTime();
if (endTime != -1) {
uriBuilder.setParameter("e", String.valueOf(endTime));
}
long step = temporalInfo.getStep();
if (step != -1) {
uriBuilder.setParameter("r", String.valueOf(step));
}
} else {
uriBuilder.setParameter("e", "now");
uriBuilder.setParameter("pt", "true");
}
return uriBuilder.toString();
}