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); } }
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()]); }
private static DsDef createDsDef(Sampleable sampleable) { return new DsDef(sampleable.getName(), sampleable.getType(), 120 * STEP_SIZE, NaN, NaN); }