Skip to main content
113
Posts
1
Members
0
Followers
Profile picture of martin

martin

Linux · ·
Last updated Dec 7, 2022 - 11:13 PM Visible also to unregistered users
# Moving LibreNMS over to 64bit .rrd files could not be read on the 64bit machine with the error:\ `ERROR: reached EOF while loading header rrd->ds_def` The only solution was to dump them to xml, transfer them to the new machine and convert them back. ## rrd2xml ``` #!/bin/bash readonly cDir="${1:?"Please provide a directory to search for .rrd"}" export readonly outDir="/tmp/xmlrrd" _conv() { local lDir="$(dirname -- "$(readlink -f -- "$@")")" local lDirBase="$(basename -- "${lDir}")" local lOutDir="${outDir}/${lDirBase}" local lFile="$(basename -- "$@")" local lName="${lFile%%.*}" mkdir -p "${lOutDir}" rrdtool dump "$@" "${lOutDir}/${lName}.xml" } mkdir -p "${outDir}" export -f _conv find "${cDir}" -name "*.rrd" -exec bash -c '_conv "$0"' {} \; ``` ## xml2rrd ``` #!/bin/bash readonly cDir="${1:?"Please provide a directory to search for .xml"}" export readonly outDir="/tmp/rrd" _conv() { local lDir="$(dirname -- "$(readlink -f -- "$@")")" local lDirBase="$(basename -- "${lDir}")" local lOutDir="${outDir}/${lDirBase}" local lFile="$(basename -- "$@")" local lName="${lFile%%.*}" mkdir -p "${lOutDir}" rrdtool restore "$@" "${lOutDir}/${lName}.rrd" } mkdir -p "${outDir}" export -f _conv find "${cDir}" -name "*.xml" -exec bash -c '_conv "$0"' {} \; ```

Loading...