Am 24.03.2011 15:18, schrieb David OBrien: > Is there a way to get the create statement used to create the rrd? > > If not can we have something Like > > rrdtool showcreate eth0.rrd
David, this doesn't seem to exist and I stumbled over the same requirement a few years ago and back then I hacked up a little bash script which does exactly that - using the output from rrdtool info. It doesn't support the full rrd create syntax - especially support for the COMPUTE DS-type and the Aberrant Behavior Detection has been left out because it was more complex to add and I don't need it. Feel free to add the missing functionality if you want. The script is attached for everybodies convenience. (if it makes it through the mailing list) Of course it is provided as-is and with no support. Use on your own risk. - Karl
#!/bin/bash RRDTOOL=($(which rrdtool)) function rrdinfo() { $RRDTOOL info $1 \ | while read line; do key=${line%% = *} pri=${key%%[*} ind=${key%%]*} ind=${ind##*[} sub=${key##*.} value=${line##* = } num=${value/0000e/e} num=${num/0000e/e} num=${num/00e/e} num=${num/0e/e} num=${num/.e/e} num=${num/e+00/} num=${num/#NaN/U} case "$pri" in filename) echo "rrdtool create $value" ;; step) echo -e "\t--step $value" ;; ds) case "$sub" in value) echo -e "\tDS:$DS:$TYPE:$HB:$MIN:$MAX" ;; type) DS=$ind TYPE=${value//\"} case "$TYPE" in GAUGE|COUNTER|DERIVE|ABSOLUTE) # ok ;; *) echo "unknown data source type $TYPE" exit 1 ;; esac ;; minimal_heartbeat) HB=$value ;; min) MIN=$num ;; max) MAX=$num ;; esac ;; rra) case "$sub" in unknown_datapoints) if [ -n "$CF" ]; then echo -e "\tRRA:$CF:$XFF:$PDPS:$ROWS" CF="" fi ;; cf) CF=${value//\"} case "$CF" in AVERAGE|MIN|MAX|LAST) # OK ;; *) echo "unknown consolidation $CF" exit 1 ;; esac ;; xff) XFF=$num ;; pdp_per_row) PDPS=$num ;; rows) ROWS=$num ;; esac ;; esac done echo "" } while [ -n "$1" ]; do if [ -r $1 ]; then rrdinfo $1 fi shift done
_______________________________________________ rrd-users mailing list rrd-users@lists.oetiker.ch https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users