Examples of AlertDampening


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

        cond.setMeasurementDefinition(dynamicMeasuremenDef);
        alertDefinition.setName("liveDataTestAlert");
        alertDefinition.setResource(resource);
        alertDefinition.setPriority(AlertPriority.MEDIUM);
        alertDefinition.setRecoveryId(0);
        alertDefinition.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
        alertDefinition.setConditions(Collections.singleton(cond));
        alertDefinition.setEnabled(true);
        alertDefinition.setConditionExpression(BooleanExpression.ALL);

        AlertDefinitionManagerLocal alertDefinitionManager = LookupUtil.getAlertDefinitionManager();
View Full Code Here

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

        AlertDefinition def = new AlertDefinition();
        def.addCondition(goingDown);
        def.setName("Test alert definition");
        def.setPriority(AlertPriority.MEDIUM);
        def.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
        def.setRecoveryId(0);
        alertDefinitionManager.createAlertDefinitionInNewTransaction(overlord, def, res.getId(), true);

        for (int MULTI : ROUNDS) {
            String round = String.format(ROUND__FORMAT, MULTI);
View Full Code Here

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

        AlertDefinition alertDef = new AlertDefinition();
        alertDef.setName(name);
        alertDef.setPriority(AlertPriority.MEDIUM);
        alertDef.setResourceType(resourceType);
        alertDef.setConditionExpression(BooleanExpression.ALL);
        alertDef.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
        alertDef.setRecoveryId(0);

        alertTemplateMgr.createAlertTemplate(subjectMgr.getOverlord(), alertDef, resourceType.getId());
    }
View Full Code Here

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

        AlertDefinition alertDef = new AlertDefinition();
        alertDef.setName(name);
        alertDef.setPriority(AlertPriority.MEDIUM);
        alertDef.setResourceType(resourceType);
        alertDef.setConditionExpression(BooleanExpression.ALL);
        alertDef.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
        alertDef.setRecoveryId(0);

        alertTemplateMgr.createAlertTemplate(subjectMgr.getOverlord(), alertDef, resourceType.getId());
    }
