File: modify5

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 (56 lines) | stat: -rwxr-xr-x 2,436 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash

. $(dirname $0)/functions

BASE=$BASEDIR/modify5-test
BUILD=$BUILDDIR/modify5-test

# create 2 RRDs only differing in the way that the second contains an additional RRA
# test: remove the additional RRA from the second and compare dumps
# test: add the additional RRA to the first and compare dumps 


$RRDTOOL create ${BUILD}a1.rrd --start 1300000000 --step 60 DS:a:GAUGE:120:0:U  RRA:AVERAGE:0.5:1:100 RRA:AVERAGE:0.5:5:2 RRA:MIN:0.5:5:2 RRA:MAX:0.5:5:2 RRA:LAST:0.5:5:2 || fail create1
$RRDTOOL create ${BUILD}a2.rrd --start 1300000000 --step 60 DS:a:GAUGE:120:0:U  RRA:AVERAGE:0.5:1:100 RRA:AVERAGE:0.5:5:2 RRA:MIN:0.5:5:2 RRA:MAX:0.5:5:2 RRA:LAST:0.5:5:2 RRA:AVERAGE:0.5:4:10 || fail create2

# add 50 values - note that we do NOT add it exactly for boundary times, and 
# that we end at a NON CDP boundary for 5-PDP RRAs:
N=10
UPDATE_STRING=""
for T in $(seq 1300000050 60 1300002990) ; do
	UPDATE_STRING="$UPDATE_STRING $T:$N"
	let N=$N+10
done
$RRDTOOL update ${BUILD}a1.rrd --template a $UPDATE_STRING || fail update1
$RRDTOOL update ${BUILD}a2.rrd --template a $UPDATE_STRING || fail update2

$RRDTOOL dump ${BUILD}a1.rrd | $DIFF9 ${BASE}a1-create.dump -
report create 1
$RRDTOOL dump ${BUILD}a2.rrd | $DIFF9 ${BASE}a2-create.dump -
report create 2

for U in 1300003010:200 1300003070:102 1300003130:777 1300003190:645 1300003250:122 1300003310:981 1300003323:223 1300003381:721 1300003445:821 1300003500:221 1300003562:231 1300003637:542 1300003699:734 1300003769:9231 1300003823:17
do
	echo ---------------------iterate--------------------------
	# update both - both contain same data 
	$RRDTOOL update ${BUILD}a1.rrd --template a $U
	$RRDTOOL update ${BUILD}a2.rrd --template a $U

	# dump current state for later comparison
	$RRDTOOL dump ${BUILD}a1.rrd > ${BUILD}a1-mod.dump.tmp
	$RRDTOOL dump ${BUILD}a2.rrd > ${BUILD}a2-mod.dump.tmp
	
	# remove RRA 5 from second RRD, should now match first RRD
	cp ${BASE}a2.rrd ${BASE}b2.rrd 
	$RRDTOOL tune ${BUILD}b2.rrd DELRRA:5

	$RRDTOOL dump ${BUILD}b2.rrd | diff -u ${BUILD}a1-mod.dump.tmp -
	report "remove additional RRA from second - must then be equal original first"

        # add RRA to first RRD, should now match second RRD
	cp ${BASE}a1.rrd ${BASE}b1.rrd
	$RRDTOOL tune ${BUILD}b1.rrd RRA:AVERAGE:0.5:4:10

	$RRDTOOL dump ${BUILD}b1.rrd | diff -u ${BUILD}a2-mod.dump.tmp -
	report "add additional RRA to first - must then be equal original second"
done