Search in sources :

Example 1 with NodeStatusConfigView

use of com.sequenceiq.cloudbreak.telemetry.nodestatus.NodeStatusConfigView 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);
}
Also used : TelemetryCommonConfigView(com.sequenceiq.cloudbreak.telemetry.common.TelemetryCommonConfigView) NodeStatusConfigView(com.sequenceiq.cloudbreak.telemetry.nodestatus.NodeStatusConfigView) HashMap(java.util.HashMap) TelemetryClusterDetails(com.sequenceiq.cloudbreak.telemetry.TelemetryClusterDetails) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) DatabusConfigView(com.sequenceiq.cloudbreak.telemetry.databus.DatabusConfigView) MeteringConfigView(com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfigView) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) MonitoringConfigView(com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfigView) Test(org.junit.Test)

Example 2 with NodeStatusConfigView

use of com.sequenceiq.cloudbreak.telemetry.nodestatus.NodeStatusConfigView in project cloudbreak by hortonworks.

the class TelemetryConfigService method getCdpNodeStatusPillarConfig.

private Map<String, ? extends SaltPillarProperties> getCdpNodeStatusPillarConfig(Stack stack) {
    char[] passwordInput = null;
    if (StringUtils.isNotBlank(stack.getCdpNodeStatusMonitorPassword())) {
        passwordInput = stack.getCdpNodeStatusMonitorPassword().toCharArray();
    }
    boolean saltPingEnabled = entitlementService.nodestatusSaltPingEnabled(stack.getAccountId());
    NodeStatusConfigView nodeStatusConfigs = nodeStatusConfigService.createNodeStatusConfig(stack.getCdpNodeStatusMonitorUser(), passwordInput, saltPingEnabled);
    return Map.of("nodestatus", new SaltPillarProperties("/nodestatus/init.sls", Collections.singletonMap("nodestatus", nodeStatusConfigs.toMap())));
}
Also used : NodeStatusConfigView(com.sequenceiq.cloudbreak.telemetry.nodestatus.NodeStatusConfigView) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)

Example 3 with NodeStatusConfigView

use of com.sequenceiq.cloudbreak.telemetry.nodestatus.NodeStatusConfigView in project cloudbreak by hortonworks.

the class TelemetryDecorator method setupNodeStatusMonitor.

private void setupNodeStatusMonitor(Map<String, SaltPillarProperties> servicePillar, Stack stack, char[] passwordInput) {
    String accountId = Crn.safeFromString(stack.getResourceCrn()).getAccountId();
    boolean saltPingEnabled = entitlementService.nodestatusSaltPingEnabled(accountId);
    NodeStatusConfigView nodeStatusConfigView = nodeStatusConfigService.createNodeStatusConfig(stack.getCluster().getCdpNodeStatusMonitorUser(), passwordInput, saltPingEnabled);
    Map<String, Object> nodeStatusConfig = nodeStatusConfigView.toMap();
    servicePillar.put("nodestatus", new SaltPillarProperties("/nodestatus/init.sls", singletonMap("nodestatus", nodeStatusConfig)));
}
Also used : NodeStatusConfigView(com.sequenceiq.cloudbreak.telemetry.nodestatus.NodeStatusConfigView) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)

Example 4 with NodeStatusConfigView

use of com.sequenceiq.cloudbreak.telemetry.nodestatus.NodeStatusConfigView in project cloudbreak by hortonworks.

the class TelemetryConfigService method getCdpNodeStatusPillarConfig.

private Map<String, ? extends SaltPillarProperties> getCdpNodeStatusPillarConfig(Stack stack, char[] passwordInput) {
    boolean saltPingEnabled = entitlementService.nodestatusSaltPingEnabled(stack.getAccountId());
    NodeStatusConfigView nodeStatusConfigs = nodeStatusConfigService.createNodeStatusConfig(stack.getCdpNodeStatusMonitorUser(), passwordInput, saltPingEnabled);
    return Map.of("nodestatus", new SaltPillarProperties("/nodestatus/init.sls", Collections.singletonMap("nodestatus", nodeStatusConfigs.toMap())));
}
Also used : NodeStatusConfigView(com.sequenceiq.cloudbreak.telemetry.nodestatus.NodeStatusConfigView) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)

Example 5 with NodeStatusConfigView

use of com.sequenceiq.cloudbreak.telemetry.nodestatus.NodeStatusConfigView 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);
}
Also used : TelemetryCommonConfigView(com.sequenceiq.cloudbreak.telemetry.common.TelemetryCommonConfigView) NodeStatusConfigView(com.sequenceiq.cloudbreak.telemetry.nodestatus.NodeStatusConfigView) HashMap(java.util.HashMap) TelemetryClusterDetails(com.sequenceiq.cloudbreak.telemetry.TelemetryClusterDetails) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) DatabusConfigView(com.sequenceiq.cloudbreak.telemetry.databus.DatabusConfigView) MeteringConfigView(com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfigView) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) MonitoringConfigView(com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfigView) Test(org.junit.Test)

Aggregations

SaltPillarProperties (com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)6 NodeStatusConfigView (com.sequenceiq.cloudbreak.telemetry.nodestatus.NodeStatusConfigView)6 TelemetryClusterDetails (com.sequenceiq.cloudbreak.telemetry.TelemetryClusterDetails)2 TelemetryCommonConfigView (com.sequenceiq.cloudbreak.telemetry.common.TelemetryCommonConfigView)2 DatabusConfigView (com.sequenceiq.cloudbreak.telemetry.databus.DatabusConfigView)2 MeteringConfigView (com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfigView)2 MonitoringConfigView (com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfigView)2 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)2 HashMap (java.util.HashMap)2 Test (org.junit.Test)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2