为什么要“步骤”改变?

发布于 2025-02-01 03:55:30 字数 1743 浏览 2 评论 0原文

我有一个命令创建的rrd

data_sources = [ 'DS:Pprod:GAUGE:10:0:6000',     
             'DS:Pcons:GAUGE:10:0:6000', 
             'DS:Pdiff:GAUGE:10:-6000:6000'  
           ]

rrdtool.create ( rrd_filename,
                 '--step', '5',                      # one sample every 5 sec
                 '--start', 'now - 7d',
                 data_sources,
                 'RRA:MAX:0.5:1:6307200')            # we keep 1 year

======

正在正确填充它 -

======

    <!-- 2022-05-19 12:25:45 CEST / 1652955945 --> <row><v>4.291018731e+03</v><v>1.715717220e+03</v><v>2.574301511e+03</v></row>
    <!-- 2022-05-19 12:25:50 CEST / 1652955950 --> <row><v>4.286880929e+03</v><v>1.721000000e+03</v><v>2.564880929e+03</v></row>
    <!-- 2022-05-19 12:25:55 CEST / 1652955955 --> <row><v>4.286880929e+03</v><v>1.721000000e+03</v><v>2.564880929e+03</v></row>

=======

现在我想从中“ xport”一些数据:

rrdtool xport -s $epochStart  -e $epochEnd  --step 5 --json  -t   DEF:pot=$ifn:Pprod:MAX XPORT:pot 

且在输出JSON中,我找到了“ 步骤“已更改:

