예제 #1
0
 private static void updateDataSources(String rrdPath, Sampleable[] sampleables)
     throws IOException {
   for (Sampleable sampleable : sampleables) {
     LOG.warn("Updating RRDB structure, adding: " + sampleable.getName());
     RrdToolkit.addDatasource(rrdPath, createDsDef(sampleable), true);
   }
 }
예제 #2
0
 private static Sampleable[] checkDataSources(String rrdPath, Sampleable[] sampleables)
     throws IOException {
   RrdDb rrdDb = new RrdDb(rrdPath, true);
   List<Sampleable> missing = new ArrayList<Sampleable>();
   for (Sampleable sampleable : sampleables) {
     if (rrdDb.getDatasource(sampleable.getName()) == null) {
       missing.add(sampleable);
     }
   }
   rrdDb.close();
   return missing.toArray(new Sampleable[missing.size()]);
 }
예제 #3
0
 private static DsDef createDsDef(Sampleable sampleable) {
   return new DsDef(sampleable.getName(), sampleable.getType(), 120 * STEP_SIZE, NaN, NaN);
 }