public rrd4n.DataAccess.Data.FetchData GetData(rrd4n.DataAccess.Data.FetchRequest request) { RrdDb rrdDb = null; try { string dataPath; if (DataPath.Contains("${APPDATA}")) { dataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); dataPath += DataPath.Substring(10); } else dataPath = DataPath; rrdDb = new RrdDb(dataPath + request.DatabasePath); FetchRequest coreRequest = new FetchRequest(rrdDb.getPath(), request.ConsolidateFunctionName, request.FetchStart, request.FetchEnd, request.Resolution); FetchData coreFetchData = rrdDb.fetchData(coreRequest); return new rrd4n.DataAccess.Data.FetchData(coreFetchData.getArcStep(), coreFetchData.getArcEndTime(), coreFetchData.getDsNames()) { Values = coreFetchData.getValues(), Timestamps = coreFetchData.getTimestamps() }; } finally { if (rrdDb != null) rrdDb.close(); } }
public rrd4n.DataAccess.Data.FetchData GetData(rrd4n.DataAccess.Data.FetchRequest request) { RrdServerInterface remoteAccessor = GetServerAccessor(); RemoteFetchData remoteData = remoteAccessor.FetchData(request.DatabasePath, request.FetchStart, request.FetchEnd, request.ConsolidateFunctionName, request.Resolution); rrd4n.DataAccess.Data.FetchData localData = new rrd4n.DataAccess.Data.FetchData(remoteData.ArchiveSteps, remoteData.ArchiveEndTimeTicks, remoteData.DatasourceNames); localData.Timestamps = remoteData.Timestamps; localData.Values = remoteData.Values; return localData; }
public void StoreData(rrd4n.DataAccess.Data.Sample sample) { RrdDb rrdDb = null; try { rrdDb = new RrdDb(DataPath + sample.DatabasePath, false); Sample coreSample = new Sample(rrdDb.getPath(),rrdDb.getDsNames(), sample.Time); coreSample.setValues(sample.Values); rrdDb.store(coreSample); } finally { if (rrdDb != null) rrdDb.close(); } }
/** * Creates a new (plottable) datasource. Datasource values are obtained from the given plottable * object. * * @param name Source name. * @param plottable Plottable object. */ public void datasource(String name, rrd4n.Data.Plottable plottable) { sources.Add(new PDef(name, plottable)); }
public void StoreData(rrd4n.DataAccess.Data.Sample sample) { RrdServerInterface remoteAccessor = GetServerAccessor(); remoteAccessor.StoreData(sample.DatabasePath, sample.getTime(), sample.getValues()); }