RRD 测量 CPU 和内存使用情况
我想在持续集成过程中测量服务器的 CPU 和内存使用情况,并将它们表示为几个图表。我使用循环数据库文件 (*.rrd) 通过 RRD4J 库在 java 中执行此操作。
我不知道如何定义循环档案...... 我尝试过这种 RRA:
rrdDefCPU.addDatasource("CPU", DsType.COUNTER, 150, 0, 100);
rrdDefCPU.addArchive("RRA:AVERAGE:0.5:8:300");
或者
rrdDefCPU.addDatasource("CPU", DsType.COUNTER, 600, 0, 100);
rrdDefCPU.addArchive("RRA:AVERAGE:0.5:1:600");
在这两种情况下,我每秒记录一次测量,但在 5 分钟的时间内我仍然在图表上记录 2 个点。我想要一张具有同一时期更多值的图表。
I would like to measure CPU and Memory usages for a server during continuous integration, And I would represent them into several graphs. I use Round Robin Database files (*.rrd) to do it in java with RRD4J library.
I don't know how to define Round Robin Archives...
I have tried this kind of RRA:
rrdDefCPU.addDatasource("CPU", DsType.COUNTER, 150, 0, 100);
rrdDefCPU.addArchive("RRA:AVERAGE:0.5:8:300");
Or
rrdDefCPU.addDatasource("CPU", DsType.COUNTER, 600, 0, 100);
rrdDefCPU.addArchive("RRA:AVERAGE:0.5:1:600");
In both cases, I record one measure per second, but I still 2 points on the graph for a period of 5 minutes. I want a graph with more of values on the same period.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在 5 分钟间隔内没有看到更多细节,那么我猜您的步长是 5 分钟,并且您是通过复制演示代码获得的。请在您的问题中显示您的 RrdDef 构造函数。
另外,您可能需要一个用于 cpu/内存使用情况的 GAUGE,而不是一个只会上升的 COUNTER。如果错误地使用 COUNTER,您会得到尖峰输出,因为 RRD 将向下移动解释为溢出,并为该观察结果添加了非常大的数量。
在您的代码中,您可以改变 Heartbeat 大小,它与 Xff 结合来确定输入中可以容忍的间隙大小。如果您有连续数据,则更改 HB 将不会产生任何影响。
If you are not seeing more detail in your 5 minute interval, then I guess your step size is 5 minutes and you got it from copying the demo code. Please show your RrdDef constructor in your question.
Also, you probably want a GAUGE for cpu/memory usage, not a COUNTER which only goes up. If you use COUNTER by mistake, you get spiky output because RRD interprets a down move as an overflow and adds a very large amount to that observation.
In your code, you are varying the Heartbeat size, which combines with Xff to determine what size gap is tolerated in the input. If you have continuous data, you won’t see any effect from changing HB.