Blame tests/p_rrdtool/rrdtool_test.sh
|
Christoph Galuschka |
26fe2d |
#!/bin/sh
|
|
Christoph Galuschka |
26fe2d |
# Author: Athmane Madjoudj <athmanem@gmail.com>
|
|
Christoph Galuschka |
26fe2d |
# Author: Christph Galuschka <christoph.galuschka@tiwag.at>
|
|
Christoph Galuschka |
26fe2d |
# RRD-sample from http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html
|
|
Christoph Galuschka |
26fe2d |
|
|
Christoph Galuschka |
26fe2d |
t_Log "Running $0 - basic rrdtool test."
|
|
Christoph Galuschka |
26fe2d |
|
|
Christoph Galuschka |
26fe2d |
# creating test RRD
|
|
Christoph Galuschka |
26fe2d |
|
|
Christoph Galuschka |
26fe2d |
FILE="/var/tmp/temperature.rrd"
|
|
Christoph Galuschka |
26fe2d |
|
|
Christoph Galuschka |
26fe2d |
rrdtool create $FILE --step 1 DS:temp:GAUGE:600:-273:5000 RRA:AVERAGE:0.5:1:1200
|
|
Christoph Galuschka |
26fe2d |
|
|
Christoph Galuschka |
26fe2d |
# insert value
|
|
Christoph Galuschka |
26fe2d |
rrdtool update $FILE N:30
|
|
Christoph Galuschka |
26fe2d |
|
|
Christoph Galuschka |
26fe2d |
# retrieve value and check
|
|
Christoph Galuschka |
26fe2d |
WORKING=$(rrdtool fetch $FILE AVERAGE -s -80 |grep -c '3.0000000000e+01')
|
|
Christoph Galuschka |
26fe2d |
|
|
Christoph Galuschka |
26fe2d |
# if $WORKING > 0 -> update and retrieval works
|
|
Christoph Galuschka |
26fe2d |
if [ $WORKING > 0 ]; then ret_val=0;
|
|
Christoph Galuschka |
26fe2d |
fi
|
|
Christoph Galuschka |
26fe2d |
|
|
Christoph Galuschka |
26fe2d |
#remove RRD-File
|
|
Christoph Galuschka |
26fe2d |
/bin/rm $FILE
|
|
Christoph Galuschka |
26fe2d |
|
|
Christoph Galuschka |
26fe2d |
t_CheckExitStatus $ret_val
|