Examples of AlertDefinition


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

        return fields;
    }

    @Override
    public AlertDefinition copyValues(Record from) {
        AlertDefinition alertDef = (AlertDefinition) from.getAttributeAsObject(FIELD_OBJECT);
        return alertDef;
    }
View Full Code Here

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

        ResourceType resourceType = resourceTypeMgr.getResourceTypeByNameAndPlugin(resourceTypeName, pluginName);
        assertNotNull("Cannot create alert template. Unable to find resource type for [name: " + resourceTypeName
            + ", plugin: " + pluginName + "]", resourceType);

        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.AlertDefinition

        }
    }

    public static String getAlertRecoveryInfo(Alert alert) {
        String recoveryInfo;
        AlertDefinition recoveryAlertDefinition = alert.getRecoveryAlertDefinition();
        if (recoveryAlertDefinition != null && recoveryAlertDefinition.getId() != 0) {
            int resourceId = alert.getAlertDefinition().getResource().getId();
            String otherAlertDef = "<a href=\"/alerts/Config.do?mode=viewRoles&id=" + resourceId + "&ad="
                + recoveryAlertDefinition.getId() + "\">" + recoveryAlertDefinition.getName() + "</a>";
            recoveryInfo = MSG.view_alert_common_tab_conditions_recovery_enabled(otherAlertDef);
        } else if (alert.getWillRecover()) {
            recoveryInfo = MSG.view_alert_common_tab_conditions_recovery_disabled();
        } else {
            recoveryInfo = MSG.common_val_na();
View Full Code Here

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

    @Override
    public ListGridRecord copyValues(AlertDefinition from) {
        ListGridRecord record = super.copyValues(from);

        Integer parentId = from.getParentId(); // a valid non-zero number means the alert def came from a template
        AlertDefinition groupAlertDefinition = from.getGroupAlertDefinition();
        boolean readOnly = from.isReadOnly();

        if ((parentId == null || parentId.intValue() == 0) && (groupAlertDefinition == null)) {
            record.setAttribute(FIELD_PARENT, "");
            record.setLinkText("");
            record.setAttribute(FIELD_READONLY, MSG.common_val_na());
        } else {
            if (parentId != null && parentId.intValue() != 0) {
                record.setAttribute(
                    FIELD_PARENT,
                    LinkManager.getAdminTemplatesEditLink(AlertDefinitionTemplateTypeView.VIEW_ID.getName(),
                        this.resource.getResourceType().getId()) + "/" + parentId);
                record.setLinkText(MSG.view_alert_definition_for_type());
            } else {
                boolean isAutogroup = groupAlertDefinition.getGroup().getAutoGroupParentResource() != null;
                if (isAutogroup) {
                    record.setAttribute(FIELD_PARENT, "#Resource/AutoGroup/"
                        + groupAlertDefinition.getGroup().getId() + "/Alerts/Definitions/" + groupAlertDefinition.getId());
                }
                else {
                    boolean isAutoCluster = groupAlertDefinition.getGroup().getClusterResourceGroup() != null;
                    if (isAutoCluster) {
                        record.setAttribute(FIELD_PARENT,  "#ResourceGroup/AutoCluster/"
                            + groupAlertDefinition.getGroup().getId() + "/Alerts/Definitions/" + groupAlertDefinition.getId());
                    }
                    else {
                        record.setAttribute(FIELD_PARENT, "#ResourceGroup/"
                            + groupAlertDefinition.getGroup().getId() + "/Alerts/Definitions/" + groupAlertDefinition.getId());
                    }
                }
                record.setLinkText(MSG.view_alert_definition_for_group());
            }
            record.setAttribute(FIELD_READONLY, (readOnly) ? MSG.common_val_yes() : MSG.common_val_no());
View Full Code Here

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

    @Override
    public AlertDefinition updateGroupAlertDefinitions(AlertDefinition groupAlertDefinition, boolean purgeInternals)
        throws RuntimeException {
        try {
            AlertDefinition results = groupAlertDefManager.updateGroupAlertDefinitions(getSessionSubject(),
                groupAlertDefinition, purgeInternals);
            return SerialUtility.prepare(results, "updateGroupAlertDefinitions");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
View Full Code Here

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

    @Override
    public AlertDefinition createAlertDefinition(AlertDefinition alertDefinition, Integer resourceId)
        throws RuntimeException {
        try {
            AlertDefinition result = alertDefManager.createAlertDefinitionInNewTransaction(getSessionSubject(),
                alertDefinition, resourceId, true);
            AlertDefinition preparedResult = SerialUtility.prepare(result, "createAlertDefinition");
            return preparedResult;
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
    }
View Full Code Here

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

    @Override
    public AlertDefinition updateAlertDefinition(int alertDefinitionId, AlertDefinition alertDefinition,
        boolean resetMatching) throws RuntimeException {
        try {
            AlertDefinition result = alertDefManager.updateAlertDefinition(getSessionSubject(), alertDefinitionId,
                alertDefinition, resetMatching);
            return SerialUtility.prepare(result, "updateAlertDefinition");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
View Full Code Here

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

        /*
         * this is informational debugging only - do NOT change the status bits here
         */
        if (log.isDebugEnabled()) {
            AlertDefinition definition = entityManager.find(AlertDefinition.class, alertDefinitionId);
            Agent agent = agentManager.getAgentByResourceId(LookupUtil.getSubjectManager().getOverlord(), definition
                .getResource().getId());
            log.debug("Marking status, agent[id=" + agent.getId() + ", status=" + agent.getStatus()
                + "] for alertDefinition[id=" + alertDefinitionId + "]");

            log.debug("Agents updated: " + agentsUpdated);
View Full Code Here

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

         */
        if (type != AlertDampeningEvent.Type.UNCHANGED) {
            /*
             * But only if it represents a type of event we need to act on
             */
            AlertDefinition flyWeightDefinition = new AlertDefinition();
            flyWeightDefinition.setId(alertDefinitionId);
            AlertDampeningEvent alertDampeningEvent = new AlertDampeningEvent(flyWeightDefinition, type);
            entityManager.persist(alertDampeningEvent);

            if (log.isDebugEnabled()) {
                log.debug("Need to process AlertDampeningEvent.Type of " + type + " " + "for AlertDefinition[ id="
View Full Code Here

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

        ResourceType type = resourceTypeManager.getResourceTypeById(user, resourceTypeId);

        alertTemplate.setResourceType(type); // mark this as an alert "template" definition

        AlertDefinition persistedAlertTemplate = null;
        try {
            persistedAlertTemplate = alertDefinitionManager.createAlertDefinitionInNewTransaction(user, alertTemplate,
                null, true);
        } catch (Throwable t) {
            throw new AlertDefinitionCreationException("Could not create alertTemplate for " + type + " with data "
                + alertTemplate.toSimpleString(), t);
        }

        Throwable firstThrowable = null;

        List<Integer> resourceIdsForType = getCommittedResourceIdsNeedingTemplateApplication(user,
            persistedAlertTemplate.getId(), resourceTypeId);
        List<Integer> resourceIdsInError = new ArrayList<Integer>();
        for (Integer resourceId : resourceIdsForType) {
            try {
                // construct the child
                AlertDefinition childAlertDefinition = new AlertDefinition(persistedAlertTemplate);
                childAlertDefinition.setParentId(alertTemplate.getId());

                // persist the child as a dependent alert definition
                alertDefinitionManager.createDependentAlertDefinition(user, childAlertDefinition, resourceId);
            } catch (Throwable t) {
                // continue on error, create as many as possible
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.