向现有RRD添加新数据源 [英] adding new datasource to an existing RRD
本文介绍了向现有RRD添加新数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有几百个rrds,我想向所有这些rrds添加5个额外的数据源.
I have few 100s of rrds and i want to add 5 extra datasource to all of those rrds.
- 建议这样做
- 什么是最好的方法和最快的方法
- Soln -
David OBrien在邮件列表中答复
搜索完档案(您应该先完成此操作)并进行谷歌搜索之后,我发现有几个人正在使用此文件...
after searching the archives ( which you should have done first ) and googling I found several people using this...
带有perl.安装RRD:Simple
with perl. Install RRD:Simple
#!/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
或任何类型.
享受.
推荐答案
如果您使用的是PNP4Nagios( https://docs.pnp4nagios.org/pnp-0.6/start ),它们提供了实用程序脚本 rrd_modify.pl ,用于修改现有的RRD数据文件.
If you're using PNP4Nagios (https://docs.pnp4nagios.org/pnp-0.6/start), they provide a utility script rrd_modify.pl for modifying existing RRD data files.
$ 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)
这篇关于向现有RRD添加新数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文