Cacti (home)ForumsDocumentation

This is an old revision of the document!


Examples

For these examples, we will use some dummy rrd file, if not denoted otherwise. Create it using

rrdtool create test.rrd DS:test:COUNTER:600:U:U RRA:AVERAGE:0.5:1:100

Example:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--end=now \
--start=end-150000 \
--title="Default" \
--slope-mode \
DEF:a="test.rrd":test:AVERAGE \
CDEF:sine=a,POP,NOW,TIME,-,10000,/,SIN \
LINE1:sine#0000ff:sine

Default sine curve

Managing Graph Y-Axis

By default, rrdtool will create autoscaling graphs. Cacti's defaults are

  • check Auto Scale
  • select –alt-autoscale (ignoring given limits)

Example:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--end=now \
--start=end-150000 \
--title="Autoscale" \
--alt-autoscale \
--slope-mode \
DEF:a="test.rrd":test:AVERAGE \
CDEF:sine=a,POP,NOW,TIME,-,10000,/,SIN \
LINE1:sine#0000ff:sin

Autoscaled sine curve

This way, the graphs y-axis will automatically adjust for the range of values displayed. The common drawback is, that you will have to pay attention for the current y-axis scale, because it “jumps” from low to high values.

Using an Upper Limit

In order to define the same y-axis dimensions for a graph template,

  • check Auto Scale
  • select –alt-autoscale-min (accepting an upper limit, requires rrdtool 1.2.x)
  • define a numeric value for upper limit. e.g. 2

Example:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--end=now \
--start=end-150000 \
--title="Upper Limit" \
--alt-autoscale-min \
--upper-limit=2 \
--slope-mode \
DEF:a="test.rrd":test:AVERAGE \
CDEF:sine=a,POP,NOW,TIME,-,10000,/,SIN \
LINE1:sine#0000ff:sine

Upper Limit, when limit is not exceeded by data

Data exceeds given Limit

The following example uses the same graph configuration. But the data was tweaked to exceed the given limit. You will notice, that rrdtool automatically extends the y-axis despite the given –upper-limit!

Example:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--end=now \
--start=end-150000 \
--title="Upper Limit" \
--alt-autoscale-min \
--upper-limit=2 \
--slope-mode \
DEF:a="test.rrd":test:AVERAGE \
CDEF:sine=a,POP,NOW,TIME,-,10000,/,SIN,3,* \
LINE1:sine#0000ff:sine

Upper Limit, when limit **IS** exceeded by data

Data exceeds given Limit, Capped

The following example uses the same graph configuration; data tweaked to exceed the given limit. Now we use

  • check Auto Scale
  • select –alt-autoscale-min (accepting an upper limit, requires rrdtool 1.2.x)
  • define a numeric value for upper limit. e.g. 2
  • check Rigid Boundaries Mode (–rigid)

Example:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--end=now \
--start=end-150000 \
--title="Upper Limit" \
--alt-autoscale-min \
--upper-limit=2 \
--rigid \
--slope-mode \
DEF:a="test.rrd":test:AVERAGE \
CDEF:sine=a,POP,NOW,TIME,-,10000,/,SIN,3,* \
LINE1:sine#0000ff:sine

Upper Limit, capped, when limit **IS** exceeded by data

Notice:
Please note, that the upper y-axis is capped only, as we use –upper-limit

Graphing Data with a Small Standard Deviation






Personal Tools