示例#1
0
文件: BaseAlert.java 项目: nanin/cat
  private Alert buildAlert(
      String domainName, String metricTitle, String mailTitle, AlertResultEntity alertResult) {
    Alert alert = new Alert();

    alert.setDomain(domainName);
    alert.setAlertTime(alertResult.getAlertTime());
    alert.setCategory(getName());
    alert.setType(alertResult.getAlertType());
    alert.setContent(mailTitle + "<br/>" + alertResult.getContent());
    alert.setMetric(metricTitle);

    return alert;
  }
示例#2
0
文件: BaseAlert.java 项目: nanin/cat
  private void processMetricItem(int minute, ProductLine productLine, String metricKey) {
    for (MetricType type : MetricType.values()) {
      String productlineName = productLine.getId();
      AlertResultEntity alertResult = computeAlertInfo(minute, productlineName, metricKey, type);

      if (alertResult != null && alertResult.isTriggered()) {
        String metricTitle = buildMetricTitle(metricKey);
        String mailTitle = getAlertConfig().buildMailTitle(productLine.getTitle(), metricTitle);
        m_alertInfo.addAlertInfo(metricKey, new Date().getTime());

        storeAlert(productlineName, metricTitle, mailTitle, alertResult);
        sendAlertInfo(productLine, mailTitle, alertResult.getContent(), alertResult.getAlertType());
      }
    }
  }