[rrd-users] Printing some calculated current values on a graph?

Anssi Saari as at sci.fi
Tue Aug 12 12:46:00 MEST 2003


I've been playing with rrdtool a little and one graph I
made up is percentages of CPU states. An example picture is at
http://www.sci.fi/~as/cpu_states.png (I know the colors are awful, any
pointers on how to pick "cool" colors appreciated.) As Linux offers this
information directly on the first line of /proc/stat, for example

cpu  332335 392999 665724 5127563

I just stuff those values into an RRA and then do this with rrdgraph to
calculate percentages:

DEF:user=${c_rrd}:cpu_user:AVERAGE \
DEF:nice=${c_rrd}:cpu_nice:AVERAGE \
DEF:system=${c_rrd}:cpu_system:AVERAGE \
DEF:idle=${c_rrd}:cpu_idle:AVERAGE \
CDEF:total=user,nice,system,idle,+,+,+ \
"CDEF:user_p=user,total,/,100,*" \
"CDEF:nice_p=nice,total,/,100,*" \
"CDEF:system_p=system,total,/,100,*" \
"CDEF:idle_p=idle,total,/,100,*" \

But now I want to generate images on the fly with rrdcgi, which is easy,
but how do I put some text on the image detailing the current status?
Something like what top prints, i.e.

Cpu(s):   5.1% user,  10.2% system,   6.0% nice,  78.7% idle

But how can I print these CDEFed values? PRINT and GPRINT 
seem to need an RRD as a source.

It's obvious I can use perl (or anything) instead of rrdcgi or store
cpu percentages instead of the raw data but other than that?

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://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the rrd-users mailing list