This shows you the differences between two versions of the page.
saisp:labs:03:contents:05 [2014/04/04 10:55] razvan.deaconescu [05. [20p] Baze de date Round Robin (RRD)] |
saisp:labs:03:contents:05 [2014/04/05 12:08] (current) mihai.carabas [05. [20p] Baze de date Round Robin (RRD)] |
||
---|---|---|---|
Line 42: | Line 42: | ||
rm -rf target.rrd | rm -rf target.rrd | ||
- | #obtinem data de inceput | + | # Init timestamp. |
- | data=$(date +%s) | + | timestamp=$(date +%s) |
- | #o facem multiplu de 5 | + | # Align timestamp to multiple of 5 seconds. |
- | data=$(($data/5*5)) | + | timestamp=$(($timestamp/5*5)) |
- | data_init=$data | + | init_timestamp=$timestamp |
rrdtool create target.rrd \ | rrdtool create target.rrd \ | ||
- | --start $data \ | + | --start $timestamp \ |
--step 5 \ | --step 5 \ | ||
DS:speedIn:COUNTER:10:U:U \ | DS:speedIn:COUNTER:10:U:U \ | ||
Line 59: | Line 59: | ||
for i in $(seq 1 24); do | for i in $(seq 1 24); do | ||
sleep 5 | sleep 5 | ||
- | data=$(($data + 5)) | + | timestamp=$(($timestamp + 5)) |
outOctets=$(...) | outOctets=$(...) | ||
inOctets=$(...) | inOctets=$(...) | ||
- | rrdtool update target.rrd $data:$inOctets:$outOctets | + | rrdtool update target.rrd $timestamp:$inOctets:$outOctets |
done | done | ||
- | echo --start $data_init --end $data | + | echo --start $init_timestamp --end $timestamp |
</file> | </file> | ||
<solution -hidden> | <solution -hidden> |