[rrd-users] rrdtool graph: parsing $variable problem

Alberto Sylvester sylvester at ilo.org
Fri Jul 15 11:02:32 MEST 2005


Hi

rrdtool (1.2.10) graph parse an environmental variable with spaces
adding quotes. If the variable EXTRA (see below) is set then rrdtool
tries to figure out best way to parse it. The other variables work
fine.

LEGEND=""
EXTRA=" --title 'CPU usage for the past $PERIOD' --vertical-label 'CPU
Usage (%)' "
if [ $1 == "CURRENT" ] ; then
        LEGEND="--no-legend"
        EXTRA=""
fi
rrdtool graph $GRAPH_PATH_CURRENT/cpu.png  \
          --imgformat PNG                                            \
          --start now-1$PERIOD                                 \
          --width $WIDTH                                  \
          --height $HEIGHT                                \
          --lower-limit 0                                 \
          --upper-limit 100                               \
          $LEGEND                                        \
          $EXTRA                                                       
 \
          DEF:user=$RRD_FILE:cpuuse:AVERAGE       \
(SNIP)

The result for this is:
rrdtool graph
/srv/www/htdocs/monitor/images/xray.ilo.ch/current/cpu.png --imgformat
PNG --start now-1d --width 400 --height 200 --lower-limit 0
--upper-limit 100 --title ''\''CPU' usage for the past 'd'\'''
--vertical-label ''\''CPU' Usage '(%)'\''' .....
and received the error:
ERROR: Could not make sense out of 'usage'

I tried:
EXTRA=" --title \'CPU usage for the past $PERIOD\' --vertical-label
\'CPU Usage (%)\'"
parsed as:
--title '\'\''CPU' usage for the past 'd\'\''' --vertical-label
'\'\''CPU' Usage '(%)\'\''' 

I tried also:
EXTRA="--title CPU usage for the past $PERIOD --vertical-label CPU
Usage \(%\)"
parsed as:
--title CPU usage for the past d --vertical-label CPU Usage '\(%\)'

I tried also:
EXTRA="\"--title CPU usage for the past $PERIOD\" \"--vertical-label
CPU Usage \(%\)\""
parsed as:
'"--title' CPU usage for the past 'd"' '"--vertical-label' CPU Usage
'\(%\)"'
and error changed to: ERROR: Could not make sense out of '"--title'

Thanks for any help
Alberto

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list