[rrd-users] Re: How to add aditional data into an rrd file ?

Allan Houston ahouston at blueyonder.co.uk
Wed Jun 11 20:19:39 MEST 2003


Hi Pablo,

I reckon your easiest method is to use the add_ds.pl script which came in
your contrib directory when you downloaded the rrd source tarball. I think
there's a batch script too , I can't remember why , but I ended up just
writing my own bash script to do my additions.

The line which does the additions is :

./add_ds.pl 6 0 GAUGE 1200 0 100 < dump.xml > out.xml      ( I copied the
script to my rrd directory because I'm lazy..)

In this case I was added 6 new SNR readings, so you then tune the rrd to get
the names for your datasources right etc. In my case the new datasources
started at ds6 upwards, you may need to experiment a bit.

rrdtool tune $file -r ds6:snr0 -r ds7:snr1 -r ds8:snr2 -r ds9:snr3 -r
ds10:snr4 -r ds11:snr5

Also, you need to create a temp folder in the rrd directory -> this will
contain a copy of the rrd before modification, just in case ;o)

... and remember to kill your cron job thats doing the data collection or
some of your rrd's may be locked when you're trying to update them.

hth !!

Allan.

-------------------------------------

#!/bin/bash

for file in `ls -1 *.rrd`
do
        if [ -f dump.xml ]
        then
                rm dump.xml
        fi

        if [ -f out.xml ]
        then
                rm out.xml
        fi

        echo Adding DS to $file
        rrdtool dump $file > dump.xml
        if [ -f dump.xml ]
        then
                ./add_ds.pl 6 0 GAUGE 1200 0 100 < dump.xml > out.xml

                if [ -f out.xml ]
                then

                        mv $file temp/$file
                        rrdtool restore out.xml $file

                        if [ -f $file ]
                        then
                                rrdtool tune $file -r ds6:snr0 -r
ds7:snr1 -r ds8:snr2 -r ds9:snr3 -r ds10:snr4 -r ds11:snr5
                        fi
                fi
        fi

        chown mrtg:users $file
        chmod 750 $file
done

----- Original Message -----
From: "Pablo Luchetti" <pllis at educ.ar>
To: <rrd-users at list.ee.ethz.ch>
Sent: Wednesday, June 11, 2003 5:11 PM
Subject: [rrd-users] How to add aditional data into an rrd file ?


> Hi,
> I need to add a new DS into an existing rrd file whithout loosing data.
> I think there are 2 ways to do that:
>
> The first, using rrdtool dump, manipulate the xml output and last,
> rrdtool restore.
>
> The second (bad solution for me) is to create a new rrd file to put the
> aditional data I want to graph.
>
> Is there another way to solve this?
>
> Thanks!
> --
> --- pllis at educ.ar --------------------------------
> -------------------------------- Pablo Luchetti --
>
> --
> Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
> Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
> Archive     http://www.ee.ethz.ch/~slist/rrd-users
> WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi
>
>


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list