[rrd-users] rrdrestore and annoying error messages
Sean Whitney
sean at visionary-networks.com
Fri Jan 25 00:09:02 CET 2013
if rrdrestore finds a error it spits out an error similar to
ERROR: line 210: expected <ds> element but found </cdp_prep>
Which is annoying because line 210 isn't the line number in the file, but the xml parser line number.
Anyway I found this script useful to finding the incorrect element.
use XML::LibXML;
my $parser = XML::LibXML->new( line_numbers => 1 );
my $xml = $parser->load_xml( location => '<filename>' );
foreach my $nodes ( $xml->childNodes ) {
hasChild($nodes);
}
sub hasChild {
my $nodes = shift;
if ( $nodes->hasChildNodes() ) {
foreach my $node ( $nodes->childNodes ) {
my $line = $node->line_number();
my $nodeStr = $node->nodeName();
my $nodeval = $node->to_literal();
print "line $line :: $nodeStr :: $nodeval\n";
hasChild($node);
}
}
}
I'm sure someone could write a much better script, but here is my solution.
Sean
=======================================
Sean Whitney
PMB #120, 16505A SE First Street
Vancouver, WA 98684
T. 360.326.2740
C. 360.607.7945
F. 815.364.0687
aim: seanmwhitney
email: sean at visionary-networks.com
skype: sean_whitney
=======================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20130124/4d332154/attachment-0001.htm
More information about the rrd-users
mailing list