RRDTool:RRD 文件未更新

发布于 2024-11-09 01:47:09 字数 1515 浏览 3 评论 0原文

我的 RRD 文件 没有更新,是什么原因?

该图显示了图例: -nanv

我使用以下语法创建了 RRD 文件:

rrdtool create ups.rrd --step 300 
DS:input:GAUGE:600:0:360 
DS:output:GAUGE:600:0:360 
DS:temp:GAUGE:600:0:100 
DS:load:GAUGE:600:0:100 
DS:bcharge:GAUGE:600:0:100 
DS:battv:GAUGE:600:0:100 
RRA:AVERAGE:0.5:12:24 
RRA:AVERAGE:0.5:288:31 

然后我使用以下语法更新了该文件:

rrdtool update ups.rrd N:$inputv:$outputv:$temp:$load:$bcharge:$battv

并用以下方式绘制了它:

rrdtool graph ups-day.png 
-t "ups " 
-s -1day 
-h 120 -w 616 
-a PNG 
-cBACK#F9F9F9 
-cSHADEA#DDDDDD 
-cSHADEB#DDDDDD 
-cGRID#D0D0D0 
-cMGRID#D0D0D0 
-cARROW#0033CC 
DEF:input=ups.rrd:input:AVERAGE 
DEF:output=ups.rrd:output:AVERAGE 
DEF:temp=ups.rrd:temp:AVERAGE 
DEF:load=ups.rrd:load:AVERAGE 
DEF:bcharge=ups.rrd:bcharge:AVERAGE 
DEF:battv=ups.rrd:battv:AVERAGE 
LINE:input#336600 
AREA:input#32CD3260:"Input Voltage" 
GPRINT:input:MAX:" Max %lgv" 
GPRINT:input:AVERAGE:" Avg %lgv" 
GPRINT:input:LAST:"Current %lgv\n" 
LINE:output#4169E1:"Output Voltage" 
GPRINT:output:MAX:"Max %lgv" 
GPRINT:output:AVERAGE:" Avg %lgv" 
GPRINT:output:LAST:"Current %lgv\n" 
LINE:load#FD570E:"Load" 
GPRINT:load:MAX:"      Max %lg%%" 
GPRINT:load:AVERAGE:" Avg %lg%%" 
GPRINT:load:LAST:" Current %lg%%\n" 
LINE:temp#000ACE:"Temperature" 
GPRINT:temp:MAX:"   Max %lgc" 
GPRINT:temp:AVERAGE:"    Avg %lgc" 
GPRINT:temp:LAST:" Current %lgc" 

My RRD file is not updating, what is the reason?

The graph shows the legend with: -nanv

I created the RRD file using this syntax:

rrdtool create ups.rrd --step 300 
DS:input:GAUGE:600:0:360 
DS:output:GAUGE:600:0:360 
DS:temp:GAUGE:600:0:100 
DS:load:GAUGE:600:0:100 
DS:bcharge:GAUGE:600:0:100 
DS:battv:GAUGE:600:0:100 
RRA:AVERAGE:0.5:12:24 
RRA:AVERAGE:0.5:288:31 

Then I updated the file with this syntax:

rrdtool update ups.rrd N:$inputv:$outputv:$temp:$load:$bcharge:$battv

And graphed it with this:

rrdtool graph ups-day.png 
-t "ups " 
-s -1day 
-h 120 -w 616 
-a PNG 
-cBACK#F9F9F9 
-cSHADEA#DDDDDD 
-cSHADEB#DDDDDD 
-cGRID#D0D0D0 
-cMGRID#D0D0D0 
-cARROW#0033CC 
DEF:input=ups.rrd:input:AVERAGE 
DEF:output=ups.rrd:output:AVERAGE 
DEF:temp=ups.rrd:temp:AVERAGE 
DEF:load=ups.rrd:load:AVERAGE 
DEF:bcharge=ups.rrd:bcharge:AVERAGE 
DEF:battv=ups.rrd:battv:AVERAGE 
LINE:input#336600 
AREA:input#32CD3260:"Input Voltage" 
GPRINT:input:MAX:" Max %lgv" 
GPRINT:input:AVERAGE:" Avg %lgv" 
GPRINT:input:LAST:"Current %lgv\n" 
LINE:output#4169E1:"Output Voltage" 
GPRINT:output:MAX:"Max %lgv" 
GPRINT:output:AVERAGE:" Avg %lgv" 
GPRINT:output:LAST:"Current %lgv\n" 
LINE:load#FD570E:"Load" 
GPRINT:load:MAX:"      Max %lg%%" 
GPRINT:load:AVERAGE:" Avg %lg%%" 
GPRINT:load:LAST:" Current %lg%%\n" 
LINE:temp#000ACE:"Temperature" 
GPRINT:temp:MAX:"   Max %lgc" 
GPRINT:temp:AVERAGE:"    Avg %lgc" 
GPRINT:temp:LAST:" Current %lgc" 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只为守护你 2024-11-16 01:47:09

您将需要至少 13 次更新,每次间隔 5 分钟(IE,12 个 PDP(主要数据点)),然后才能将单个 CDP(合并数据点)写入 RRA,从而使您能够在图表上获取数据点。这是因为您的最小分辨率 RRA 是计数 12,这意味着您需要 12 个 PDP 才能制作一个 CDP。

在您有足够的数据来编写 CDP 之前,您没有什么可绘制的,并且您的图表将始终包含未知数据。

或者,添加较小分辨率的 RRA(可能是计数 1),这样您就不需要在获得完整 CDP 之前收集数据太长时间。

You will need at least 13 updates, each 5min apart (IE, 12 PDP (primary data points)) before you can get a single CDP (consolidated data point) written to your RRAs, enabling you to get a data point on the graph. This is because your smallest resolution RRA is a Count 12, meaning you need 12 PDP to make one CDP.

Until you have enough data to write a CDP, you have nothing to graph, and your graph will always have unknown data.

Alternatively, add a smaller resolution RRA (maybe Count 1) so that you do not need to collect data for so long before you have a full CDP.

隐诗 2024-11-16 01:47:09

更新脚本需要以与数据库中定义的时间间隔完全相同的时间间隔运行。
我看到它的步长值为 300,因此数据库应每 5 分钟更新一次。
只需将更新脚本放在 cron 作业中(您也可以为图形脚本执行此操作

)例如,

sudo crontab -e

如果第一次运行,请选择您最喜欢的编辑器(我通常使用 Vim) 并添加完整路径脚本的位置并每 5 分钟运行一次。因此,添加此内容(不要忘记重命名路径):

*/5 * * * *  /usr/local/update_script > /dev/null && /usr/local/graph_script > /dev/null

保存它,然后等待几分钟。如果输出可以由脚本生成,我通常将输出重定向到 /dev/null。因此,如果要执行的脚本给出输出,crontab 将失败并发送通知。

The update script needs to be run at exactly the same interval as defined in your database.
I see it has a step value of 300 so the database should be updated every 5 minutes.
Just place you update script in a cron job (you can also do it for your graph script)

For example,

sudo crontab -e

If run for the first time choose your favorite editor (I usually go with Vim) and add the full path location of your script and run it every 5 minutes. So add this (don't forget to rename the path):

*/5 * * * *  /usr/local/update_script > /dev/null && /usr/local/graph_script > /dev/null

Save it, and wait a couple of minutes. I usually redirect the output to /dev/null in case of the output that can be generated by a script. So if a script that will be executed gives an output crontab will fail and send a notification.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文