本文整理汇总了Java中org.jrobin.core.FetchData类的典型用法代码示例。如果您正苦于以下问题:Java FetchData类的具体用法?Java FetchData怎么用?Java FetchData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FetchData类属于org.jrobin.core包,在下文中一共展示了FetchData类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: replaceInDs
import org.jrobin.core.FetchData; //导入依赖的package包/类
private static void replaceInDs(Archive arc, FetchData data, String dsName) {
printToUser(" Operating on DS " + dsName);
double[] origValues = null;
try {
origValues = data.getValues(dsName);
} catch (RrdException e) {
System.out.println("RRD Exception trying to get values from RRD file: " + e.getMessage());
System.exit(-1);
}
DataAnalyzer analyzer = getDataAnalyzer();
analyzer.setVerbose(m_verbose);
List<Integer> violatorIndices = analyzer.findSamplesInViolation(origValues);
if (m_verbose) {
printToUser(" Number of values: " + origValues.length);
printToUser(" Data analyzer: " + analyzer);
printToUser(" Samples found in violation: " + violatorIndices.size());
}
DataReplacer replacer = getDataReplacer();
double[] newValues = replacer.replaceValues(origValues, violatorIndices);
printReplacementsToUser(data, dsName, newValues, violatorIndices);
if (!m_dryRun) {
replaceInFile(arc, data, dsName, newValues, violatorIndices);
}
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:25,代码来源:SpikeHunter.java
示例2: replaceInFile
import org.jrobin.core.FetchData; //导入依赖的package包/类
private static void replaceInFile(Archive arc, FetchData data, String dsName, double[] newValues, List<Integer> violatorIndices) {
Robin robin = null;
try {
robin = arc.getRobin(m_rrdFile.getDsIndex(dsName));
} catch (RrdException rrde) {
System.out.println("RRD Exception trying to retrieve Robin from RRD file: " + rrde.getMessage());
System.exit(-1);
} catch (IOException ioe) {
System.out.println("RRD Exception trying to retrieve Robin from RRD file: " + ioe.getMessage());
System.exit(-1);
}
//m_rrdFile.getArchive(int arcIndex)
//m_rrdFile.getArchive(String consolFun, int steps)
for (int i : violatorIndices) {
try {
robin.setValue(i, newValues[i]);
} catch (IOException e) {
System.out.println("IO Exception trying to set value for index " + i + " to " + newValues[i]);
}
}
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:22,代码来源:SpikeHunter.java
示例3: replaceInArchive
import org.jrobin.core.FetchData; //导入依赖的package包/类
private static void replaceInArchive(org.jrobin.core.Archive arc) {
String consolFun = "";
int arcSteps = 0;
long startTime = 0;
long endTime = 0;
FetchData data = null;
Robin robin = null;
try {
consolFun = arc.getConsolFun();
arcSteps = arc.getSteps();
startTime = arc.getStartTime();
endTime = arc.getEndTime();
} catch (IOException e) {
System.out.println("IO Exception trying to get archive information from RRD file: " + e.getMessage());
System.exit(-1);
}
printToUser("Operating on archive with CF " + consolFun + ", " + arcSteps + " steps");
try {
data = m_rrdFile.createFetchRequest(consolFun, startTime, endTime).fetchData();
} catch (RrdException rrde) {
System.out.println("RRD Exception trying to create fetch request: " + rrde.getMessage());
System.exit(-1);
} catch (IOException ioe) {
System.out.println("IO Exception trying to create fetch request: " + ioe.getMessage());
System.exit(-1);
}
String[] dsNames;
if (m_dsNames == null) {
dsNames = data.getDsNames();
} else {
dsNames = m_dsNames.split(",");
}
for (String dsName : dsNames) {
replaceInDs(arc, data, dsName);
}
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:40,代码来源:SpikeHunter.java
示例4: printReplacementsToUser
import org.jrobin.core.FetchData; //导入依赖的package包/类
private static void printReplacementsToUser(FetchData data, String dsName, double[] newValues, List<Integer> violatorIndices) {
long timestamps[] = data.getTimestamps();
double origValues[] = null;
try {
origValues = data.getValues(dsName);
} catch (RrdException e) {
System.out.println("RRD Exception trying to get values from RRD file: " + e.getMessage());
}
for (int i : violatorIndices) {
Date sampleDate = new Date(timestamps[i] * 1000);
printToUser(" Sample with timestamp " + sampleDate + " and value " + origValues[i] + " replaced by value " + newValues[i]);
}
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:14,代码来源:SpikeHunter.java
示例5: testFetch
import org.jrobin.core.FetchData; //导入依赖的package包/类
@Test
public void testFetch() throws Exception {
createMockSineRrds(null);
RrdDb rrd = new RrdDb(m_sineFull);
final long endTime = rrd.getLastArchiveUpdateTime();
final long startTime = endTime - (60L * 60L * 24L * 365L);
final FetchData fd = rrd.createFetchRequest("AVERAGE", startTime, endTime, 300).fetchData();
double[] values = fd.getValues("a");
assertEquals(367, values.length);
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:11,代码来源:JRobinConverterTest.java
示例6: fetchRrdData
import org.jrobin.core.FetchData; //导入依赖的package包/类
/**
*
*/
private void fetchRrdData(String rootPath, String rrdName) {
try {
// open the file
RrdDb rrd = new RrdDb(rootPath + rrdName);
// create fetch request using the database reference
FetchRequest request = rrd.createFetchRequest("AVERAGE", Util
.getTimestamp(2010, 10 - 1, 1), Util.getTimestamp(2010,
10 - 1, 2));
System.out.println("[requet dump:]" + request.dump());
// filter the datasources you really need
// String[] filterDataSource = { "input", "output" };
// request.setFilter(filterDataSource);
// if you want only the "input" datasource use:
// request.setFilter("input");
// execute the request
FetchData fetchData = request.fetchData();
int columnCount = fetchData.getColumnCount();
int rowCount = fetchData.getRowCount();
long[] timestamps = fetchData.getTimestamps();
System.out.println("[data column count:]" + columnCount);
System.out.println("[data row count:]" + rowCount);
// System.out.println("[fetch data dump:]" + fetchData.dump());
// 循环获取数据
double[][] values = fetchData.getValues();
StringBuffer buffer = new StringBuffer("");
for (int row = 0; row < rowCount; row++) {
buffer.append(timestamps[row]);
buffer.append(": ");
for (int dsIndex = 0; dsIndex < columnCount; dsIndex++) {
buffer.append(Util.formatDouble(values[dsIndex][row]));
buffer.append(" ");
}
buffer.append("\n");
}
System.out.println("[fetch data display :]\n" + buffer);
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:micmiu,项目名称:snmp-tutorial,代码行数:50,代码来源:TestCoreRrd.java
示例7: Def
import org.jrobin.core.FetchData; //导入依赖的package包/类
Def(String name, FetchData fetchData) {
this(name, null, name, null, null);
setFetchData(fetchData);
}
开发者ID:OpenNMS,项目名称:jrobin,代码行数:5,代码来源:Def.java
示例8: setFetchData
import org.jrobin.core.FetchData; //导入依赖的package包/类
void setFetchData(FetchData fetchData) {
this.fetchData = fetchData;
}
开发者ID:OpenNMS,项目名称:jrobin,代码行数:4,代码来源:Def.java
注:本文中的org.jrobin.core.FetchData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论