Package com.seyren.core.domain

Examples of com.seyren.core.domain.Check


    }
   
    @Override
    public Response getChart(String checkId, int width, int height, String from, String to, boolean hideThresholds, boolean hideLegend, boolean hideAxes) {
       
        Check check = checksStore.getCheck(checkId);
        if (check == null) {
            return Response.status(Status.NOT_FOUND).build();
        }
       
        String target = check.getTarget();
       
        if (hideThresholds) {
            return getChart(target, width, height, from, to, null, null, hideLegend, hideAxes);
        } else {
            return getChart(target, width, height, from, to, check.getWarn(), check.getError(), hideLegend, hideAxes);
        }
       
    }
View Full Code Here


    @Override
    public Response createCheck(Check check) {
        if (check.getState() == null) {
            check.setState(AlertType.OK);
        }
        Check stored = checksStore.createCheck(check);
        return Response.created(uri(stored.getId())).build();
    }
View Full Code Here

        return Response.created(uri(stored.getId())).build();
    }
   
    @Override
    public Response updateCheck(String checkId, Check check) {
        Check stored = checksStore.getCheck(checkId);
        if (stored == null) {
            return Response.status(Status.NOT_FOUND).build();
        }
        stored = checksStore.saveCheck(check);
        return Response.ok(stored).build();
View Full Code Here

        return Response.ok(stored).build();
    }
   
    @Override
    public Response getCheck(String checkId) {
        Check check = checksStore.getCheck(checkId);
        if (check == null) {
            return Response.status(Status.NOT_FOUND).build();
        }
        return Response.ok(check).build();
    }
View Full Code Here

        return Response.noContent().build();
    }

    @Override
    public Response testSubscription(@PathParam("checkId") String checkId, @PathParam("subscriptionId") final String subscriptionId) {
      Check check = checksStore.getCheck(checkId);
      if (check == null) {
        return Response.status(Response.Status.NOT_FOUND).build();
      }
      Collection<Subscription> subscriptions = Collections2.filter(check.getSubscriptions(), new Predicate<Subscription>() {
        @Override
        public boolean apply(Subscription subscription) {
          return subscription.getId().equals(subscriptionId);
        }
      });
      if (subscriptions.size() != 1) {
        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)
          .withToType(AlertType.ERROR)
          .withTimestamp(new DateTime());
      interestingAlerts.add(alert);
      for (NotificationService notificationService : notificationServices) {
View Full Code Here

    }

    @Override
    public Response totalMetric(@PathParam("target") String target) {
        try {
            Map<String, Optional<BigDecimal>> targetValues = graphiteTargetChecker.check(new Check().withTarget(target).withName(target));
            Map<String, Integer> result = new HashMap<String, Integer>();
            result.put(target, targetValues.size());
            return Response.ok(result).build();
        } catch (Exception e) {
            return Response.serverError().build();
View Full Code Here

        BasicDBList list = getBasicDBList(dbo, "subscriptions");
        for (Object o : list) {
            subscriptions.add(subscriptionFrom((DBObject) o));
        }
       
        return new Check().withId(id)
                .withName(name)
                .withDescription(description)
                .withTarget(target)
                .withFrom(from)
                .withUntil(until)
View Full Code Here

               
                interestingAlerts.add(alert);
               
            }

            Check updatedCheck = checksStore.updateStateAndLastCheck(check.getId(), worstState, DateTime.now());

            if (interestingAlerts.isEmpty()) {
                return;
            }
           
            for (Subscription subscription : updatedCheck.getSubscriptions()) {
                if (!subscription.shouldNotify(now, worstState)) {
                    continue;
                }
               
                for (NotificationService notificationService : notificationServices) {
View Full Code Here

        synchronized (tcpServer) {
            tcpServer.start();
            tcpServer.wait(1000); // Wait for up to 1 second while the server socket is being bound.
        }
       
        Check check = new Check().withEnabled(true).withName("check-name")
                .withState(AlertType.ERROR);
       
        Subscription subscription = new Subscription().withType(
                SubscriptionType.IRCCAT).withTarget("#mychannel");
       
View Full Code Here

    private Check check() {
        return checkWithTarget("service.error.1MinuteRate");
    }
   
    private Check checkWithTarget(String target) {
        return new Check()
                .withId("id")
                .withTarget(target)
                .withWarn(new BigDecimal("0.15"))
                .withError(new BigDecimal("0.20"));
    }
View Full Code Here

TOP

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

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.