File: dump-restore

package info (click to toggle)
rrdtool 1.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,772 kB
  • sloc: ansic: 39,371; sh: 1,810; perl: 1,268; cs: 652; makefile: 573; python: 169; ruby: 61; awk: 30
file content (33 lines) | stat: -rwxr-xr-x 802 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

. $(dirname $0)/functions

BASE=$BASEDIR/$(basename $0)-test
BUILD=$BUILDDIR/$(basename $0)-test

ST=1300000000
$RRDTOOL create ${BUILD}a1.rrd --start $(($ST-1)) --step 60 DS:a:GAUGE:120:0:U  RRA:AVERAGE:0.5:1:20 RRA:AVERAGE:0.5:5:2 RRA:MIN:0.5:5:2 RRA:MAX:0.5:5:2 RRA:LAST:0.5:5:2 
report create1

V=10
N=0
CNT=25
for A in $(seq $ST 60 $(($ST + 60*($CNT - 1))) ) ; do
	V=$(($V + 20))
	N=$(($N + 1))
	ST=$A
	$RRDTOOL update ${BUILD}a1.rrd  $A:$V

	rm -f ${BASE}a1.xml ${BASE}r1.rrd ${BASE}r1.xml

	$RRDTOOL dump ${BUILD}a1.rrd ${BUILD}a1.xml
	$RRDTOOL restore ${BUILD}a1.xml ${BUILD}r1.rrd
	$RRDTOOL dump ${BUILD}r1.rrd ${BUILD}r1.xml

	$DIFF ${BUILD}a1.xml ${BUILD}r1.xml 
	report dump-restore-cycle $N/$CNT
done

rm -f ${BUILD}a1.xml ${BUILD}r1.rrd ${BUILD}r1.xml
rm -f ${BUILD}a1.rrd