Ganglia 指标值衰减为零
我每 5 分钟使用 Gmetric 向 Ganglia 发送一次指标。但是,如果发送指标的 cron 任务不起作用,我预计 Ganglia 图上的指标值会变为零,而它会保持其最后更新的值。有没有办法改变这种行为?
I am sending metrics to Ganglia using Gmetric once every 5 minutes. But if the cron task that is sending the metrics is not working, I would expect the metric value on the Ganglia graph to go to zero, whereas it stays at its last updated value. Is there a way to change this behaviour?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请注意,在 gmetric 中使用“-d”标志(又名 DMAX)将使 gmond/gmetad 在 DMAX 秒过去而没有 gmetric 更新的情况下完全忘记该指标。
因此,如果您直接开箱即用地运行 Ganglia,则该指标的 .rrd 文件和 Ganglia 图表将完全消失。
如果您想保留指标的 .rrd 历史记录和/或希望 Ganglia 图保持不变(但将绘图降至零),您可以在 /path/to/webserver/ 内编辑对 rrdtool 的调用ganglia/graph.d/metric.php。
查看 CDEF 和 VDEF 的 rrdtool 文档,了解如何将条件合并到 rrdtool 调用中。在这些语句中,我相信您可以检查 .rrd 内最后一个指标的时间戳,然后任意绘制零值(或您想要的任何其他值)。或者,您可以更改您不信任的时间段的线条颜色或样式,等等。rrdtool
相当强大,尽管难以理解。最好仔细阅读的手册页是rrdgraph_data、rrdgraph_graph 和rrdgraph。另请查看 Ganglia 提供的其他一些 PHP 脚本,以了解如何调用 rrdtool 的更多示例。
Note that using the '-d' flag (aka DMAX) in your gmetric will make gmond/gmetad forget about the metric completely after DMAX seconds have passed without a gmetric update.
So if you're running Ganglia straight out of the box, the .rrd file and the Ganglia graph for that metric will disappear entirely.
If you'd like to preserve the .rrd history of the metric and/or you want the Ganglia graph to stay around (but have the plot drop to zero), you could edit the call to rrdtool inside /path/to/webserver/ganglia/graph.d/metric.php.
Check out the rrdtool docs for CDEF and VDEF to see how you can incorporate conditionals into rrdtool calls. Within those statements I believe you can inspect the timestamp of the last metric inside the .rrd and then arbitrarily graph a value of zero (or any other value you want). Alternatively you could change the color or style of the line for time periods that you don't trust, etc., etc.
rrdtool is fairly powerful, if incomprehensible. The best man pages to peruse would be rrdgraph_data, rrdgraph_graph, and rrdgraph. Also check out some of the other PHP scripts provided by Ganglia to see more examples of how to invoke rrdtool.
我相信这是rrdtool 的一个功能。它将继续显示“最后报告”的值,直到获得新数据。如果您希望指标值变为 0,则必须有一些进程实际报告该指标的 0 值。
尝试在 gmetric 调用中设置 -d 标志。这指示您发送的指标的最大生命周期(以秒为单位)。我相信 gmond/gmetad 会在经过该时间后删除该指标,之后您将不会在 PHP 应用程序中看到它的图表。
这并不完全是您所要求的,但也许这是一个可以接受的选择?
I believe that's a feature of rrdtool. It will continue to show the 'last reported' value until it gets new data. If you wanted a metric value to go to 0, you'd have to have some process which actually reported a 0 value for that metric.
Try setting the -d flag in your gmetric calls. This indicates the maximum lifetime (in seconds) of the metric you send. I believe gmond/gmetad will drop the metric after that amount of time has elapsed, and you won't see it graphed in the PHP app after that.
That isn't exactly what you asked for, but maybe it's an acceptable alternative?