use of com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfigView in project cloudbreak by hortonworks.
the class TelemetryDecoratorTest method testDecorateWithMonitoring.
@Test
public void testDecorateWithMonitoring() {
// GIVEN
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
TelemetryClusterDetails clusterDetails = TelemetryClusterDetails.Builder.builder().withCrn("myClusterCrn").withType("datahub").withVersion("1.0.0").build();
MonitoringConfigView monitoringConfigView = new MonitoringConfigView.Builder().withEnabled(true).withClusterDetails(clusterDetails).build();
NodeStatusConfigView nodeStatusConfigView = new NodeStatusConfigView.Builder().withServerUsername("admin").withServerPassword("admin".toCharArray()).build();
DatabusConfigView dataConfigView = new DatabusConfigView.Builder().build();
TelemetryCommonConfigView telemetryCommonConfigView = new TelemetryCommonConfigView.Builder().withClusterDetails(clusterDetails).build();
MeteringConfigView meteringConfigView = new MeteringConfigView.Builder().build();
mockConfigServiceResults(dataConfigView, new FluentConfigView.Builder().build(), meteringConfigView, monitoringConfigView, nodeStatusConfigView, telemetryCommonConfigView);
// WHEN
Map<String, SaltPillarProperties> result = underTest.decoratePillar(servicePillar, createStack(), new Telemetry());
// THEN
Map<String, Object> results = createMapFromFluentPillars(result, "monitoring");
assertEquals(results.get("clusterType"), "datahub");
assertEquals(results.get("clusterVersion"), "1.0.0");
assertEquals(results.get("clusterCrn"), "myClusterCrn");
assertEquals(results.get("enabled"), true);
}
use of com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfigView in project cloudbreak by hortonworks.
the class TelemetryDecorator method setupMonitoring.
private void setupMonitoring(Map<String, SaltPillarProperties> servicePillar, boolean cdpSaasEnabled, Stack stack, Telemetry telemetry, char[] passwordInput) {
if (telemetry.isMonitoringFeatureEnabled()) {
LOGGER.debug("Filling monitoring configs.");
MonitoringAuthConfig cmAuthConfig = null;
if (stack.getCluster() != null && stack.getCluster().getCloudbreakClusterManagerMonitoringUser() != null && stack.getCluster().getCloudbreakClusterManagerMonitoringPassword() != null) {
String cmMonitoringUser = stack.getCluster().getCloudbreakClusterManagerMonitoringUser();
char[] cmMonitoringPassword = stack.getCluster().getCloudbreakClusterManagerMonitoringPassword().toCharArray();
cmAuthConfig = new MonitoringAuthConfig(cmMonitoringUser, cmMonitoringPassword);
}
MonitoringConfigView monitoringConfigView = monitoringConfigService.createMonitoringConfig(telemetry.getMonitoring(), MonitoringClusterType.CLOUDERA_MANAGER, cmAuthConfig, passwordInput, cdpSaasEnabled);
if (monitoringConfigView.isEnabled()) {
Map<String, Object> monitoringConfig = monitoringConfigView.toMap();
servicePillar.put("monitoring", new SaltPillarProperties("/monitoring/init.sls", singletonMap("monitoring", monitoringConfig)));
}
} else {
LOGGER.debug("CDP Saas is not enabled, do not use monitoring features");
}
}
use of com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfigView in project cloudbreak by hortonworks.
the class TelemetryDecoratorTest method testDecorateWithSaasMonitoring.
@Test
public void testDecorateWithSaasMonitoring() {
// GIVEN
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
TelemetryClusterDetails clusterDetails = TelemetryClusterDetails.Builder.builder().withCrn("myClusterCrn").withType("datahub").withVersion("1.0.0").build();
MonitoringConfigView monitoringConfigView = new MonitoringConfigView.Builder().withEnabled(true).withClusterDetails(clusterDetails).build();
NodeStatusConfigView nodeStatusConfigView = new NodeStatusConfigView.Builder().withServerUsername("admin").withServerPassword("admin".toCharArray()).build();
DatabusConfigView dataConfigView = new DatabusConfigView.Builder().build();
TelemetryCommonConfigView telemetryCommonConfigView = new TelemetryCommonConfigView.Builder().withClusterDetails(clusterDetails).build();
MeteringConfigView meteringConfigView = new MeteringConfigView.Builder().build();
mockConfigServiceResults(dataConfigView, new FluentConfigView.Builder().build(), meteringConfigView, monitoringConfigView, nodeStatusConfigView, telemetryCommonConfigView);
given(entitlementService.isCdpSaasEnabled(anyString())).willReturn(true);
// WHEN
Map<String, SaltPillarProperties> result = underTest.decoratePillar(servicePillar, createStack(), new Telemetry());
// THEN
Map<String, Object> results = createMapFromFluentPillars(result, "monitoring");
assertEquals(results.get("clusterType"), "datahub");
assertEquals(results.get("clusterVersion"), "1.0.0");
assertEquals(results.get("clusterCrn"), "myClusterCrn");
assertEquals(results.get("enabled"), true);
}
use of com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfigView in project cloudbreak by hortonworks.
the class TelemetryConfigService method getMonitoringPillarConfig.
private Map<String, SaltPillarProperties> getMonitoringPillarConfig(Stack stack, Telemetry telemetry, char[] passwordInput, boolean cdpSaasEnabled) {
Map<String, Object> config = new HashMap<>();
if (telemetry.isMonitoringFeatureEnabled()) {
Monitoring monitoring = telemetry.getMonitoring();
LOGGER.debug("Monitoring is enabled, filling configs ...");
MonitoringConfigView configView = monitoringConfigService.createMonitoringConfig(monitoring, MonitoringClusterType.FREEIPA, null, passwordInput, cdpSaasEnabled);
config = configView.toMap();
}
return Map.of("monitoring", new SaltPillarProperties("/monitoring/init.sls", Collections.singletonMap("monitoring", config)));
}
use of com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfigView in project cloudbreak by hortonworks.
the class TelemetryDecorator method setupMonitoring.
private void setupMonitoring(Map<String, SaltPillarProperties> servicePillar, Stack stack, TelemetryClusterDetails clusterDetails) {
if (stack.getCluster() != null && stack.getCluster().getCloudbreakClusterManagerMonitoringUser() != null && stack.getCluster().getCloudbreakClusterManagerMonitoringPassword() != null) {
String monitoringUser = stack.getCluster().getCloudbreakClusterManagerMonitoringUser();
char[] monitoringPassword = stack.getCluster().getCloudbreakClusterManagerMonitoringPassword().toCharArray();
MonitoringAuthConfig authConfig = new MonitoringAuthConfig(monitoringUser, monitoringPassword);
MonitoringConfigView monitoringConfigView = monitoringConfigService.createMonitoringConfig(MonitoringClusterType.CLOUDERA_MANAGER, authConfig);
if (monitoringConfigView.isEnabled()) {
Map<String, Object> monitoringConfig = monitoringConfigView.toMap();
servicePillar.put("monitoring", new SaltPillarProperties("/monitoring/init.sls", singletonMap("monitoring", monitoringConfig)));
}
}
}
Aggregations