RRD 创建 RRD::xport 模块的工作示例



我正在尝试利用Perl中rrd模块的导出功能从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)

rrd模块中的各种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);

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

最新更新