1) Make Master honor the druid.monitoring.monitorSystem property to turn off Sigar

This commit is contained in:
cheddar 2013-06-06 14:55:23 -07:00
parent c2e0fb7b8e
commit b8feb98616
1 changed files with 9 additions and 5 deletions

View File

@ -22,7 +22,7 @@ package com.metamx.druid.http;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.Injector; import com.google.inject.Injector;
@ -82,6 +82,7 @@ import org.skife.config.ConfigurationObjectFactory;
import org.skife.jdbi.v2.DBI; import org.skife.jdbi.v2.DBI;
import java.net.URL; import java.net.URL;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -158,14 +159,17 @@ public class MasterMain
); );
final ScheduledExecutorService globalScheduledExec = scheduledExecutorFactory.create(1, "Global--%d"); final ScheduledExecutorService globalScheduledExec = scheduledExecutorFactory.create(1, "Global--%d");
final List<Monitor> monitors = Lists.newArrayList();
monitors.add(new JvmMonitor());
if (Boolean.parseBoolean(props.getProperty("druid.monitoring.monitorSystem", "false"))) {
monitors.add(new SysMonitor());
}
final MonitorScheduler healthMonitor = new MonitorScheduler( final MonitorScheduler healthMonitor = new MonitorScheduler(
configFactory.build(MonitorSchedulerConfig.class), configFactory.build(MonitorSchedulerConfig.class),
globalScheduledExec, globalScheduledExec,
emitter, emitter,
ImmutableList.<Monitor>of( monitors
new JvmMonitor(),
new SysMonitor()
)
); );
lifecycle.addManagedInstance(healthMonitor); lifecycle.addManagedInstance(healthMonitor);