This is a discussion on [rrd-users] Dump and rebuild and restore XML with perl within the RRD Users forums, part of the Networking and Network Related category; --===============0390533843== Content-Type: multipart/alternative; boundary="----=_Part_18039_14681256.1205183772199" ------=_Part_18039_14681256.1205183772199 Content-Type: text/plain; charset=ISO-8859-1 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
--===============0390533843==
Content-Type: multipart/alternative; boundary="----=_Part_18039_14681256.1205183772199" ------=_Part_18039_14681256.1205183772199 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, I'm currently working with several hundred RRD files and a large chunk have the incorrect step and heartbeat .they were setup with a step of 300 and heartbeat of 900 where i would like to change them to 600 and 1800. I've read that in order to accomplish this you need to dump the database into XML with the rrdtool dump command and then alter the XML files (adding/removing data points, and updating the settings) and then restore the database from the modified XML, please correct me if i'm wrong about that. Anyway I've created a Perl script to dump to XML, read in the XML and change the values of heartbeat and step and then remove every other data collection point to be inline with the step of 600 sec. I then rebuild the XML and save that to a file. The new XML file does not have any comments but contains everything else. When i try and restore the database from this XML file i get the error * 'ERROR: Incompatible file version, detected version . This is not supported by the version 0003 restore tool.*' returned. I've looked through the modified XML file and i don't see anything different, other then the order the tags are listed in the file. could this cause a problem? or could the lack of comments cause a problem? I'm also using the same version of rrdtool to dump as i am to restore the database, RRDtool 1.2.23. Original XML: https://www.ondashboard.com/origional.xml Modified XML: https://www.ondashboard.com/modified.xml Part of the Perl Script: # read XML file my $data = $xml->XMLin("dump.xml"); $data->{step} = 600; my @xml; for my $rra ( @{ $data->{rra} } ) { my $lcv=0; my @new; # Loop through database and remove every other entry. for my $value ( @{ $rra->{database}->{row} } ) { if($lcv % 2 == 0 || $lcv == 0) { push(@new, \%$value); } $lcv++; } # Append XML with new Database $rra->{database}->{row} = \@new; push(@xml, $rra); } $data->{rra} = \@xml; # Export the perl structure into XML XMLout($data, OutputFile => $file.".xml", RootName => 'rrd', NoAttr => 1); Thanks. ------=_Part_18039_14681256.1205183772199 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, I'm currently working with several hundred RRD files and a large chunk have the incorrect step and heartbeat .they were setup with a step of 300 and heartbeat of 900 where i would like to change them to 600 and 1800. I've read that in order to accomplish this you need to dump the database into XML with the rrdtool dump command and then alter the XML files (adding/removing data points, and updating the settings) and then restore the database from the modified XML, please correct me if i'm wrong about that. <br> <br>Anyway I've created a Perl script to dump to XML, read in the XML and change the values of heartbeat and step and then remove every other data collection point to be inline with the step of 600 sec. I then rebuild the XML and save that to a file. The new XML file does not have any comments but contains everything else. When i try and restore the database from this XML file i get the error<br> <br><i> 'ERROR: Incompatible file version, detected version . This is not supported by the version 0003 restore tool.</i>'<br><br>returned. I've looked through the modified XML file and i don't see anything different, other then the order the tags are listed in the file. could this cause a problem? or could the lack of comments cause a problem? I'm also using the same version of rrdtool to dump as i am to restore the database, RRDtool 1.2.23. <br> <br>Original XML:<br><a href="https://www.ondashboard.com/origional.xml">https://www.ondashboard.com/origional.xml</a><br><br>Modified XML:<br><a href="https://www.ondashboard.com/modified.xml">https://www.ondashboard.com/modified.xml</a><br> <br>Part of the Perl Script:<br><br><div style="margin-left: 40px;"> # read XML file<br> my $data = $xml->XMLin("dump.xml");<br><br> &nbs p; $data->{step} = 600;<br> <br> my @xml;<br> <br> for my $rra ( @{ $data->{rra} } ) { <br> my $lcv=0;<br> my @new;<br><br> & nbsp; # Loop through database and remove every other entry.<br> for my $value ( @{ $rra->{database}->{row} } ) { <br> if($lcv % 2 == 0 || $lcv == 0) {<br> push(@new, \%$value); <br> }<br> $lcv++;<br> } <br><br> &nbs p; # Append XML with new Database<br> $rra->{database}->{row} = \@new; <br> push(@xml, $rra);<br> }<br> <br> $data->{rra} = \@xml;<br><br> # Export the perl structure into XML<br> XMLout($data, OutputFile => $file.".xml",<br> RootName => 'rrd',<br> NoAttr => 1);<br> </div><br><br><br><br>Thanks.<br> ------=_Part_18039_14681256.1205183772199-- --===============0390533843== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ rrd-users mailing list rrd-users@lists.oetiker.ch https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users --===============0390533843==-- |
![]() |
| Thread Tools | |
| Display Modes | |
|
|