Search in sources :

Example 26 with IdmMonitoringDto

use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.

the class IdentityDemoChangeProcessor method process.

@Override
public EventResult<IdmIdentityDto> process(EntityEvent<IdmIdentityDto> event) {
    String evaluatorType = AutowireHelper.getTargetType(demoAdminMonitoringEvaluator);
    IdmMonitoringDto monitoring = initMonitoringProcessor.findMonitoring(evaluatorType, null, null);
    // evaluate monitoring, if registered and enabled
    if (monitoring != null && !monitoring.isDisabled()) {
        manager.execute(monitoring);
    }
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult)

Example 27 with IdmMonitoringDto

use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.

the class InitMonitoringProcessor method initLoggingEventMonitoring.

protected IdmMonitoringDto initLoggingEventMonitoring() {
    String evaluatorType = AutowireHelper.getTargetType(loggingEventMonitoringEvaluator);
    IdmMonitoringDto monitoring = findMonitoring(evaluatorType, null, null);
    if (monitoring == null) {
        monitoring = new IdmMonitoringDto();
        monitoring.setEvaluatorType(evaluatorType);
        monitoring.setInstanceId(configurationService.getInstanceId());
        // ~ per hour
        monitoring.setCheckPeriod(3600L);
        // ~ quick
        monitoring.setSeq((short) 0);
        monitoring.setDescription(PRODUCT_PROVIDED_MONITORING_DESCRIPTION);
        ConfigurationMap evaluatorProperties = new ConfigurationMap();
        evaluatorProperties.put(LongRunningTaskMonitoringEvaluator.PARAMETER_NUMBER_OF_DAYS, LongRunningTaskMonitoringEvaluator.DEFAULT_NUMBER_OF_DAYS);
        monitoring.setEvaluatorProperties(evaluatorProperties);
        // 
        monitoring = monitoringService.save(monitoring);
        LOG.info("Logging events monitoring configured automatically.");
    }
    // 
    return monitoring;
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) ConfigurationMap(eu.bcvsolutions.idm.core.api.domain.ConfigurationMap)

Example 28 with IdmMonitoringDto

use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.

the class InitMonitoringProcessor method initDatabaseTableMonitoring.

protected IdmMonitoringDto initDatabaseTableMonitoring(Class<? extends ReadDtoService<?, ?>> readDtoService) {
    String evaluatorType = AutowireHelper.getTargetType(databaseTableMonitoringEvaluator);
    String serviceBeanName = applicationContext.getBeanNamesForType(readDtoService)[0];
    ConfigurationMap properties = new ConfigurationMap();
    properties.put(DatabaseTableMonitoringEvaluator.PARAMETER_READ_SERVICE_BEAN_NAME, serviceBeanName);
    IdmMonitoringDto monitoring = findMonitoring(evaluatorType, null, properties);
    if (monitoring == null) {
        monitoring = new IdmMonitoringDto();
        monitoring.setEvaluatorType(evaluatorType);
        monitoring.setInstanceId(configurationService.getInstanceId());
        // ~ per hour
        monitoring.setCheckPeriod(3600L);
        // FIXME: dto mapper to get AvailableServiceDto with table => #978
        monitoring.setDescription(String.format("%s for service [%s].", StringUtils.substring(PRODUCT_PROVIDED_MONITORING_DESCRIPTION, 0, -1), serviceBeanName));
        ConfigurationMap evaluatorProperties = new ConfigurationMap();
        evaluatorProperties.put(DatabaseTableMonitoringEvaluator.PARAMETER_READ_SERVICE_BEAN_NAME, serviceBeanName);
        evaluatorProperties.put(DatabaseTableMonitoringEvaluator.PARAMETER_THRESHOLD, DatabaseTableMonitoringEvaluator.DEFAULT_THRESHOLD);
        monitoring.setEvaluatorProperties(evaluatorProperties);
        // ~ quick
        monitoring.setSeq((short) 0);
        // 
        monitoring = monitoringService.save(monitoring);
        LOG.info("Databate table monitoring for service bean name [{}] configured automatically.", serviceBeanName);
    }
    // 
    return monitoring;
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) ConfigurationMap(eu.bcvsolutions.idm.core.api.domain.ConfigurationMap)

