[rrd-users] minor nit in rrdtutorial(1)

Rick Jones rick.jones2 at hp.com
Fri Apr 22 19:02:40 CEST 2011


OK, perhaps I'm confused - every other example with CDEF and
multiplication in the tutorial manpage has the '*' escaped or quoted:


> As most people have a better feel for numbers in this range, we'll
>        correct that. We could recreate our database and store the correct
>        data, but there is a better way: we do some calculations while creating
>        the png file!
> 
>           rrdtool graph speed2.png                           \
>              --start 920804400 --end 920808000               \
>              --vertical-label m/s                            \
>              DEF:myspeed=test.rrd:speed:AVERAGE              \
>              CDEF:realspeed=myspeed,1000,\*                  \
>              LINE2:realspeed#FF0000
> 
>        Note: I need to escape the multiplication operator * with a backslash.
>        If I don't, the operating system may interpret it and use it for file
>        name expansion. You could also place the line within quotation marks
>        like so:
> 
>              "CDEF:realspeed=myspeed,1000,*"                  \
> 
>        It boils down to: it is RRDtool which should see *, not your shell.
>        And it is your shell interpreting \, not RRDtool. You may need to
>        adjust examples accordingly if you happen to use an operating system or
>        shell which behaves differently.

...


> Now let's create this PNG, and add some more magic ...
> 
>         rrdtool graph speed3.png                             \
>              --start 920804400 --end 920808000               \
>              --vertical-label km/h                           \
>              DEF:myspeed=test.rrd:speed:AVERAGE              \
>              "CDEF:kmh=myspeed,3600,*"                       \
>              CDEF:fast=kmh,100,GT,kmh,0,IF                   \
>              CDEF:good=kmh,100,GT,0,kmh,IF                   \
>              HRULE:100#0000FF:"Maximum allowed"              \
>              AREA:good#00FF00:"Good speed"                   \
>              AREA:fast#FF0000:"Too fast"
> 
>        Note: here we use another means to escape the * operator by enclosing
>        the whole string in double quotes.

But the one in "Graphics Magic" does not:


> Graphics Magic
>        I like to believe there are virtually no limits to how RRDtool graph
>        can manipulate data. I will not explain how it works, but look at the
>        following PNG:
> 
>           rrdtool graph speed4.png                           \
>              --start 920804400 --end 920808000               \
>              --vertical-label km/h                           \
>              DEF:myspeed=test.rrd:speed:AVERAGE              \
>              CDEF:nonans=myspeed,UN,0,myspeed,IF             \
>              CDEF:kmh=nonans,3600,*                          \
>              CDEF:fast=kmh,100,GT,100,0,IF                   \
>              CDEF:over=kmh,100,GT,kmh,100,-,0,IF             \
>              CDEF:good=kmh,100,GT,0,kmh,IF                   \
>              HRULE:100#0000FF:"Maximum allowed"              \
>              AREA:good#00FF00:"Good speed"                   \
>              AREA:fast#550000:"Too fast"                     \
>              STACK:over#FF0000:"Over speed"

rick jones



More information about the rrd-users mailing list