Package com.dianping.cat.home.nettopo.entity

Examples of com.dianping.cat.home.nettopo.entity.NetGraphSet


      MetricReport report = m_reportService.queryMetricReport(group, period, end);

      reports.put(group, report);
    }

    NetGraphSet netGraphSet = m_netGraphBuilder
          .buildGraphSet(netGraphTemplate, reports, new ArrayList<AlertMetric>());
    HourlyReport hourlyReport = new HourlyReport();

    hourlyReport.setType(1);
    hourlyReport.setName(name);
View Full Code Here


public class NetTopologyReportService extends AbstractReportService<NetGraphSet> {

  @Override
  public NetGraphSet makeReport(String domain, Date start, Date end) {
    NetGraphSet report = new NetGraphSet();

    return report;
  }
View Full Code Here

  @Override
  public NetGraphSet queryHourlyReport(String domain, Date start, Date end) {
    long startTime = start.getTime();
    String name = Constants.REPORT_NET_TOPOLOGY;
    NetGraphSet netGraphSet = null;
    List<HourlyReport> reports = null;

    try {
      reports = m_hourlyReportDao.findAllByDomainNamePeriod(new Date(startTime), domain, name,
            HourlyReportEntity.READSET_FULL);
View Full Code Here

    } catch (Exception e) {
      Cat.logError(e);
    }
   
    if (m_config == null) {
      m_config = new NetGraphSet();
    }
  }
View Full Code Here

@RunWith(JUnit4.class)
public class NetTopoModelTest {

  @Test
  public void test() throws Exception {
    NetGraphSet netGraphSet = new NetGraphSet();
    NetGraph netGraph = new NetGraph();
    netGraphSet.getNetGraphs().put(0, netGraph);
    netGraph = new NetGraph();
    netGraph.setMinute(1);
    netGraphSet.getNetGraphs().put(1, netGraph);
    System.out.println("0:"+netGraphSet.getNetGraphs().get(0));
    System.out.println("1:"+netGraphSet.getNetGraphs().get(1));
    DefaultXmlBuilder defaultXmlBuilder = new DefaultXmlBuilder();
    System.out.println(netGraphSet);
    String content = defaultXmlBuilder.buildXml(netGraphSet);
    System.out.println(content);
    NetGraphSet nGS = DefaultSaxParser.parse(content);
    System.out.println(nGS);
  }
View Full Code Here

    JsonBuilder jb = new JsonBuilder();
    List<Pair<String, String>> netGraphData = new ArrayList<Pair<String, String>>();
    long current = System.currentTimeMillis();
    long currentHours = current - current % TimeHelper.ONE_HOUR;
    long startTime = start.getTime();
    NetGraphSet netGraphSet = null;

    if (startTime >= currentHours) {
      netGraphSet = m_currentNetGraphSet;
    } else if (startTime == currentHours - TimeHelper.ONE_HOUR) {
      netGraphSet = m_lastNetGraphSet;
    } else {
      netGraphSet = m_reportService.queryNetTopologyReport(Constants.CAT, start, new Date(start.getTime()
            + TimeHelper.ONE_HOUR));
    }

    if (netGraphSet != null) {
      NetGraph netGraph = netGraphSet.findNetGraph(minute);

      if (netGraph != null) {
        for (NetTopology netTopology : netGraph.getNetTopologies()) {
          String topoName = netTopology.getName();
          String data = jb.toJson(netTopology);
View Full Code Here

  private static final int ERROR = 3;

  public NetGraphSet buildGraphSet(NetGraph netGraphTemplate, Map<String, MetricReport> reports,
        List<AlertMetric> alertKeys) {
    NetGraphSet netGraphSet = new NetGraphSet();

    for (int minute = 0; minute <= 59; minute++) {
      NetGraph netGraph = copyBaseInfoFromTemplate(netGraphTemplate);

      for (NetTopology netTopology : netGraph.getNetTopologies()) {
        List<String> alertSwitchs = new ArrayList<String>();

        for (Connection connection : netTopology.getConnections()) {
          try {
            buildConnectionInfo(reports, alertKeys, minute, alertSwitchs, connection);
          } catch (Exception e) {
            Cat.logError(e);
          }
        }

        for (Switch sw : netTopology.getSwitchs()) {
          if (alertSwitchs.contains(sw.getName())) {
            sw.setState(ERROR);
          }
        }
      }
      netGraph.setMinute(minute);
      netGraphSet.addNetGraph(netGraph);
    }

    return netGraphSet;
  }
View Full Code Here

TOP

Related Classes of com.dianping.cat.home.nettopo.entity.NetGraphSet

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.