我的的RRD数百很少,我想5个额外的数据源添加到所有的的RRD。
- 难道建议这样做
- 最新最好的方式做到这一点的最快方法
- SOLN -
大卫·奥布莱恩的答复是邮件列表
搜索档案(你应该先完成)和谷歌搜索后,我发现用这个几个人...
用Perl。 安装RRD:简单
#!/usr/local/bin/perl
use strict;
use RRD::Simple ();
my $rrd = RRD::Simple->new();
my $rrdfile=$ARGV[0];
my $source=$ARGV[1];
my $type=$ARGV[2];
chomp($type);
$rrd->add_source($rrdfile, $source => $type);
用法:
./addSource.pl file.rrd ds GAUGE
或任何类型..
请享用。
使用rrddump和rrdrestore。
只是这样:
rrdtool dump my.rrd > file.xml
./rrdAddDS.pl file.xml newDsName > new_file.xml
rrdtool restore new_file.xml my_new.rrd
:你可以从这里指http://osdir.com/ml/db.rrdtool.user/2003-08/msg00115.html
在这里: http://www.docum.org/drupal/sites/default/files/add_ds_to_rrd.pl_.txt
如果您使用PNP4Nagios( https://docs.pnp4nagios.org/pnp-0.6/start ),它们提供了修改现有RRD数据文件的实用程序脚本rrd_modify.pl。
$ rrd_modify.pl -h
=== rrd_modify.pl 0.01 ===
Copyright (c) 2012 PNP4Nagios Developer Team (http://www.pnp4nagios.org)
This script can be used to alter the number of data sources of an RRD file.
Usage:
rrd_modify.pl RRD_file insert|delete start_ds[,no_of_cols] [type]
Arguments:
RRD_file
the location of the RRD file. It will NOT be overwritten but appended
by ".chg"
insert or delete
the operation to be executed
start_ds
the position at which the operation starts (1..no of data sources+1)
no_of_cols
(an optional) number of columns which will be added/deleted
type
the data type (one of GAUGE, COUNTER)
Defaults to GAUGE if not specified for insert operations
(DERIVE, ABSOLUTE, COMPUTE have not been tested and might result in
errors during creation of a new RRD file)
由于1.5版rrdtool create
可以“预填充”从现有的与文件(S)的数据--source
选项。 此功能解决了这个问题,而不需要额外的脚本。