logger.info("Exchange Metric Collector started");
while(true) {
JmxProcess jmxProcess = new JmxProcess();
for(Broker broker : brokerFarm.getAllBrokers().values()) {
if(broker.getStatus() == Broker.Status.ONLINE) {
Server server = new Server();
server.setHost(broker.getHost());
server.setUsername("admin");
server.setPassword("admin");
String jmxurl = getJMXUrl(broker.getHost());
if(jmxurl == null) {
logger.error("cannot obtain JMX URL from broker {}", broker.getHost());
continue;
}
server.setUrl(jmxurl);
try {
server.addQuery(createMonitorQuery());
server.addQuery(createConfigQuery());
}
catch(ValidationException e) {
e.printStackTrace();
}
jmxProcess.addServer(server);