Package nl.topicus.onderwijs.dashboard.datatypes

Examples of nl.topicus.onderwijs.dashboard.datatypes.Alert


      Build curBuild = builds.get(curJob.getName());
      if (curBuild == null)
        continue;

      if (Result.UNSTABLE.equals(curBuild.getResult())) {
        Alert alert = new Alert(alertsCache.get(curJob.getName()),
            DotColor.YELLOW, project, "Build "
                + curBuild.getNumber() + " is unstable");
        alert.setOverlayVisible((System.currentTimeMillis() - curBuild
            .getTimestamp().getTime()) < 90 * 1000);
        alertsCache.put(curJob.getName(), alert);
        ret.add(alert);
      } else if (Result.FAILURE.equals(curBuild.getResult())) {
        Alert alert = new Alert(alertsCache.get(curJob.getName()),
            DotColor.RED, project, "Build " + curBuild.getNumber()
                + " failed");
        alert.setOverlayVisible((System.currentTimeMillis() - curBuild
            .getTimestamp().getTime()) < 90 * 1000);
        alertsCache.put(curJob.getName(), alert);
        ret.add(alert);
      } else
        alertsCache.remove(curJob.getName());
View Full Code Here


      String statusCode = statusUrlEntry.getKey();
      String statusUrl = statusUrlEntry.getValue();
      TopicusServerStatus server = new TopicusServerStatus(statusCode,
          statusUrl);
      status.addServer(server);
      Alert oldAlert = oldAlerts.get(statusUrl);
      try {
        StatusPageResponse statuspage = getStatuspage(statusUrl);
        if (!statuspage.isOk()) {
          server.setServerStatus(DotColor.RED);
          Alert alert = new Alert(oldAlert, DotColor.RED, project,
              "Server " + statusCode + " offline with HTTP code "
                  + statuspage.getHttpStatusCode());
          oldAlerts.put(statusUrl, alert);
          alerts.add(alert);
          continue;
        }
        server.setServerStatus(DotColor.GREEN);
        String page = statuspage.getPageContent();

        Source source = new Source(page);

        source.fullSequentialParse();

        List<Element> tableHeaders = source
            .getAllElements(HTMLElementName.H2);
        for (Element tableHeader : tableHeaders) {
          String contents = tableHeader.getTextExtractor().toString();
          if ("Applicatie status".equals(contents)) {
            fetchApplicationInfo(server, tableHeader
                .getParentElement(), oldAlert, alerts, project);
          } else if ("Sessies/Requests".equals(contents)) {
            fetchSessionAndRequestData(server, tableHeader
                .getParentElement());
          }
        }
        oldAlerts.put(statusUrl, null);
      } catch (Exception e) {
        server.setServerStatus(DotColor.YELLOW);
        Alert alert = new Alert(oldAlert, DotColor.YELLOW, project, e
            .getMessage());
        oldAlerts.put(statusUrl, alert);
        alerts.add(alert);
        log.warn("Could not retrieve status for '" + statusUrl + "': "
            + e.getClass().getSimpleName() + " - "
View Full Code Here

              + " according to format dd MMMM yyyy, hh:mm", e);
        }
      } else if ("Status".equals(name)) {
        if (!"OK".equals(value)) {
          server.setServerStatus(DotColor.RED);
          Alert alert = new Alert(oldAlert, DotColor.RED, project,
              "Server " + server.getCode() + " reports " + value);
          oldAlerts.put(server.getUrl(), alert);
          alerts.add(alert);
        }
      }
