Adding a new data source to an existing RRD

I have only a few hundred rrds and I want to add 5 additional data sources for all of these rrds.

  • Is it advisable to do this
  • What is the best way and fastest way to do this.

- Soln -

David OBrien replied to the mailing list

after searching the archives (which you should have done first) and googling, I found several people using this ...

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); 

using:

 ./addSource.pl file.rrd ds GAUGE 

or regardless of type.

Enjoy.

+6
source share
3 answers

use rrddump and rrdrestore.

just:

 rrdtool dump my.rrd > file.xml ./rrdAddDS.pl file.xml newDsName > new_file.xml rrdtool restore new_file.xml my_new.rrd 

you can contact from here: http://osdir.com/ml/db.rrdtool.user/2003-08/msg00115.html

and here: http://www.docum.org/drupal/sites/default/files/add_ds_to_rrd.pl_.txt

+2
source

If you use PNP4Nagios ( https://docs.pnp4nagios.org/pnp-0.6/start ), they provide the rrd_modify.pl script utility to modify 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) 
+2
source

Since version 1.5 rrdtool create can "pre-populate" data from existing files (s) with the --source option. This function solves the problem without additional scripts.

0
source

All Articles