mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
Merge pull request #143 from weideng1/master
fixed a docker-metrics bug so grafana can see prom container by default
This commit is contained in:
commit
6022a1862f
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name":"prometheus",
|
"name":"prometheus",
|
||||||
"type":"prometheus",
|
"type":"prometheus",
|
||||||
"url":"http://localhost:9090",
|
"url":"http://prom:9090",
|
||||||
"access":"direct",
|
"access":"proxy",
|
||||||
"editable":true,
|
"editable":true,
|
||||||
"basicAuth":false
|
"basicAuth":false
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static io.nosqlbench.engine.docker.RestHelper.post;
|
import static io.nosqlbench.engine.docker.RestHelper.post;
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ public class DockerHelper {
|
|||||||
.withDockerCmdExecFactory(dockerCmdExecFactory)
|
.withDockerCmdExecFactory(dockerCmdExecFactory)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
public String startDocker(String IMG, String tag, String name, List<Integer> ports, List<String> volumeDescList, List<String> envList, List<String> cmdList, String reload) {
|
public String startDocker(String IMG, String tag, String name, List<Integer> ports, List<String> volumeDescList, List<String> envList, List<String> cmdList, String reload, List<String> linkNames) {
|
||||||
logger.debug("Starting docker with img=" + IMG + ", tag=" + tag + ", name=" + name + ", " +
|
logger.debug("Starting docker with img=" + IMG + ", tag=" + tag + ", name=" + name + ", " +
|
||||||
"ports=" + ports + ", volumes=" + volumeDescList + ", env=" + envList + ", cmds=" + cmdList + ", reload=" + reload);
|
"ports=" + ports + ", volumes=" + volumeDescList + ", env=" + envList + ", cmds=" + cmdList + ", reload=" + reload);
|
||||||
|
|
||||||
@ -108,6 +109,7 @@ public class DockerHelper {
|
|||||||
|
|
||||||
|
|
||||||
CreateContainerResponse containerResponse;
|
CreateContainerResponse containerResponse;
|
||||||
|
List<Link> links = linkNames.stream().map(x->new Link(x,x)).collect(Collectors.toList());
|
||||||
if (envList == null) {
|
if (envList == null) {
|
||||||
containerResponse = dockerClient.createContainerCmd(IMG + ":" + tag)
|
containerResponse = dockerClient.createContainerCmd(IMG + ":" + tag)
|
||||||
.withCmd(cmdList)
|
.withCmd(cmdList)
|
||||||
@ -120,6 +122,7 @@ public class DockerHelper {
|
|||||||
)
|
)
|
||||||
.withName(name)
|
.withName(name)
|
||||||
//.withVolumes(volumeList)
|
//.withVolumes(volumeList)
|
||||||
|
.withLinks(links)
|
||||||
.exec();
|
.exec();
|
||||||
} else {
|
} else {
|
||||||
long user = new UnixSystem().getUid();
|
long user = new UnixSystem().getUid();
|
||||||
@ -133,6 +136,7 @@ public class DockerHelper {
|
|||||||
.withBinds(volumeBindList)
|
.withBinds(volumeBindList)
|
||||||
)
|
)
|
||||||
.withName(name)
|
.withName(name)
|
||||||
|
.withLinks(links)
|
||||||
.withUser(""+user)
|
.withUser(""+user)
|
||||||
//.withVolumes(volumeList)
|
//.withVolumes(volumeList)
|
||||||
.exec();
|
.exec();
|
||||||
|
@ -74,7 +74,9 @@ public class DockerMetricsManager {
|
|||||||
);
|
);
|
||||||
|
|
||||||
String reload = null;
|
String reload = null;
|
||||||
String containerId = dh.startDocker(GRAFANA_IMG, tag, name, port, volumeDescList, envList, null, reload);
|
List<String> linkNames = new ArrayList();
|
||||||
|
linkNames.add("prom");
|
||||||
|
String containerId = dh.startDocker(GRAFANA_IMG, tag, name, port, volumeDescList, envList, null, reload, linkNames);
|
||||||
if (containerId == null){
|
if (containerId == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -118,7 +120,8 @@ public class DockerMetricsManager {
|
|||||||
);
|
);
|
||||||
|
|
||||||
String reload = "http://localhost:9090/-/reload";
|
String reload = "http://localhost:9090/-/reload";
|
||||||
dh.startDocker(PROMETHEUS_IMG, tag, name, port, volumeDescList, envList, cmdList, reload);
|
List<String> linkNames = new ArrayList();
|
||||||
|
dh.startDocker(PROMETHEUS_IMG, tag, name, port, volumeDescList, envList, cmdList, reload, linkNames);
|
||||||
|
|
||||||
logger.info("prometheus started and listenning");
|
logger.info("prometheus started and listenning");
|
||||||
}
|
}
|
||||||
@ -137,7 +140,8 @@ public class DockerMetricsManager {
|
|||||||
List<String> envList = Arrays.asList();
|
List<String> envList = Arrays.asList();
|
||||||
|
|
||||||
String reload = null;
|
String reload = null;
|
||||||
dh.startDocker(GRAPHITE_EXPORTER_IMG, tag, name, port, volumeDescList, envList, null, reload);
|
List<String> linkNames = new ArrayList();
|
||||||
|
dh.startDocker(GRAPHITE_EXPORTER_IMG, tag, name, port, volumeDescList, envList, null, reload, linkNames);
|
||||||
|
|
||||||
logger.info("graphite exporter container started");
|
logger.info("graphite exporter container started");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user