{ "about": "RRDtool graph JSON output",
  "meta": {
    "start": 1652738755,
    "end": 1652824970,
    "step": 215,
    "legend": [
      ""
          ]
     },
  "data": [
    [ "1652738755",0.000000000e+00 ],
    [ "1652738970",0.000000000e+00 ],

===

有没有逻辑原因?

pd.-“ rrdtool信息”说

pi@R4:~/python/pkw/dades $ rrdtool info ./pkw.rrd 
filename = "./pkw.rrd"
rrd_version = "0003"
step = 5

I have a RRD created by this command

===

data_sources = [ 'DS:Pprod:GAUGE:10:0:6000',     
             'DS:Pcons:GAUGE:10:0:6000', 
             'DS:Pdiff:GAUGE:10:-6000:6000'  
           ]

rrdtool.create ( rrd_filename,
                 '--step', '5',                      # one sample every 5 sec
                 '--start', 'now - 7d',
                 data_sources,
                 'RRA:MAX:0.5:1:6307200')            # we keep 1 year

===

I am filling it properly -

===

    <!-- 2022-05-19 12:25:45 CEST / 1652955945 --> <row><v>4.291018731e+03</v><v>1.715717220e+03</v><v>2.574301511e+03</v></row>
    <!-- 2022-05-19 12:25:50 CEST / 1652955950 --> <row><v>4.286880929e+03</v><v>1.721000000e+03</v><v>2.564880929e+03</v></row>
    <!-- 2022-05-19 12:25:55 CEST / 1652955955 --> <row><v>4.286880929e+03</v><v>1.721000000e+03</v><v>2.564880929e+03</v></row>

===

Now I want to "xport" some data from it :

rrdtool xport -s $epochStart  -e $epochEnd  --step 5 --json  -t   DEF:pot=$ifn:Pprod:MAX XPORT:pot 

===

And in the output JSON I find the "step" has changed :

{ "about": "RRDtool graph JSON output",
  "meta": {
    "start": 1652738755,
    "end": 1652824970,
    "step": 215,
    "legend": [
      ""
          ]
     },
  "data": [
    [ "1652738755",0.000000000e+00 ],
    [ "1652738970",0.000000000e+00 ],

===

Any logical reason for that ?

PD.- "rrdtool info" says

pi@R4:~/python/pkw/dades $ rrdtool info ./pkw.rrd 
filename = "./pkw.rrd"
rrd_version = "0003"
step = 5

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

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

发布评论

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

评论(1

旧情别恋 2025-02-08 03:55:30

这很可能是由于试图在当前的愤怒之外导出定义的RRA的数据引起的。

您的RRD只有一个RRA定义,从(NOW-7D)到(6307200x5sec)将来。

您显示为添加到RRD的数据围绕Epoch = 1652955945;但是您正在尝试的导出时间是在RRA启动之前围绕Epoch = 1652738755。

当我尝试复制此内容时,我创建了一个RRD:

rrdtool create $RRD --step 5 --start 1652955935 \
  'DS:Pprod:GAUGE:10:0:6000' 'DS:Pcons:GAUGE:10:0:6000' \
  'DS:Pdiff:GAUGE:10:-6000:6000' 'RRA:MAX:0.5:1:6307200'

则将数据添加到其中

rrdtool update $RRD \
  1652955940:0:10:20 \
  1652955945:100:200:300 \
  1652955950:400:500:600 \
  1652955955:700:800:900 \
  1652955960:1000:1100:1200

然后,如果我尝试从定义的RRA范围内提取数据,

rrdtool xport -s 1652955945 -e 1652956000 --step 5 --json \
  -t DEF:pot=${RRD}:Pprod:MAX XPORT:pot

{ "about": "RRDtool graph JSON output",
  "meta": {
    "start": 1652955950,
    "end": 1652956000,
    "step": 5,
    ...

,则有效:但是,如果我尝试从不在的范围中提取在可用的数据空间内,RRDTOOL无法选择有意义的RRA,因此似乎默认为215S步骤。

rrdtool xport -s 1652738755 -e 1652824970 --step 5 --json \
   -t DEF:pot=${RRD}:Pprod:MAX XPORT:pot

{ "about": "RRDtool graph JSON output",
  "meta": {
    "start": 1652738970,
    "end": 1652824970,
    "step": 215,
    ...

我不知道为什么rrdtool默认为此步骤大小。但是,在执行图形或XPORT时,RRDTOOL将尝试找到最佳拟合的RRA,以覆盖所请求的合并的全部 glote 所请求的数据范围,即使这意味着要更改更改步长。因此,看起来RRDTool在寻找可行的RRA方面已经放弃了,并为您提供了带有空数据的215S步骤的默认步骤。

This is most likely caused by trying to export data outside of the current rage for the defined RRA.

Your RRD has only a single RRA defined, from (now-7d) until (6307200x5sec) in the future.

The data you show as being added to the RRD are for times around epoch=1652955945; but the export you are trying is for times around epoch=1652738755, before the RRA starts.

When I tried to duplicate this, I created an RRD:

rrdtool create $RRD --step 5 --start 1652955935 \
  'DS:Pprod:GAUGE:10:0:6000' 'DS:Pcons:GAUGE:10:0:6000' \
  'DS:Pdiff:GAUGE:10:-6000:6000' 'RRA:MAX:0.5:1:6307200'

Then added data to it

rrdtool update $RRD \
  1652955940:0:10:20 \
  1652955945:100:200:300 \
  1652955950:400:500:600 \
  1652955955:700:800:900 \
  1652955960:1000:1100:1200

If I try to extract the data from within the range of the defined RRA, then it works:

rrdtool xport -s 1652955945 -e 1652956000 --step 5 --json \
  -t DEF:pot=${RRD}:Pprod:MAX XPORT:pot

{ "about": "RRDtool graph JSON output",
  "meta": {
    "start": 1652955950,
    "end": 1652956000,
    "step": 5,
    ...

However, if I try to extract from a range that is not within the available data space, RRDTool fails to pick a meaningful RRA and so appears to default to a 215s step.

rrdtool xport -s 1652738755 -e 1652824970 --step 5 --json \
   -t DEF:pot=${RRD}:Pprod:MAX XPORT:pot

{ "about": "RRDtool graph JSON output",
  "meta": {
    "start": 1652738970,
    "end": 1652824970,
    "step": 215,
    ...

I don't know why RRDTool is defaulting to this step size; however, it is documented behaviour that RRDTool, when doing a graph or xport, will attempt to find the best-fit RRA to cover the entire requested data range at the requested consolodation, even if this means changing the step size. So, this looks as if RRDTool has given up on finding a workable RRA and has given you a default of 215s step with empty data.

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