View Full Code Here

      String statusCode = statusUrlEntry.getKey();
      String statusUrl = statusUrlEntry.getValue();
      TopicusServerStatus server = new TopicusServerStatus(statusCode,
          statusUrl);
      status.addServer(server);
      Alert oldAlert = oldAlerts.get(statusUrl);
      try {
        StatusPageResponse statuspage = getStatuspage(statusUrl);
        if (!statuspage.isOk()) {
          server.setServerStatus(DotColor.RED);
          Alert alert = new Alert(oldAlert, DotColor.RED, project,
              "Server " + statusCode + " offline with HTTP code "
                  + statuspage.getHttpStatusCode());
          oldAlerts.put(statusUrl, alert);
          alerts.add(alert);
          continue;
        }
        String page = statuspage.getPageContent();

        Source source = new Source(page);

        source.fullSequentialParse();

        List<Element> tableHeaders = source.getAllElements("class",
            "main_label", true);
        for (Element tableHeader : tableHeaders) {
          String contents = tableHeader.getContent().toString();
          if ("Actieve sessies:".equals(contents)) {
            fetchNumberOfUsers(server, tableHeader);
          } else if ("Gestart op:".equals(contents)) {
            fetchStartTijd(server, tableHeader);
          } else if ("Gemiddelde requesttijd:".equals(contents)) {
            fetchAvgRequestTime(server, tableHeader);
          } else if ("Requests per minuut:".equals(contents)) {
            fetchRequestsPerMinute(server, tableHeader);
          }
        }
        server.setServerStatus(DotColor.GREEN);
        oldAlerts.put(statusUrl, null);
      } catch (Exception e) {
        server.setServerStatus(DotColor.YELLOW);
        Alert alert = new Alert(oldAlert, DotColor.YELLOW, project,
            e.getMessage());
        oldAlerts.put(statusUrl, alert);
        alerts.add(alert);
        log.warn("Could not retrieve status for '" + statusUrl + "': "
            + e.getClass().getSimpleName() + " - "
View Full Code Here

      String statusCode = statusUrlEntry.getKey();
      String statusUrl = statusUrlEntry.getValue();
      TopicusServerStatus server = new TopicusServerStatus(statusCode,
          statusUrl);
      status.addServer(server);
      Alert oldAlert = oldAlerts.get(statusUrl);
      try {
        StatusPageResponse statuspage = getStatuspage(statusUrl);
        if (!statuspage.isOk()) {
          server.setServerStatus(DotColor.RED);
          Alert alert = new Alert(oldAlert, DotColor.RED, project,
              "Server " + statusCode + " offline with HTTP code "
                  + statuspage.getHttpStatusCode());
          oldAlerts.put(statusUrl, alert);
          alerts.add(alert);
          continue;
        }

        String page = statuspage.getPageContent();
        Source source = new Source(page);

        source.fullSequentialParse();

        List<Element> tableHeaders = source
            .getAllElements(HTMLElementName.TH);
        for (Element tableHeader : tableHeaders) {
          String contents = tableHeader.getContent().toString();
          if ("Applicatie".equals(contents)) {
            fetchApplicationVersion(server, tableHeader);
          } else if ("Sessions/Requests".equals(contents)) {
            fetchSessionAndRequestData(server, tableHeader);
          } else if ("Wicket Sessions/Requests".equals(contents)) {
            fetchSessionAndRequestData(server, tableHeader);
          } else if ("Sessies/Requests".equals(contents)) {
            fetchSessionAndRequestData(server, tableHeader);
          } else if ("Wicket Sessies/Requests".equals(contents)) {
            fetchSessionAndRequestData(server, tableHeader);
          }
        }

        List<Element> tdHeaders = source
            .getAllElements(HTMLElementName.TD);
        for (Element td : tdHeaders) {
          String contents = td.getContent().toString();
          if ("Starttijd".equals(contents)) {
            getStartTime(server, td);
          }
        }
        server.setServerStatus(DotColor.GREEN);
        oldAlerts.put(statusUrl, null);
      } catch (Exception e) {
        server.setServerStatus(DotColor.YELLOW);
        Alert alert = new Alert(oldAlert, DotColor.YELLOW, project,
            e.getMessage());
        oldAlerts.put(statusUrl, alert);
        alerts.add(alert);
        log.warn("Could not retrieve status for '" + statusUrl + "': "
            + e.getClass().getSimpleName() + " - "
View Full Code Here

          return null;

        Random random = new Random();
        List<Alert> ret = new ArrayList<Alert>();
        for (int count = 0; count < random.nextInt(3); count++) {
          Alert alert = new Alert();
          alert.setProject(key);
          alert.setOverlayVisible(false);
          alert.setColor(DotColor.values()[random.nextInt(3)]);
          int minute = random.nextInt(60);
          alert.setTime(random.nextInt(24) + ":"
              + (minute < 10 ? "0" : "") + minute);
          alert.setMessage("random exception with long message");
          ret.add(alert);
        }
        Collections.sort(ret, new Comparator<Alert>() {
          @Override
          public int compare(Alert o1, Alert o2) {
View Full Code Here

TOP

Related Classes of nl.topicus.onderwijs.dashboard.datatypes.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.