Examples of AlertCondition


Examples of org.graylog2.plugin.alarms.AlertCondition

        this.nodeId = nodeId;
    }

    public void call(Stream stream, AlertCondition.CheckResult result) {
        // Send alerts.
        AlertCondition alertCondition = result.getTriggeredCondition();
        if (stream.getAlertReceivers().size() > 0) {
            try {
                if (alertCondition.getBacklog() > 0 && alertCondition.getSearchHits() != null) {
                    List<Message> backlog = Lists.newArrayList();

                    for (Message searchHit : alertCondition.getSearchHits()) {
                        backlog.add(searchHit);
                    }

                    // Read as many messages as possible (max: backlog size) from backlog.
                    int readTo = alertCondition.getBacklog();
                    if(backlog.size() < readTo) {
                        readTo = backlog.size();
                    }
                    alertSender.sendEmails(stream, result, backlog.subList(0, readTo));
                } else {
View Full Code Here

Examples of org.graylog2.plugin.alarms.AlertCondition

        alertLastTriggered(grace * 60 + 1);
        assertFalse("Should not be in grace period because alert was fired after grace period has passed", alertService.inGracePeriod(alertCondition));
        alertLastTriggered(Integer.MAX_VALUE);
        assertFalse("Should not be in grace period because alert was fired after grace period has passed", alertService.inGracePeriod(alertCondition));

        final AlertCondition alertConditionZeroGrace = getDummyAlertCondition(getParametersMap(0, time, 0));
        alertLastTriggered(0);
        assertFalse("Should not be in grace period because grace is zero", alertService.inGracePeriod(alertConditionZeroGrace));
        alertLastTriggered(-1);
        assertFalse("Should not be in grace period because grace is zero", alertService.inGracePeriod(alertConditionZeroGrace));
        alertLastTriggered(Integer.MAX_VALUE);
View Full Code Here

Examples of org.graylog2.plugin.alarms.AlertCondition

            stream = streamService.load(streamid);
        } catch (org.graylog2.database.NotFoundException e) {
            throw new WebApplicationException(404);
        }

        final AlertCondition alertCondition;
        try {
            alertCondition = alertService.fromRequest(ccr, stream, getCurrentUser().getName());
        } catch (AbstractAlertCondition.NoSuchAlertConditionTypeException e) {
            LOG.error("Invalid alarm condition type.", e);
            throw new WebApplicationException(e, Response.Status.BAD_REQUEST);
        }

        try {
            streamService.addAlertCondition(stream, alertCondition);
        } catch (ValidationException e) {
            LOG.error("Validation error.", e);
            throw new WebApplicationException(e, Response.Status.BAD_REQUEST);
        }

        Map<String, Object> result = Maps.newHashMap();
        result.put("alert_condition_id", alertCondition.getId());

        return Response.status(Response.Status.CREATED).entity(json(result)).build();
    }
View Full Code Here

Examples of org.graylog2.plugin.alarms.AlertCondition

            LOG.error("Error while parsing JSON", e);
            throw new WebApplicationException(e, Response.Status.BAD_REQUEST);
        }

        Stream stream;
        AlertCondition alertCondition;
        try {
            stream = streamService.load(streamid);
            alertCondition = streamService.getAlertCondition(stream, conditionid);
            alertCondition = alertService.updateFromRequest(alertCondition, ccr);
        } catch (org.graylog2.database.NotFoundException e) {
View Full Code Here

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

    public AlertConditionResourceConfigurationCategoryComposite(
            int cid, AlertConditionCategory ccategory, String cname, String ccomparator, Double cthreshold, String coption, Integer triggerId,
            Integer resourceId,
        Configuration currentResourceConfiguration) {
        super(new AlertCondition(cid, ccategory, cname, ccomparator, cthreshold, coption, triggerId));
        this.resourceId = resourceId;
        this.resourceConfiguration = currentResourceConfiguration;
    }
View Full Code Here

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

    private final Integer resourceId;

    public AlertConditionDriftCategoryComposite(
            int cid, AlertConditionCategory ccategory, String cname, String ccomparator, Double cthreshold, String coption, Integer triggerId,
            Integer resourceId) {
        super(new AlertCondition(cid, ccategory, cname, ccomparator, cthreshold, coption, triggerId));
        this.resourceId = resourceId;
    }
View Full Code Here

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

    }

    public AlertConditionScheduleCategoryComposite(
            int cid, AlertConditionCategory ccategory, String cname, String ccomparator, Double cthreshold, String coption, Integer triggerId,
            Integer scheduleId, DataType dataType) {
        super(new AlertCondition(cid, ccategory, cname, ccomparator, cthreshold, coption, triggerId));
        this.scheduleId = scheduleId;
        this.dataType = dataType;
    }
View Full Code Here

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

            int cid, AlertConditionCategory ccategory, String cname, String ccomparator, Double cthreshold, String coption, Integer triggerId,
            Integer alertDefinitionId,
        Integer resourceId,
        AvailabilityType availabilityType) {

        super(new AlertCondition(cid, ccategory, cname, ccomparator, cthreshold, coption, triggerId));
        this.alertDefinitionId = alertDefinitionId;
        this.resourceId = resourceId;
        // For a resource with no Availability records we initialize to UNKNOWN
        this.availabilityType = (null != availabilityType) ? availabilityType : AvailabilityType.UNKNOWN;
    }
View Full Code Here

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

    private final DataType dataType;

    public AlertConditionRangeCategoryComposite(
            int cid, AlertConditionCategory ccategory, String cname, String ccomparator, Double cthreshold, String coption, Integer triggerId,
            Integer scheduleId, DataType dataType) {
        super(new AlertCondition(cid, ccategory, cname, ccomparator, cthreshold, coption, triggerId));
        this.scheduleId = scheduleId;
        this.dataType = dataType;
    }
View Full Code Here

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

*/
public class AlertConditionChangesCategoryComposite extends AlertConditionScheduleCategoryComposite {

    public AlertConditionChangesCategoryComposite(int cid, AlertConditionCategory ccategory, String cname, String ccomparator, Double cthreshold, String coption, Integer triggerId,
            Integer scheduleId, DataType dataType) {
        super(new AlertCondition(cid, ccategory, cname, ccomparator, cthreshold, coption, triggerId),
                scheduleId, dataType);
    }
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.