Examples of AlertConditionOperator


Examples of org.rhq.core.domain.alert.AlertConditionOperator

        AlertConditionCategory category = condition.getCategory();
        switch (category) {
        case AVAILABILITY: {
            str.append(MSG.common_title_availability());
            str.append(" [");
            AlertConditionOperator operator = AlertConditionOperator.valueOf(condition.getName().toUpperCase());
            switch (operator) {
            case AVAIL_GOES_DISABLED:
                str.append(MSG.view_alert_definition_condition_editor_operator_availability_goesDisabled());
                break;
            case AVAIL_GOES_DOWN:
                str.append(MSG.view_alert_definition_condition_editor_operator_availability_goesDown());
                break;
            case AVAIL_GOES_UNKNOWN:
                str.append(MSG.view_alert_definition_condition_editor_operator_availability_goesUnknown());
                break;
            case AVAIL_GOES_UP:
                str.append(MSG.view_alert_definition_condition_editor_operator_availability_goesUp());
                break;
            case AVAIL_GOES_NOT_UP:
                str.append(MSG.view_alert_definition_condition_editor_operator_availability_goesNotUp());
                break;
            default:
                str.append("*ERROR*");
            }
            str.append("]");

            break;
        }
        case AVAIL_DURATION: {
            str.append(MSG.view_alert_definition_condition_editor_availabilityDuration());
            str.append(" [");
            AlertConditionOperator operator = AlertConditionOperator.valueOf(condition.getName().toUpperCase());
            switch (operator) {
            case AVAIL_DURATION_DOWN:
                str.append(MSG.view_alert_definition_condition_editor_operator_availability_durationDown());
                break;
            case AVAIL_DURATION_NOT_UP:
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertConditionOperator

        StringBuilder str = new StringBuilder();

        AlertConditionCategory category = condition.getCategory();
        switch (category) {
        case AVAILABILITY: {
            AlertConditionOperator operator = AlertConditionOperator.valueOf(condition.getName().toUpperCase());
            String msg;
            switch (operator) {
            case AVAIL_GOES_DISABLED:
                msg = isShort ? AlertI18NResourceKeys.ALERT_AVAILABILITY_GOES_DISABLED_SHORT
                    : AlertI18NResourceKeys.ALERT_AVAILABILITY_GOES_DISABLED;
                break;
            case AVAIL_GOES_DOWN:
                msg = isShort ? AlertI18NResourceKeys.ALERT_AVAILABILITY_GOES_DOWN_SHORT
                    : AlertI18NResourceKeys.ALERT_AVAILABILITY_GOES_DOWN;
                break;
            case AVAIL_GOES_UNKNOWN:
                msg = isShort ? AlertI18NResourceKeys.ALERT_AVAILABILITY_GOES_UNKNOWN_SHORT
                    : AlertI18NResourceKeys.ALERT_AVAILABILITY_GOES_UNKNOWN;
                break;
            case AVAIL_GOES_UP:
                msg = isShort ? AlertI18NResourceKeys.ALERT_AVAILABILITY_GOES_UP_SHORT
                    : AlertI18NResourceKeys.ALERT_AVAILABILITY_GOES_UP;
                break;
            case AVAIL_GOES_NOT_UP:
            default:
                msg = isShort ? AlertI18NResourceKeys.ALERT_AVAILABILITY_GOES_NOT_UP_SHORT
                    : AlertI18NResourceKeys.ALERT_AVAILABILITY_GOES_NOT_UP;
                break;
            }
            str.append(AlertI18NFactory.getMessage(msg));

            break;
        }

        case AVAIL_DURATION: {
            AlertConditionOperator operator = AlertConditionOperator.valueOf(condition.getName().toUpperCase());
            String msg;
            switch (operator) {
            case AVAIL_DURATION_DOWN:
                msg = isShort ? AlertI18NResourceKeys.ALERT_AVAILABILITY_DURATION_DOWN_SHORT
                    : AlertI18NResourceKeys.ALERT_AVAILABILITY_DURATION_DOWN;
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertConditionOperator

    static public void execute(Map<String, String> infoMap) throws Exception {
        int conditionId = Integer.valueOf(infoMap.get(DATAMAP_CONDITION_ID));
        int resourceId = Integer.valueOf(infoMap.get(DATAMAP_RESOURCE_ID));
        long duration = Long.valueOf(infoMap.get(DATAMAP_DURATION)); // in seconds
        long durationStart = Long.valueOf(infoMap.get(DATAMAP_START_TIME)); // in milliseconds
        AlertConditionOperator operator = AlertConditionOperator.valueOf(infoMap.get(DATAMAP_OPERATOR));

        // get the availabilities for the duration period, one consistent duration will indicate a duration condition
        AvailabilityCriteria criteria = new AvailabilityCriteria();
        criteria.addFilterResourceId(resourceId);
        long durationEnd = durationStart + (duration * 1000);
        criteria.addFilterInterval((durationStart + 1), (durationEnd - 1)); // reduced 1ms to fake exclusive interval filter.
        criteria.addSortStartTime(PageOrdering.ASC);
        List<Availability> avails = LookupUtil.getAvailabilityManager().findAvailabilityByCriteria(
            LookupUtil.getSubjectManager().getOverlord(), criteria);

        // Although unlikely, it's possible the resource has actually gone away while we waited out the duration period.
        // If we can't find any resource avail assume the resource is gone and just end the job.
        if (avails.isEmpty()) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("AlertAvailabilityDurationJob: No alert. Assuming resource has been uninventoried ["
                    + resourceId + "]");
            }

            return;
        }

        // If there are multiple duration records for the duration period then the avail did not stay constant.
        // Therefore, the alert should not fire as the semantics are "goes down and stays down".
        if (avails.size() > 1) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("AlertAvailabilityDurationJob: No alert. Resource avail for [" + resourceId
                    + "] has fluctuated. " + avails);
            }

            return;
        }

        // At this point we should be able to just checkConditions because if there is only one avail record for the
        // duration period it means nothing has changed.  But, we'll perform a sanity check just to ensure the avail
        // type is what we think it should be...

        Availability avail = avails.get(0);
        AvailabilityType availType = avail.getAvailabilityType();

        boolean checkConditions = false;
        switch (operator) {
        case AVAIL_DURATION_DOWN:
            checkConditions = (AvailabilityType.DOWN == availType);
            break;
        case AVAIL_DURATION_NOT_UP:
            checkConditions = (AvailabilityType.UP != availType);
            break;
        default:
            LOG.error("AlertAvailabilityDurationJob: unexpected operator [" + operator.name() + "]");
        }

        // the call to checkConditions will probably result in an alert, as the actual condition satisfaction was
        // just done. but we need to actually hook into the alerting chassis to ensure any other conditions are
        // still satisfied and to make sure all the alert processing is performed.
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertConditionOperator

            }

            private String formatCondition(AlertCondition condition) {
                StringBuilder builder = new StringBuilder();
                AlertConditionCategory category = condition.getCategory();
                AlertConditionOperator operator;
                String formattedThreshold;

                switch (category) {
                    case AVAILABILITY:
                        builder.append("Availability [");
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertConditionOperator

        AlertCondition alertCondition = composite.getCondition();
        int alertConditionId = alertCondition.getId(); // auto-unboxing is safe here because as the PK it's guaranteed to be non-null

        AlertConditionCategory alertConditionCategory = alertCondition.getCategory();
        AlertConditionOperator alertConditionOperator = AlertConditionCacheUtils
            .getAlertConditionOperator(alertCondition);

        if (DataType.CALLTIME == composite.getDataType()) { // call-time cases start here
            if (alertConditionCategory == AlertConditionCategory.CHANGE) {
                AlertConditionChangesCategoryComposite changesComposite = (AlertConditionChangesCategoryComposite) composite;
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertConditionOperator

        case TRAIT:
            String regex = alertCondition.getOption();
            return (null == regex || regex.isEmpty()) ? AlertConditionOperator.CHANGES : AlertConditionOperator.REGEX;

        case AVAILABILITY: {
            AlertConditionOperator operator = AlertConditionOperator.valueOf(name.toUpperCase());

            switch (operator) {
            case AVAIL_GOES_DISABLED:
            case AVAIL_GOES_DOWN:
            case AVAIL_GOES_UNKNOWN:
            case AVAIL_GOES_UP:
            case AVAIL_GOES_NOT_UP:
                return operator;

            default:
                throw new UnsupportedAlertConditionOperatorException(
                    "Invalid alertConditionValue for AVAILABILITY category:" + operator);
            }
        }

        case AVAIL_DURATION: {
            AlertConditionOperator operator = AlertConditionOperator.valueOf(name.toUpperCase());

            switch (operator) {
            case AVAIL_DURATION_DOWN:
            case AVAIL_DURATION_NOT_UP:
                return operator;
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertConditionOperator

        AlertCondition alertCondition = composite.getCondition();
        int alertConditionId = alertCondition.getId(); // auto-unboxing is safe here because as the PK it's guaranteed to be non-null

        AlertConditionCategory alertConditionCategory = alertCondition.getCategory();
        AlertConditionOperator alertConditionOperator = AlertConditionCacheUtils
            .getAlertConditionOperator(alertCondition);

        if (alertConditionCategory == AlertConditionCategory.AVAILABILITY) {
            AlertConditionAvailabilityCategoryComposite availabilityComposite = (AlertConditionAvailabilityCategoryComposite) composite;

            try {
                AvailabilityCacheElement cacheElement = new AvailabilityCacheElement(alertConditionOperator,
                    availabilityComposite.getAvailabilityType(), alertConditionId);
                addTo("availabilityCache", availabilityCache, availabilityComposite.getResourceId(), cacheElement,
                    alertConditionId, stats);
            } catch (InvalidCacheElementException icee) {
                log.info("Failed to create AvailabilityCacheElement with parameters: "
                    + AlertConditionCacheUtils.getCacheElementErrorString(alertConditionId, alertConditionOperator,
                        availabilityComposite.getAvailabilityType(), AvailabilityType.UP, icee));
            }
        } else if (alertConditionCategory == AlertConditionCategory.AVAIL_DURATION) {
            AlertConditionAvailabilityCategoryComposite availabilityComposite = (AlertConditionAvailabilityCategoryComposite) composite;

            try {
                AvailabilityDurationCacheElement cacheElement = new AvailabilityDurationCacheElement(
                    availabilityComposite.getAlertDefinitionId(), alertConditionOperator, alertCondition.getOption(),
                    availabilityComposite.getAvailabilityType(), alertConditionId);
                addTo("availabilityDurationCache", availabilityDurationCache, availabilityComposite.getResourceId(),
                    cacheElement, alertConditionId, stats);
            } catch (InvalidCacheElementException icee) {
                log.info("Failed to create AvailabilityCacheElement with parameters: "
                    + AlertConditionCacheUtils.getCacheElementErrorString(alertConditionId, alertConditionOperator,
                        availabilityComposite.getAvailabilityType(), alertConditionOperator.toString(), icee));
            }
        } else if (alertConditionCategory == AlertConditionCategory.CONTROL) {
            AlertConditionControlCategoryComposite controlComposite = (AlertConditionControlCategoryComposite) composite;
            String option = alertCondition.getOption();
            OperationRequestStatus operationRequestStatus = OperationRequestStatus.valueOf(option.toUpperCase());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.