diff --git a/src/main/java/org/datadog/jmxfetch/App.java b/src/main/java/org/datadog/jmxfetch/App.java index 8c78e8ac..dfa03652 100644 --- a/src/main/java/org/datadog/jmxfetch/App.java +++ b/src/main/java/org/datadog/jmxfetch/App.java @@ -133,7 +133,10 @@ public App(final AppConfig appConfig) { } this.configs = getConfigs(this.appConfig); - this.initTelemetryBean(); + if (this.appConfig.getJmxfetchTelemetry()) { + log.info("Enabling JMX Fetch Telemetry"); + this.initTelemetryBean(); + } } private ObjectName getAppTelemetryBeanName() { @@ -176,6 +179,9 @@ private void initTelemetryBean() { } private void teardownTelemetry() { + if (!this.appConfig.getJmxfetchTelemetry()){ + return; + } MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName appTelemetryBeanName = getAppTelemetryBeanName(); if (appTelemetryBeanName == null) {