Package com.seyren.core.domain

Examples of com.seyren.core.domain.Alert


        return Response.status(Response.Status.NOT_FOUND).build();
      }
      check.setState(AlertType.ERROR);
      Subscription subscription = subscriptions.iterator().next();
      List<Alert> interestingAlerts = new ArrayList<Alert>();
      Alert alert = new Alert()
          .withTarget(check.getTarget())
          .withValue(BigDecimal.valueOf(0.0))
          .withWarn(check.getWarn())
          .withError(check.getError())
          .withFromType(AlertType.OK)
View Full Code Here


        BigDecimal error = getBigDecimal(dbo, "error");
        AlertType fromType = AlertType.valueOf(getString(dbo, "fromType"));
        AlertType toType = AlertType.valueOf(getString(dbo, "toType"));
        DateTime timestamp = getDateTime(dbo, "timestamp");
       
        return new Alert()
                .withId(id)
                .withCheckId(checkId)
                .withValue(value)
                .withTarget(target)
                .withWarn(warn)
View Full Code Here

        if (alertCount > 0) {
            LOGGER.info("Found {} alert(s) which need updating", alertCount);
        }
        while (alerts.hasNext()) {
            DBObject alertObject = alerts.next();
            Alert alert = mapper.alertFrom(alertObject);
            getAlertsCollection().save(mapper.alertToDBObject(alert));
        }
    }
View Full Code Here

                    continue;
                }
               
                BigDecimal currentValue = value.get();
               
                Alert lastAlert = alertsStore.getLastAlertForTargetOfCheck(target, check.getId());
               
                AlertType lastState;
               
                if (lastAlert == null) {
                    lastState = AlertType.OK;
                } else {
                    lastState = lastAlert.getToType();
                }
               
                AlertType currentState = valueChecker.checkValue(currentValue, warn, error);
               
                if (currentState.isWorseThan(worstState)) {
                    worstState = currentState;
                }
               
                if (isStillOk(lastState, currentState)) {
                    continue;
                }
               
                Alert alert = createAlert(target, currentValue, warn, error, lastState, currentState, now);
               
                alertsStore.createAlert(check.getId(), alert);
               
                // Only notify if the alert has changed state
                if (stateIsTheSame(lastState, currentState)) {
View Full Code Here

    private boolean stateIsTheSame(AlertType last, AlertType current) {
        return last == current;
    }
   
    private Alert createAlert(String target, BigDecimal value, BigDecimal warn, BigDecimal error, AlertType from, AlertType to, DateTime now) {
        return new Alert()
                .withTarget(target)
                .withValue(value)
                .withWarn(warn)
                .withError(error)
                .withFromType(from)
View Full Code Here

                .withState(AlertType.ERROR);
       
        Subscription subscription = new Subscription().withType(
                SubscriptionType.IRCCAT).withTarget("#mychannel");
       
        Alert alert = new Alert().withTarget("the.target.name")
                .withValue(BigDecimal.valueOf(12))
                .withWarn(BigDecimal.valueOf(5))
                .withError(BigDecimal.valueOf(10)).withFromType(AlertType.WARN)
                .withToType(AlertType.ERROR);
       
View Full Code Here

       
        Subscription subscription = new Subscription()
                .withType(SubscriptionType.HUBOT)
                .withTarget("123,456");
       
        Alert alert = new Alert()
                .withTarget("the.target.name")
                .withValue(BigDecimal.valueOf(12))
                .withWarn(BigDecimal.valueOf(5))
                .withError(BigDecimal.valueOf(10))
                .withFromType(AlertType.WARN)
View Full Code Here

                .withState(AlertType.ERROR);
        Subscription subscription = new Subscription()
                .withEnabled(true)
                .withType(SubscriptionType.PAGERDUTY)
                .withTarget("servicekey123");
        Alert alert = new Alert()
                .withId("890")
                .withValue(new BigDecimal("1.0"))
                .withTimestamp(new DateTime())
                .withFromType(AlertType.OK)
                .withToType(AlertType.ERROR);
View Full Code Here

                .withState(AlertType.ERROR);
        Subscription subscription = new Subscription()
                .withEnabled(true)
                .withType(SubscriptionType.HIPCHAT)
                .withTarget("target");
        Alert alert = new Alert()
                .withFromType(AlertType.OK)
                .withToType(AlertType.ERROR);
        List<Alert> alerts = Arrays.asList(alert);

        String seyrenUrl = URLEncoder.encode(seyrenConfig.getBaseUrl(), "UTF-8");
View Full Code Here

                .withState(AlertType.ERROR);
        Subscription subscription = new Subscription()
                .withEnabled(true)
                .withType(SubscriptionType.EMAIL)
                .withTarget("some@email.com");
        Alert alert = new Alert()
                .withTarget("some.value")
                .withValue(new BigDecimal("4.0"))
                .withTimestamp(new DateTime())
                .withFromType(AlertType.OK)
                .withToType(AlertType.ERROR);
View Full Code Here

TOP

Related Classes of com.seyren.core.domain.Alert

Copyright © 2018 www.massapicom. 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.