Jump to content

convert rrd to xml and save in same directory as rrd


Recommended Posts

Hola,

 

I have to convert a ass load of rrd files to xml to be imported via a newer version of rrd. The way i was thinking of doing this was to use the following script:

 

 

for rrd in `find / -type f -name "*.rrd"`
do
	  echo "Converting $rrd"
	  rrdtool dump $rrd > $rrd.xml
done

 

I haven't tested that yet, that was just my initial thoughts on doing this. What are your thoughts? After converting them, i was going to use rsync to send all the xml files over to the new server. Once on the other side, i was going to use something very similar to the above to convert the files back to rrd format. Ritter and znx, what are your thoughts on this?

Link to post
Share on other sites

Hi :)

 

OK, well first thoughts are that your find is a bit too wide, you should probably just do either current directory or a specified path. Also I like stripping off the rrd extension so you don't get file.rrd.xml. For instance:

 

if [ $# -eq 1 ]
then
   ST="$1"
else
   ST="."
fi

for RRD in $(find ${ST} -type f -iname "*.rrd")
do
   echo "> Converting ${RRD}"
   rrdtool dump ${RRD} > ${RRD%.[Rr][Rr][Dd]}.xml
done

 

You say you want to rsync it, obviously doing this would be easy enough to amend to the end of the script by simply rsync'ing the ${ST} path to somewhere remote.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...