bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

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
Athmane Madjoudj 9b87af
if (t_GetPkgRel basesystem | grep -q el6)
Athmane Madjoudj a7b59b
then
Athmane Madjoudj 9b87af
    t_Log "Running $0 - basic rrdtool test."
Christoph Galuschka 26fe2d
Athmane Madjoudj 9b87af
    # creating test RRD
Christoph Galuschka 26fe2d
Athmane Madjoudj 9b87af
    FILE="/var/tmp/temperature.rrd"
Christoph Galuschka 26fe2d
Athmane Madjoudj 9b87af
    rrdtool create $FILE --step 1 DS:temp:GAUGE:600:-273:5000 RRA:AVERAGE:0.5:1:1200
Christoph Galuschka 26fe2d
Athmane Madjoudj 9b87af
    # insert value
Athmane Madjoudj 9b87af
    rrdtool update $FILE N:30
Christoph Galuschka 26fe2d
Athmane Madjoudj 9b87af
    # retrieve value and check
Athmane Madjoudj 9b87af
    WORKING=$(rrdtool fetch $FILE AVERAGE -s -80 |grep -c '3.0000000000e+01')
Athmane Madjoudj 9b87af
Athmane Madjoudj 9b87af
    # if $WORKING > 0 -> update and retrieval works
Athmane Madjoudj 9b87af
    if [ $WORKING > 0 ]; then ret_val=0;
Athmane Madjoudj 9b87af
    fi
Christoph Galuschka 26fe2d
Athmane Madjoudj 9b87af
    #remove RRD-File
Athmane Madjoudj 9b87af
    /bin/rm $FILE
Christoph Galuschka 26fe2d
Athmane Madjoudj 9b87af
    t_CheckExitStatus $ret_val
Athmane Madjoudj 9b87af
else
Athmane Madjoudj 9b87af
    echo "Skipped on CentOS 5"
Athmane Madjoudj 9b87af
fi