#!/bin/sh
#------------------------------------------------------------------------------
# OPT_RRDTOOL   /etc/rrdtool/umts.val                              __FLI4LVER__
# Creation:     2010-04-20
# Last Update:  $Id$
#
# rrdtool umts Datenerfassung 
#------------------------------------------------------------------------------

[ -z "$RDTOOL_CONF_LOADED" ] && . /var/run/rrdtool.conf

local source=umts
eval local idx='$RRDTOOL_'$source'_ID'
eval local options='$RRDTOOL_'$idx'_OPTIONS_STRING'

val=`get_umts_csq rrd`

for item in $options
do
    local db_file=$RRDTOOL_DB_PATH/$source/$item.rrd
    value="U"
    case "$item" in
    "signal")
        value=`echo $val | cut -d "," -f 1`
        if [ x$value = x99 -o x$value = x ] ; then
          value="U"
        else
          value=`expr $value \* 2 - 113`
        fi
        rrdtool update $db_file \
        N:$value
        ;;
    "error")
        value=`echo $val | cut -d "," -f 2`
        [ x$value = x99 -o x$value = x ] && value="U"
        rrdtool update $db_file \
        N:$value
        ;;
    esac
done