View Full Code Here

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

            boolean fire = false;

            // get the alert definition in preparation for lots of processing on it
            AlertDefinition alertDefinition = entityManager.find(AlertDefinition.class, alertDefinitionId);

            AlertDampening alertDampening = alertDefinition.getAlertDampening();
            AlertDampening.Category category = alertDampening.getCategory();

            if (log.isDebugEnabled()) {
                log.debug("Alert condition processing for " + alertDefinition);
                log.debug("Dampening rules are: " + alertDampening);
            }

            if (category == AlertDampening.Category.NONE) {
                if ((eventType == AlertDampeningEvent.Type.POSITIVE)
                    || (eventType == AlertDampeningEvent.Type.POSITIVE_AGAIN)) {
                    /*
                     * technically we should always fire for the NONE category, but since this method has other
                     * consequences we'll call it and pass 1 as the second argument
                     */
                    fire = this.shouldFireConsecutiveCountAlert(alertDefinitionId, 1);
                }
            } else if (category == AlertDampening.Category.CONSECUTIVE_COUNT) {
                /*
                 * we don't care if the condition set becomes untrue, we need a number of events to be true in a row; a
                 * false event effectively resets that counter, so we need not perform a check in that instance
                 */
                if ((eventType == AlertDampeningEvent.Type.POSITIVE)
                    || (eventType == AlertDampeningEvent.Type.POSITIVE_AGAIN)) {
                    int count = alertDampening.getValue();

                    fire = this.shouldFireConsecutiveCountAlert(alertDefinitionId, count);
                }
            } else if (category == AlertDampening.Category.PARTIAL_COUNT) {
                if ((eventType == AlertDampeningEvent.Type.POSITIVE)
                    || (eventType == AlertDampeningEvent.Type.POSITIVE_AGAIN)) {
                    int count = alertDampening.getValue();
                    int period = alertDampening.getPeriod();

                    fire = this.shouldFirePartialCountAlert(alertDefinitionId, count, period);
                }
            } else if (category == AlertDampening.Category.DURATION_COUNT) {
                /*
                 * we don't care if the condition set becomes untrue, the count is all about how many times it was known
                 * to be positive (or positive again) during the collection period
                 */
                if ((eventType == AlertDampeningEvent.Type.POSITIVE)
                    || (eventType == AlertDampeningEvent.Type.POSITIVE_AGAIN)) {
                    int count = alertDampening.getValue();
                    long period = alertDampening.getPeriod() * alertDampening.getPeriodUnits().getNumberOfSeconds();

                    // check whether "value" number of positive events have occurred within the last "period" seconds
                    fire = this.shouldFireDurationCountAlert(alertDefinitionId, count, period);
                }
            } else {
                log.info("Category " + alertDampening.getCategory()
                    + " is not supported for alert dampening processing");
            }

            /*
             * If the dampening rules say we can fire, then create a new alert, and find the unmatched alert condition
View Full Code Here

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

            newAlertDef.setPriority(AlertPriority.MEDIUM);
            newAlertDef.setParentId(0);
            newAlertDef.setConditionExpression(BooleanExpression.ANY);
            newAlertDef.setWillRecover(false);
            newAlertDef.setRecoveryId(0);
            newAlertDef.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
            newAlertDef.setNotifyFiltered(false);
            newAlertDef.setControlFiltered(false);
            singleAlertDefinitionView.setAlertDefinition(newAlertDef);
            singleAlertDefinitionView.makeEditable();
        } else {
View Full Code Here

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

    private AlertDefinition createGroupAlertDefinition(Subject subject, ResourceGroup resourceGroup) {
        AlertDefinition alertDefinition = new AlertDefinition();
        alertDefinition.setName(AlertConditionOperator.AVAIL_GOES_UP.name());
        alertDefinition.setPriority(AlertPriority.MEDIUM);
        alertDefinition.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
        alertDefinition.setConditionExpression(BooleanExpression.ANY);
        alertDefinition.setRecoveryId(0);
        alertDefinition.setGroup(resourceGroup);
        alertDefinition.setEnabled(true);
        AlertCondition alertCondition = new AlertCondition(alertDefinition, AlertConditionCategory.AVAILABILITY);
View Full Code Here

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

    private int createResourceAlertDefinitionAndGetId(String name) {
        AlertDefinition alertDefinition = new AlertDefinition();
        alertDefinition.setName(name);
        alertDefinition.setPriority(AlertPriority.MEDIUM);
        alertDefinition.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
        alertDefinition.setConditionExpression(BooleanExpression.ANY);
        alertDefinition.setRecoveryId(0);
        alertDefinition.setEnabled(true);
        alertDefinition = alertDefinitionManager.createAlertDefinitionInNewTransaction(testData.getSubject(),
            alertDefinition, testData.getResource().getId(), true);
View Full Code Here

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

     *
     * @param request  the http request
     * @param alertDef
     */
    public static void setAlertDampeningRequestAttributes(HttpServletRequest request, AlertDefinition alertDefinition) {
        AlertDampening alertDampening = alertDefinition.getAlertDampening();

        Integer enableActionsHowLong = alertDampening.getPeriod();
        AlertDampening.TimeUnits enableActionsHowLongUnits = alertDampening.getPeriodUnits();

        Integer enableActionsHowMany = alertDampening.getValue();
        AlertDampening.TimeUnits enableActionsHowManyUnits = alertDampening.getValueUnits();

        String enableActionsResource;
        AlertDampening.Category alertDampeningCategory = alertDampening.getCategory();

        if (alertDampeningCategory == AlertDampening.Category.NONE) {
            enableActionsResource = "alert.config.props.CB.DampenNone";
        } else if (alertDampeningCategory == AlertDampening.Category.ONCE) {
            enableActionsResource = "alert.config.props.CB.DampenOnce";
View Full Code Here

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

        filteringNotificationActions = alertDef.getNotifyFiltered();

        /*
         * dampening
         */
        AlertDampening alertDampening = alertDef.getAlertDampening();
        AlertDampening.Category category = alertDampening.getCategory();

        if (AlertDampening.Category.CONSECUTIVE_COUNT == category) {
            consecutiveCountValue = String.valueOf(alertDampening.getValue());
        } else if (AlertDampening.Category.PARTIAL_COUNT == category) {
            partialCountPeriod = String.valueOf(alertDampening.getPeriod());
            partialCountValue = String.valueOf(alertDampening.getValue());
        } else if (AlertDampening.Category.INVERSE_COUNT == category) {
            inverseCountValue = String.valueOf(alertDampening.getValue());
        } else if (AlertDampening.Category.DURATION_COUNT == category) {
            durationCountValue = String.valueOf(alertDampening.getValue());
            durationCountPeriod = String.valueOf(alertDampening.getPeriod());
            durationCountPeriodUnits = alertDampening.getPeriodUnits().ordinal() + 1;
        }

        whenEnabled = alertDampening.getCategory().ordinal();
    }
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.