public void start(String[] args) throws Exception {

    PropertiesManager pm = new PropertiesManager(new File(propFile));
    // jrds.JrdsLoggerConfiguration.configure(pm);

    System.getProperties().setProperty("java.awt.headless", "true");
    System.getProperties().putAll(pm);
    StoreOpener.prepare(pm.rrdbackend, pm.dbPoolSize);

    HostsList hl = new HostsList(pm);

    logger.debug("Scanning dir");

    for (Timer t : hl.getTimers()) {
      t.collectAll();
    }
    StoreOpener.stop();
  }
Exemple #2
0
  @Override
  public boolean generate(JrdsJSONWriter w, HostsList root, ParamsBean params)
      throws IOException, JSONException {

    if (params.getPeriod() == null) {
      return false;
    }

    List<GraphNode> graphs = params.getGraphs(this);
    if (params.isSorted() && graphs.size() > 1) {
      Collections.sort(
          graphs,
          new Comparator<GraphNode>() {
            public int compare(GraphNode g1, GraphNode g2) {
              int order = String.CASE_INSENSITIVE_ORDER.compare(g1.getName(), g2.getName());
              if (order == 0)
                order =
                    String.CASE_INSENSITIVE_ORDER.compare(
                        g1.getProbe().getHost().getName(), g2.getProbe().getHost().getName());
              return order;
            }
          });
    }
    logger.debug(jrds.Util.delayedFormatString("Graphs returned: %s", graphs));
    if (!graphs.isEmpty()) {
      Renderer r = root.getRenderer();
      for (GraphNode gn : graphs) {
        if (!gn.getACL().check(params)) continue;
        if (params.isHistory()) {
          for (int p : periodHistory) {
            params.setScale(p);
            doGraph(gn, r, params, w);
          }
        } else {
          doGraph(gn, r, params, w);
        }
      }
    }
    return true;
  }