[rrd-users] rrdupdate problem
Andras Dosztal
adosztal at gmail.com
Thu Nov 22 16:34:20 CET 2007
Hi,
I have a problem updating my rrd files. My script should do the following:
1. Separate data from a raw file to variables
2. Update the rrd files (create them, if they don't exist) in every 10
minutes. The filename is <MAC_address>.rrd
3. Make some graphs.
The problem is that after updating, the rrd file contains only NaN
values. I get no errors when running the script. The raw data file is
attached, the script is the following:
////// Start of script //////
#!/bin/bash
OUTDIR="/srv/www/htdocs/rrd"
WORKDIR="${HOME}/rrd"
RAW=`cat $WORKDIR/raw.dat`
for i in $RAW
do
MAC=`echo $i | cut -d "," -f 1`
U_RX=`echo $i | cut -d "," -f 2`
U_SNR=`echo $i | cut -d "," -f 3`
M_TX=`echo $i | cut -d "," -f 4`
M_SNR=`echo $i | cut -d "," -f 5`
M_RX=`echo $i | cut -d "," -f 6`
if [ -s ${MAC}.rrd ]; then
rrdtool update ${WORKDIR}/${MAC}.rrd
N:${U_RX}:${U_SNR}:${M_TX}:${M_SNR}:${M_RX}
rrdtool graph -l -50 -u 70 -w 450 -h 130 -a PNG \
${OUTDIR}/${MAC}-jel-day.png \
--start -1d \
-t "Tx/Rx power" -v dBmV \
DEF:ubr_r=${WORKDIR}/${MAC}.rrd:u_rx:AVERAGE \
DEF:modem_r=${WORKDIR}/${MAC}.rrd:m_rx:AVERAGE \
DEF:tx_r=${WORKDIR}/${MAC}.rrd:m_tx:AVERAGE \
CDEF:ubr=ubr_r,10,/ \
CDEF:modem=modem_r,10,/ \
CDEF:tx=tx_r,10,/ \
LINE1:ubr#00AA00:"UBR Rx" \
LINE2:modem#AA0000:"Modem Rx" \
LINE3:tx#0000AA:"Modem Tx"
rrdtool graph -l 0 -u 40 -w 450 -h 130 -a PNG \
${OUTDIR}/${MAC}-snr-day.png \
--start -1d \
-t "SNR" -v dB \
DEF:u_snr_r=${WORKDIR}/${MAC}.rrd:u_snr:AVERAGE \
DEF:m_snr_r=${WORKDIR}/${MAC}.rrd:m_snr:AVERAGE \
CDEF:ubr=u_snr_r,10,/ \
CDEF:modem=m_snr_r,10,/ \
LINE1:ubr#00AA00:"UBR" \
LINE2:modem#AA0000:"Modem" \
else
rrdtool create ${WORKDIR}/${MAC}.rrd \
--step 600 \
--start now \
DS:u_rx:GAUGE:1200:U:U \
DS:u_snr:GAUGE:1200:0:U \
DS:m_tx:GAUGE:1200:0:U \
DS:m_snr:GAUGE:1200:0:U \
DS:m_rx:GAUGE:1200:U:U \
RRA:LAST:0.5:1:144 \
RRA:AVERAGE:0.5:6:168 \
RRA:AVERAGE:0.5:144:31 \
RRA:AVERAGE:0.5:1008:52
rrdtool update ${WORKDIR}/${MAC}.rrd
N:${U_RX}:${U_SNR}:${M_TX}:${M_SNR}:${M_RX}
fi
done
////// End of script //////
Could you help me to solve this problem? Thank you in advance.
Regards,
Andras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: raw.dat
Type: video/mpeg
Size: 3635 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-users/attachments/20071122/9bb6f0c9/attachment.m1v
More information about the rrd-users
mailing list