微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

RRDTools RRDs::xport 模块的工作示例

如何解决RRDTools RRDs::xport 模块的工作示例

我正在尝试利用 Perl 中 RRDs 模块的 xport 函数从 rrd 文件提取数据。但是,我没有任何运气找到正确的语法来使用相同的语法。官网仅提供以下说明。 如果有人用过这个模块来做同样的事情,请帮忙。

RRDs::xport exposes the rrdxport functionality and returns data with the following structure:

  my ($start,$end,$step,$cols,$names,$data) = RRDs::xport ...
  
  # $start : timestamp
  # $end   : timestamp
  # $step  : seconds
  # $cols  : number of returned columns
  # $names : arrayref with the names of the columns
  # $data  : arrayref of arrayrefs with the data (first index is time,second is column)

解决方法

RRDs 模块中的各种 Perl 函数采用与命令行函数完全相同的参数数组。

例如,

@args = qw/--start now-1h --end now DEF:x=file.rrd:ds0:AVERAGE XPORT:x:out_bytes/;
($start,$end,$step,$cols,$names,$data) = RRDs::xport(@args);

请记住,您不需要引用包含空格的参数 - 毕竟,它们已经在数组中标记了。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。