/** * Sets datasource heartbeat to a new value. * * @param sourcePath Path to exisiting RRD file (will be updated) * @param datasourceName Name of the datasource in the specified RRD file * @param newHeartbeat New datasource heartbeat * @throws IOException Thrown in case of I/O error */ public static void setDsHeartbeat(String sourcePath, String datasourceName, long newHeartbeat) throws IOException { RrdDb rrd = new RrdDb(sourcePath); try { Datasource ds = rrd.getDatasource(datasourceName); ds.setHeartbeat(newHeartbeat); } finally { rrd.close(); } }
/** * Sets datasource heartbeat to a new value. * * @param sourcePath Path to exisiting RRD file (will be updated) * @param dsIndex Index of the datasource in the specified RRD file * @param newHeartbeat New datasource heartbeat * @throws IOException Thrown in case of I/O error */ public static void setDsHeartbeat(String sourcePath, int dsIndex, long newHeartbeat) throws IOException { RrdDb rrd = new RrdDb(sourcePath); try { Datasource ds = rrd.getDatasource(dsIndex); ds.setHeartbeat(newHeartbeat); } finally { rrd.close(); } }
/** * Sets datasource heartbeat to a new value. * * @param sourcePath Path to existing RRD file (will be updated) * @param datasourceName Name of the datasource in the specified RRD file * @param newHeartbeat New datasource heartbeat * @throws java.io.IOException Thrown in case of I/O error */ public static void setDsHeartbeat(String sourcePath, String datasourceName, long newHeartbeat) throws IOException { try (RrdDb rrd = RrdDb.getBuilder().setPath(sourcePath).build()) { Datasource ds = rrd.getDatasource(datasourceName); ds.setHeartbeat(newHeartbeat); } }
/** * Sets datasource heartbeat to a new value. * * @param sourcePath Path to existing RRD file (will be updated) * @param dsIndex Index of the datasource in the specified RRD file * @param newHeartbeat New datasource heartbeat * @throws java.io.IOException Thrown in case of I/O error */ public static void setDsHeartbeat(String sourcePath, int dsIndex, long newHeartbeat) throws IOException { try (RrdDb rrd = RrdDb.getBuilder().setPath(sourcePath).build()) { Datasource ds = rrd.getDatasource(dsIndex); ds.setHeartbeat(newHeartbeat); } }