本文整理汇总了Java中org.rrd4j.graph.RrdGraphDef类的典型用法代码示例。如果您正苦于以下问题:Java RrdGraphDef类的具体用法?Java RrdGraphDef怎么用?Java RrdGraphDef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RrdGraphDef类属于org.rrd4j.graph包,在下文中一共展示了RrdGraphDef类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createMoodleDiskWaitGraph
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
private static final void createMoodleDiskWaitGraph(String graphLocation,
String rrdDBLocation) {
try {
RrdGraphDef waitGraphDef = new RrdGraphDef();
waitGraphDef.setTimeSpan(-3600L, -0L);
waitGraphDef.datasource("linea", rrdDBLocation, "a", ConsolFun.TOTAL);
waitGraphDef.datasource("lineb", rrdDBLocation, "b", ConsolFun.TOTAL);
waitGraphDef.line("linea", Color.GREEN, "Average Wait", 3);
waitGraphDef.line("lineb", Color.BLUE, "Service Wait", 3);
waitGraphDef.setFilename(graphLocation);
waitGraphDef.setMaxValue(10);
RrdGraph waitGraph = new RrdGraph(waitGraphDef);//actually creates the graph for wait.
} catch (IOException e) {
System.out.println(e);
}
}
开发者ID:AdamHansrod,项目名称:Graphr,代码行数:17,代码来源:RRD.java
示例2: generateGraph
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
private void generateGraph(RrdDb rrdDb) throws IOException {
RrdGraphDef gDef = new RrdGraphDef();
gDef.setWidth(500);
gDef.setHeight(300);
gDef.setFilename(name + ".png");
gDef.setStartTime(startTime);
gDef.setEndTime(rrdDb.getLastUpdateTime());
gDef.setTitle(name);
gDef.setVerticalLabel(physicalQuantity.getUnit());
gDef.datasource(physicalQuantity.toString(), rrdPath, name, ConsolFun.MAX);
gDef.line(physicalQuantity.toString(), Color.RED, physicalQuantity.toString() + " max");
gDef.setImageFormat("png");
graph = new RrdGraph(gDef);
}
开发者ID:SebiGo,项目名称:BrewControlServer,代码行数:15,代码来源:RRD.java
示例3: nodeDispatcherStatsGraph
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/node_dsp.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] nodeDispatcherStatsGraph() throws IOException {
final String path = rrdPath(PLOW_RRD);
final RrdGraphDef graphDef = baseGraph("Node Dispatcher Traffic", "dps/sec");
graphDef.datasource("linea", path, "nodeDispatchHit", ConsolFun.AVERAGE);
graphDef.datasource("lineb", path, "nodeDispatchMiss", ConsolFun.AVERAGE);
graphDef.datasource("linec", path, "nodeDispatchFail", ConsolFun.AVERAGE);
graphDef.area("linea", new Color(152, 175, 54), "Hit");
graphDef.area("lineb", new Color(74, 104, 15), "Miss");
graphDef.area("linec", new Color(164, 11, 23), "Error");
return createImage(graphDef);
}
开发者ID:chadmv,项目名称:plow,代码行数:17,代码来源:RrdGraphController.java
示例4: procDispatcherStatsGraph
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/proc_dsp.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] procDispatcherStatsGraph() throws IOException {
final String path = rrdPath(PLOW_RRD);
final RrdGraphDef graphDef = baseGraph("Proc Dispatcher Traffic", "dps/sec");
graphDef.datasource("linea", path, "procDispatchHit", ConsolFun.AVERAGE);
graphDef.datasource("lineb", path, "procDispatchMiss", ConsolFun.AVERAGE);
graphDef.datasource("linec", path, "procDispatchFail", ConsolFun.AVERAGE);
graphDef.area("linea", new Color(152, 175, 54), "Hit");
graphDef.area("lineb", new Color(74, 104, 15), "Miss");
graphDef.area("linec", new Color(164, 11, 23), "Error");
return createImage(graphDef);
}
开发者ID:chadmv,项目名称:plow,代码行数:17,代码来源:RrdGraphController.java
示例5: taskCountsGraph
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/task_exec.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] taskCountsGraph() throws IOException {
final String path = rrdPath(PLOW_RRD);
final RrdGraphDef graphDef = baseGraph("Task Executions", "task/sec");
graphDef.datasource("linea", path, "taskStartedCount", ConsolFun.AVERAGE);
graphDef.datasource("lineb", path, "taskStartedFailCount", ConsolFun.AVERAGE);
graphDef.datasource("linec", path, "taskStoppedCount", ConsolFun.AVERAGE);
graphDef.datasource("lined", path, "taskStoppedFailCount", ConsolFun.AVERAGE);
graphDef.area("linea", new Color(8, 175, 193), "Started");
graphDef.stack("linec", new Color(133, 225, 224), "Stopped");
graphDef.line("lineb", new Color(243, 165, 41), "Error Started", 2);
graphDef.line("lined", new Color(241, 93, 5), "Error Stopped", 2);
return createImage(graphDef);
}
开发者ID:chadmv,项目名称:plow,代码行数:19,代码来源:RrdGraphController.java
示例6: jobLaunchGraph
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/job_launch.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] jobLaunchGraph() throws IOException {
final String path = rrdPath(PLOW_RRD);
final RrdGraphDef graphDef = baseGraph("Job Launch", "jobs/sec");
graphDef.datasource("linea", path, "jobLaunchCount", ConsolFun.AVERAGE);
graphDef.datasource("lineb", path, "jobLaunchFailCount", ConsolFun.AVERAGE);
graphDef.datasource("linec", path, "jobFinishCount", ConsolFun.AVERAGE);
graphDef.datasource("lined", path, "jobKillCount", ConsolFun.AVERAGE);
graphDef.area("linea", new Color(8, 175, 193), "Launched");
graphDef.stack("linec", new Color(133, 225, 224), "Finished");
graphDef.line("lineb", new Color(241, 93, 5), "Launch Fail", 2);
graphDef.line("lined", new Color(243, 165, 41), "Jobs Killed", 2);
return createImage(graphDef);
}
开发者ID:chadmv,项目名称:plow,代码行数:19,代码来源:RrdGraphController.java
示例7: rndTrafficGraph
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/rnd_traffic.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] rndTrafficGraph() throws IOException {
final String path = rrdPath(PLOW_RRD);
final RrdGraphDef graphDef = baseGraph("Rnd Traffic", "ops/sec");
graphDef.datasource("ping", path, "rndPingCount", ConsolFun.AVERAGE);
graphDef.datasource("task", path, "rndTaskComplete", ConsolFun.AVERAGE);
graphDef.area("ping", new Color(179, 96, 157), "Ping");
graphDef.stack("task", new Color(255, 163, 231), "Task Complete");
graphDef.comment("\\r");
graphDef.gprint("ping", MAX, "Max Pings = %.3f%S");
graphDef.gprint("ping", AVERAGE, "Avg Pings = %.3f%S\n");
graphDef.gprint("task", MAX, "Max Task Complate = %.3f%s");
graphDef.gprint("task", AVERAGE, "Avg Task Complete = %.3f%S\n");
return createImage(graphDef);
}
开发者ID:chadmv,项目名称:plow,代码行数:23,代码来源:RrdGraphController.java
示例8: nodeDispatcherThreads
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/node_threads.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] nodeDispatcherThreads() throws IOException {
final String path = rrdPath(THREAD_RRD);
final RrdGraphDef graphDef = baseGraph("Node Dispatcher Queue", "threads/sec");
graphDef.datasource("threads", path, "nodeActiveThreads", ConsolFun.AVERAGE);
graphDef.datasource("queue", path, "nodeWaiting", ConsolFun.AVERAGE);
graphDef.line("threads", new Color(152, 175, 54), "Active Threads");
graphDef.area("queue", new Color(74, 104, 15), "Queued Work");
graphDef.comment("\\r");
graphDef.gprint("threads", MAX, "Max Threads = %.3f%S");
graphDef.gprint("threads", AVERAGE, "Avg Threads = %.3f%S\n");
graphDef.gprint("queue", MAX, "Max Queued = %.3f%s");
graphDef.gprint("queue", AVERAGE, "Avg Queued = %.3f%S\n");
return createImage(graphDef);
}
开发者ID:chadmv,项目名称:plow,代码行数:24,代码来源:RrdGraphController.java
示例9: createImage
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
private byte[] createImage(RrdGraphDef graphDef) throws IOException {
RrdGraph graph = new RrdGraph(graphDef);
BufferedImage bim = new BufferedImage(graph.getRrdGraphInfo().getWidth(),
graph.getRrdGraphInfo().getHeight(), BufferedImage.TYPE_INT_RGB);
graph.render(bim.getGraphics());
ByteArrayOutputStream baos = null;
try {
baos = new ByteArrayOutputStream();
ImageIO.write(bim, "png", baos);
baos.flush();
return baos.toByteArray();
} finally {
if (baos != null) {
baos.close();
}
}
}
开发者ID:chadmv,项目名称:plow,代码行数:19,代码来源:RrdGraphController.java
示例10: baseGraph
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
private RrdGraphDef baseGraph(String title, String vertLabel) {
final long now = System.currentTimeMillis() / 1000;
RrdGraphDef graphDef = new RrdGraphDef();
graphDef.setTimeSpan(now - 3600 , now);
graphDef.setTitle(title);
graphDef.setVerticalLabel(vertLabel);
graphDef.setImageFormat("png");
graphDef.setWidth(800);
graphDef.setHeight(150);
graphDef.setAntiAliasing(true);
graphDef.setTextAntiAliasing(true);
graphDef.setColor(RrdGraphConstants.COLOR_BACK, new Color(44, 44, 44));
graphDef.setColor(RrdGraphConstants.COLOR_FONT, new Color(240, 240, 240));
graphDef.setColor(RrdGraphConstants.COLOR_FRAME, new Color(55, 55, 55));
graphDef.setColor(RrdGraphConstants.COLOR_CANVAS, new Color(55, 55, 55));
graphDef.setColor(RrdGraphConstants.COLOR_GRID, new Color(82, 82, 82, 155));
graphDef.setColor(RrdGraphConstants.COLOR_SHADEA, new Color(44, 44, 44));
graphDef.setColor(RrdGraphConstants.COLOR_SHADEB, new Color(44, 44, 44));
graphDef.setGridStroke(dottedStroke);
return graphDef;
}
开发者ID:chadmv,项目名称:plow,代码行数:22,代码来源:RrdGraphController.java
示例11: run
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
@Override
public void run() {
try {
// generate PNG diagram
RrdGraphDef gDef = new RrdGraphDef();
gDef.setFilename("-");
gDef.setWidth(800);
gDef.setHeight(600);
gDef.setStartTime(start / 1000);
gDef.setEndTime(System.currentTimeMillis() / 1000);
gDef.setTitle("KiWiLoader Performance");
gDef.setVerticalLabel("number/sec");
gDef.setAntiAliasing(true);
gDef.datasource("triples", statFile.toString(), "triples", ConsolFun.AVERAGE);
gDef.line("triples", Color.BLUE, "Triples Written", 3F);
gDef.setImageFormat("png");
gDef.gprint("triples", ConsolFun.AVERAGE, "average triples/sec: %,.0f\\l");
RrdGraph graph = new RrdGraph(gDef);
BufferedImage img = new BufferedImage(900,750, BufferedImage.TYPE_INT_RGB);
graph.render(img.getGraphics());
try (OutputStream stream = Files.newOutputStream(gFile, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE)) {
ImageIO.write(img, "png", stream);
}
log.info("updated statistics diagram generated in {}", gFile);
statLastDump = System.currentTimeMillis();
} catch (Exception ex) {
log.warn("error creating statistics diagram: {}", ex.getMessage());
}
}
开发者ID:apache,项目名称:marmotta,代码行数:39,代码来源:Statistics.java
示例12: createMoodleGraph
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
private static final void createMoodleGraph(String graphLocation,
String rrdDBLocation) {
try {
RrdGraphDef graphDef = new RrdGraphDef();
graphDef.setTimeSpan(-3600L, -0L);
graphDef.datasource("lineb", rrdDBLocation, "users", ConsolFun.TOTAL);
graphDef.line("lineb", Color.GREEN, "Number of Moodle Users", 3);
graphDef.setFilename(graphLocation);
RrdGraph graph = new RrdGraph(graphDef);//actually creates the file.
} catch (IOException e) {
System.out.println(e);
}
}
开发者ID:AdamHansrod,项目名称:Graphr,代码行数:14,代码来源:RRD.java
示例13: createSREventCountGraph
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
private static final void createSREventCountGraph(String graphLocation,
String rrdDBLocation) {
try {
RrdGraphDef graphDef = new RrdGraphDef();
graphDef.setTimeSpan(-3600L, -0L);
graphDef.datasource("lineb", rrdDBLocation, "eventcount", ConsolFun.TOTAL);
graphDef.line("lineb", Color.GREEN, "Event Count", 3);
graphDef.setFilename(graphLocation);
RrdGraph graph = new RrdGraph(graphDef);//actually creates the file.
} catch (IOException e) {
System.out.println(e);
}
}
开发者ID:AdamHansrod,项目名称:Graphr,代码行数:14,代码来源:RRD.java
示例14: createMoodleDiskUtilisationGraph
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
private static final void createMoodleDiskUtilisationGraph(String graphLocation,
String rrdDBLocation) {
try {
RrdGraphDef utilisationGraphDef = new RrdGraphDef();
utilisationGraphDef.setTimeSpan(-3600L, -0L);
utilisationGraphDef.datasource("linea", rrdDBLocation, "a", ConsolFun.TOTAL);
utilisationGraphDef.line("linea", Color.RED, "Utilisation", 3);
utilisationGraphDef.setFilename(graphLocation);
RrdGraph utilisationGraph = new RrdGraph(utilisationGraphDef);//actually creates the graph for utilisation.
} catch (IOException e) {
System.out.println(e);
}
}
开发者ID:AdamHansrod,项目名称:Graphr,代码行数:14,代码来源:RRD.java
示例15: render
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
public void render() {
try {
flushRdd();
// then create a graph definition
RrdGraphDef gDef = new RrdGraphDef();
gDef.setWidth(800);
gDef.setHeight(600);
gDef.setFilename("/tmp/sample.png");
gDef.setStartTime((System.currentTimeMillis()/1000) - (500));
gDef.setEndTime(System.currentTimeMillis()/1000);
gDef.setTitle("My Title");
gDef.setVerticalLabel("bytes");
gDef.datasource("speed", "/tmp/test.rrd", "speed", AVERAGE);
gDef.datasource("batteryPercent", "/tmp/test.rrd", "batteryPercent", AVERAGE);
gDef.datasource("power", "/tmp/test.rrd", "power", AVERAGE);
gDef.datasource("estRange", "/tmp/test.rrd", "estRange", AVERAGE);
gDef.line("speed", Color.GREEN, "speed mph");
gDef.line("batteryPercent", Color.MAGENTA, "batteryPercent");
gDef.area("power", Color.YELLOW, "power");
gDef.line("estRange", Color.RED, null);
gDef.comment("\\r");
Variable speedmax = new Variable.MAX();
Variable powermax = new Variable.MAX();
gDef.datasource("speedmax", "speed", speedmax);
gDef.datasource("powermax", "power", powermax);
gDef.gprint("speedmax", "speedmax = %.3f%s");
gDef.gprint("powermax", "powermax = %.3f%S\\c");
gDef.setImageFormat("png");
RrdGraph graph = new RrdGraph(gDef);
LOGGER.info("render: graphInfo[{}]", graph.getRrdGraphInfo().dump());
} catch (IOException ex) {
LOGGER.error("render: Error rendering graph.", ex);
}
}
开发者ID:avirtuos,项目名称:teslog,代码行数:44,代码来源:RrdTelemetryStore.java
示例16: addLine
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
/**
* Adds a line for the item to the graph definition.
* The color of the line is determined by the counter, it simply picks the according index from LINECOLORS (and rolls over if necessary).
*
* @param graphDef the graph definition to fill
* @param item the item to add a line for
* @param counter defines the number of the datasource and is used to determine the line color
*/
protected void addLine(RrdGraphDef graphDef, Item item, int counter) {
Color color = LINECOLORS[counter%LINECOLORS.length];
String label = itemUIRegistry.getLabel(item.getName());
String rrdName = RRD4jService.DB_FOLDER + File.separator + item.getName() + ".rrd";
ConsolFun consolFun;
if(label!=null && label.contains("[") && label.contains("]")) {
label = label.substring(0, label.indexOf('['));
}
try {
RrdDb db = new RrdDb(rrdName);
consolFun = db.getRrdDef().getArcDefs()[0].getConsolFun();
db.close();
} catch (IOException e) {
consolFun = ConsolFun.MAX;
}
if(item instanceof NumberItem) {
// we only draw a line
graphDef.datasource(Integer.toString(counter), rrdName, "state", consolFun); //RRD4jService.getConsolidationFunction(item));
graphDef.line(Integer.toString(counter), color, label, 2);
} else {
// we draw a line and fill the area beneath it with a transparent color
graphDef.datasource(Integer.toString(counter), rrdName, "state", consolFun); //RRD4jService.getConsolidationFunction(item));
Color areaColor = AREACOLORS[counter%LINECOLORS.length];
graphDef.area(Integer.toString(counter), areaColor);
graphDef.line(Integer.toString(counter), color, label, 2);
}
}
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:37,代码来源:RRD4jChartServlet.java
示例17: procDispatcherThreads
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/proc_threads.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] procDispatcherThreads() throws IOException {
final String path = rrdPath(THREAD_RRD);
final RrdGraphDef graphDef = baseGraph("Proc Dispatcher Queue", "threads/sec");
graphDef.datasource("linea", path, "procActiveThreads", ConsolFun.AVERAGE);
graphDef.datasource("lineb", path, "procWaiting", ConsolFun.AVERAGE);
graphDef.area("lineb", new Color(74, 104, 15), "Queued Work");
graphDef.line("linea", new Color(152, 175, 54), "Active Threads");
return createImage(graphDef);
}
开发者ID:chadmv,项目名称:plow,代码行数:15,代码来源:RrdGraphController.java
示例18: asyncWorkQueueThreads
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/async_threads.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] asyncWorkQueueThreads() throws IOException {
final String path = rrdPath(THREAD_RRD);
final RrdGraphDef graphDef = baseGraph("Async Work Queue", "threads/sec");
graphDef.datasource("linea", path, "asyncActiveThreads", ConsolFun.AVERAGE);
graphDef.datasource("lineb", path, "asyncWaiting", ConsolFun.AVERAGE);
graphDef.area("lineb", new Color(74, 104, 15), "Queued Work");
graphDef.line("linea", new Color(152, 175, 54), "Active Threads");
return createImage(graphDef);
}
开发者ID:chadmv,项目名称:plow,代码行数:15,代码来源:RrdGraphController.java
示例19: addLine
import org.rrd4j.graph.RrdGraphDef; //导入依赖的package包/类
/**
* Adds a line for the item to the graph definition.
* The color of the line is determined by the counter, it simply picks the according index from LINECOLORS (and
* rolls over if necessary).
*
* @param graphDef the graph definition to fill
* @param item the item to add a line for
* @param counter defines the number of the datasource and is used to determine the line color
*/
protected void addLine(RrdGraphDef graphDef, Item item, int counter) {
Color color = LINECOLORS[counter % LINECOLORS.length];
String label = itemUIRegistry.getLabel(item.getName());
String rrdName = RRD4jService.DB_FOLDER + File.separator + item.getName() + ".rrd";
ConsolFun consolFun;
if (label != null && label.contains("[") && label.contains("]")) {
label = label.substring(0, label.indexOf('['));
}
try {
RrdDb db = new RrdDb(rrdName);
consolFun = db.getRrdDef().getArcDefs()[0].getConsolFun();
db.close();
} catch (IOException e) {
consolFun = ConsolFun.MAX;
}
if (item instanceof NumberItem) {
// we only draw a line
graphDef.datasource(Integer.toString(counter), rrdName, "state", consolFun); // RRD4jService.getConsolidationFunction(item));
graphDef.line(Integer.toString(counter), color, label, 2);
} else {
// we draw a line and fill the area beneath it with a transparent color
graphDef.datasource(Integer.toString(counter), rrdName, "state", consolFun); // RRD4jService.getConsolidationFunction(item));
Color areaColor = AREACOLORS[counter % LINECOLORS.length];
graphDef.area(Integer.toString(counter), areaColor);
graphDef.line(Integer.toString(counter), color, label, 2);
}
}
开发者ID:openhab,项目名称:openhab1-addons,代码行数:38,代码来源:RRD4jChartServlet.java
注:本文中的org.rrd4j.graph.RrdGraphDef类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论