Example 29 with IdmMonitoringDto

use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.

the class InitMonitoringProcessor method initDemoAdminMonitoring.

protected IdmMonitoringDto initDemoAdminMonitoring() {
    String evaluatorType = AutowireHelper.getTargetType(demoAdminMonitoringEvaluator);
    IdmMonitoringDto monitoring = findMonitoring(evaluatorType, null, null);
    if (monitoring == null) {
        monitoring = new IdmMonitoringDto();
        monitoring.setEvaluatorType(evaluatorType);
        monitoring.setInstanceId(configurationService.getInstanceId());
        // ~ application start only
        monitoring.setCheckPeriod(0L);
        // ~ quick
        monitoring.setSeq((short) 0);
        monitoring.setDescription(PRODUCT_PROVIDED_MONITORING_DESCRIPTION);
        // 
        monitoring = monitoringService.save(monitoring);
        LOG.info("Demo admin monitoring configured automatically.");
    }
    // 
    return monitoring;
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto)

Example 30 with IdmMonitoringDto

use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.

the class SyncConfigMonitoringAutoConfigurationProcessor method configureMonitoring.

/**
 * Configure monitoring evaluator for given synchronization configuration, if monitoring evaluator is not already configured.
 *
 * @param synchronizationId synchronization configuration identifier
 * @return configured monitoring evaluator
 */
public IdmMonitoringDto configureMonitoring(UUID synchronizationId) {
    IdmMonitoringDto monitoring = findMonitoring(synchronizationId);
    if (monitoring != null) {
        return monitoring;
    }
    // 
    monitoring = new IdmMonitoringDto();
    // once per hour
    monitoring.setCheckPeriod(3600L);
    monitoring.setEvaluatorType(AutowireHelper.getTargetType(synchronizationMonitoringEvaluator));
    monitoring.getEvaluatorProperties().put(SynchronizationMonitoringEvaluator.PARAMETER_SYNCHRONIZATION, synchronizationId);
    monitoring.setInstanceId(configurationService.getInstanceId());
    monitoring.setDescription(InitMonitoringProcessor.PRODUCT_PROVIDED_MONITORING_DESCRIPTION);
    // 
    monitoring = monitoringService.save(monitoring);
    LOG.info("Monitoring [{}] configured automatically for synchronization configuration [{}]", monitoring.getId(), synchronizationId);
    // 
    return monitoring;
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto)

Aggregations

IdmMonitoringDto (eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto)73 Test (org.junit.Test)46 IdmMonitoringResultDto (eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto)45 AbstractUnitTest (eu.bcvsolutions.idm.test.api.AbstractUnitTest)24 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)16 UUID (java.util.UUID)13 IdmMonitoringResultFilter (eu.bcvsolutions.idm.core.monitoring.api.dto.filter.IdmMonitoringResultFilter)10 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)6 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)6 SysSyncConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter)6 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)6 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)5 SysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncConfigDto)5 ConfigurationMap (eu.bcvsolutions.idm.core.api.domain.ConfigurationMap)5 OperationResultDto (eu.bcvsolutions.idm.core.api.dto.OperationResultDto)5 AbstractReadWriteDtoControllerRestTest (eu.bcvsolutions.idm.core.api.rest.AbstractReadWriteDtoControllerRestTest)5 IdmMonitoringFilter (eu.bcvsolutions.idm.core.monitoring.api.dto.filter.IdmMonitoringFilter)5 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)4 AutowireHelper (eu.bcvsolutions.idm.core.api.utils.AutowireHelper)4 IdmMonitoringService (eu.bcvsolutions.idm.core.monitoring.api.service.IdmMonitoringService)4