Disable monitoring transport and rest actions on tribe node

Original commit: elastic/x-pack-elasticsearch@a9d97b4f64
This commit is contained in:
Areek Zillur 2016-05-02 17:45:16 -04:00
parent d9e9f7dfd0
commit f808b251b5
1 changed files with 7 additions and 5 deletions

View File

@ -42,11 +42,13 @@ public class Monitoring {
private final Settings settings;
private final boolean enabled;
private final boolean transportClientMode;
private final boolean tribeNode;
public Monitoring(Settings settings) {
this.settings = settings;
this.enabled = MonitoringSettings.ENABLED.get(settings);
this.transportClientMode = XPackPlugin.transportClientMode(settings);
this.tribeNode = XPackPlugin.isTribeNode(settings);
}
boolean isEnabled() {
@ -60,7 +62,7 @@ public class Monitoring {
public Collection<Module> nodeModules() {
List<Module> modules = new ArrayList<>();
modules.add(new MonitoringModule(enabled, transportClientMode));
if (enabled && transportClientMode == false) {
if (enabled && transportClientMode == false && tribeNode == false) {
modules.add(new CollectorModule());
modules.add(new ExporterModule(settings));
modules.add(new MonitoringClientModule());
@ -69,7 +71,7 @@ public class Monitoring {
}
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
if (enabled == false || transportClientMode) {
if (enabled == false || transportClientMode || tribeNode) {
return Collections.emptyList();
}
return Arrays.<Class<? extends LifecycleComponent>>asList(MonitoringLicensee.class,
@ -82,19 +84,19 @@ public class Monitoring {
}
public void onModule(ActionModule module) {
if (enabled) {
if (enabled && tribeNode == false) {
module.registerAction(MonitoringBulkAction.INSTANCE, TransportMonitoringBulkAction.class);
}
}
public void onModule(NetworkModule module) {
if (enabled && transportClientMode == false) {
if (enabled && transportClientMode == false && tribeNode == false) {
module.registerRestHandler(RestMonitoringBulkAction.class);
}
}
public void onModule(LazyInitializationModule module) {
if (enabled) {
if (enabled && tribeNode == false) {
module.registerLazyInitializable(MonitoringClientProxy.class);
}
}