Package com.dianping.cat.report.task.alert.sender

Examples of com.dianping.cat.report.task.alert.sender.AlertEntity


      for (AlertResultEntity alertResult : alertResults) {
        m_alertInfo.addAlertInfo(productlineName, metricKey, new Date().getTime());

        String metricName = buildMetricName(metricKey);
        AlertEntity entity = new AlertEntity();

        entity.setDate(alertResult.getAlertTime()).setContent(alertResult.getContent())
              .setLevel(alertResult.getAlertLevel());
        entity.setMetric(metricName).setType(getName()).setGroup(productlineName);

        m_sendManager.addAlert(entity);
      }
    }
  }
View Full Code Here


public class SuspendTest extends ComponentTestCase {

  @Test
  public void test() {
    AlertManager manager = lookup(AlertManager.class);
    AlertEntity entity = new AlertEntity();
    entity.setDate(new Date()).setContent("test").setLevel("error");
    entity.setMetric("testMetric").setType(AlertType.Network.getName()).setGroup("testGroup");

    try {
      manager.addAlert(entity);
      TimeUnit.SECONDS.sleep(1);
    } catch (Exception ex) {

    }

    Assert.assertTrue(manager.isSuspend(entity.getKey(), 1));
    try {
      TimeUnit.SECONDS.sleep(65);
    } catch (InterruptedException e) {
    }

    Assert.assertFalse(manager.isSuspend(entity.getKey(), 1));
  }
View Full Code Here

      List<Condition> conditions = resultPair.getValue();
      double[] baseline = new double[maxMinute];
      List<AlertResultEntity> alerts = m_dataChecker.checkData(values, baseline, conditions);

      for (AlertResultEntity alertResult : alerts) {
        AlertEntity entity = new AlertEntity();

        entity.setDate(alertResult.getAlertTime()).setContent(alertResult.getContent())
              .setLevel(alertResult.getAlertLevel());
        entity.setMetric(metric).setType(getName()).setGroup(domain);
        entity.getParas().put("ip", ip);
        m_sendManager.addAlert(entity);
      }
    } catch (Exception e) {
      Cat.logError(e);
    }
View Full Code Here

        Map<String, List<ThirdPartyAlertEntity>> domain2AlertMap = buildDomain2AlertMap(alertEntities);

        for (Entry<String, List<ThirdPartyAlertEntity>> entry : domain2AlertMap.entrySet()) {
          String domain = entry.getKey();
          List<ThirdPartyAlertEntity> thirdPartyAlerts = entry.getValue();
          AlertEntity entity = new AlertEntity();

          entity.setDate(new Date()).setContent(thirdPartyAlerts.toString()).setLevel(AlertLevel.WARNING);
          entity.setMetric(getName()).setType(getName()).setGroup(domain);

          m_sendManager.addAlert(entity);
        }
        t.setStatus(Transaction.SUCCESS);
      } catch (Exception e) {
View Full Code Here

      List<AlertResultEntity> alertResults = m_dataChecker.checkData(datas, checkedConditions);

      for (AlertResultEntity alertResult : alertResults) {
        Map<String, Object> par = new HashMap<String, Object>();
        par.put("name", name);
        AlertEntity entity = new AlertEntity();

        entity.setDate(alertResult.getAlertTime()).setContent(alertResult.getContent())
              .setLevel(alertResult.getAlertLevel());
        entity.setMetric(queryType(type)).setType(getName()).setGroup(queryCommand(command)).setParas(par);
        m_sendManager.addAlert(entity);
      }
    }
  }
View Full Code Here

      for (AlertResultEntity alertResult : alertResults) {
        Map<String, Object> par = new HashMap<String, Object>();
        par.put("type", queryType(type));
        par.put("name", name);
        AlertEntity entity = new AlertEntity();

        entity.setDate(alertResult.getAlertTime()).setContent(alertResult.getContent())
              .setLevel(alertResult.getAlertLevel());
        entity.setMetric(group).setType(getName()).setGroup(url).setParas(par);
        m_sendManager.addAlert(entity);
      }
    }
  }
View Full Code Here

      for (AlertResultEntity alertResult : alertResults) {
        m_alertInfo.addAlertInfo(product, metricKey, new Date().getTime());
        String metricName = buildMetricName(metricKey);

        AlertEntity entity = new AlertEntity();

        entity.setDate(alertResult.getAlertTime()).setContent(alertResult.getContent())
              .setLevel(alertResult.getAlertLevel());
        entity.setMetric(metricName).setType(getName()).setGroup(product);
        entity.getParas().put("domain", domain);

        m_sendManager.addAlert(entity);
      }
    }
  }
View Full Code Here

        String domain = entry.getKey();
        List<AlertException> exceptions = entry.getValue();

        for (AlertException exception : exceptions) {
          String metricName = exception.getName();
          AlertEntity entity = new AlertEntity();

          entity.setDate(new Date()).setContent(exception.toString()).setLevel(exception.getType());
          entity.setMetric(metricName).setType(getName()).setGroup(domain);
          m_sendManager.addAlert(entity);
        }
      } catch (Exception e) {
        Cat.logError(e);
      }
View Full Code Here

    List<AlertException> alertExceptions = m_alertBuilder.buildFrontEndAlertExceptions(frontEndItem);

    for (AlertException exception : alertExceptions) {
      try {
        String metricName = exception.getName();
        AlertEntity entity = new AlertEntity();

        entity.setDate(new Date()).setContent(exception.toString()).setLevel(exception.getType());
        entity.setMetric(metricName).setType(AlertType.FrontEndException.getName()).setGroup(metricName);
        m_sendManager.addAlert(entity);
      } catch (Exception e) {
        Cat.logError(e);
      }
    }
View Full Code Here

TOP

Related Classes of com.dianping.cat.report.task.alert.sender.AlertEntity

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.