Cacti (home)ForumsDocumentation

Change y-Axis Scaling

This example has been taken from a discussion at rrdtool-users mailing list. It tackles a scenario, where barometric pressure values only differ by a very small number between polling cycles. Examples are done using rrdtool 1.3.8

Let me show you a set of numbers to demonstrate how it may look like without paying special attention:

rrdtool create test.rrd --start 1245448800 DS:test:GAUGE:300:U:U RRA:AVERAGE:0:1:10

rrdtool update test.rrd 1245449100:29.97
rrdtool update test.rrd 1245449400:29.96
rrdtool update test.rrd 1245449700:29.95
rrdtool update test.rrd 1245450000:29.94
rrdtool update test.rrd 1245450300:29.95
rrdtool update test.rrd 1245450600:29.96
rrdtool update test.rrd 1245450900:29.97
rrdtool update test.rrd 1245451200:29.98
rrdtool update test.rrd 1245451500:29.99

rrdtool graph test.png --start 1245448800 --end 1245451500 \
        --title "native autoscaling looks ugly" \
        --alt-autoscale \
        DEF:test=test.rrd:test:AVERAGE \
        LINE1:test#FF0000:test

Here's the result:

Native autoscaling looks ugly

You now may want to use –alt-y-grid. Not a bad idea, but lets look how it goes:

rrdtool create test.rrd --start 1245448800 DS:test:GAUGE:300:U:U RRA:AVERAGE:0:1:10

rrdtool update test.rrd 1245449100:29.97
rrdtool update test.rrd 1245449400:29.96
rrdtool update test.rrd 1245449700:29.95
rrdtool update test.rrd 1245450000:29.94
rrdtool update test.rrd 1245450300:29.95
rrdtool update test.rrd 1245450600:29.96
rrdtool update test.rrd 1245450900:29.97
rrdtool update test.rrd 1245451200:29.98
rrdtool update test.rrd 1245451500:29.99

rrdtool graph test.png --start 1245448800 --end 1245451500 \
        --title "autoscaling and alt-y-grid is better" \
        --alt-autoscale \
        --alt-y-grid \
        DEF:test=test.rrd:test:AVERAGE \
        LINE1:test#FF0000:test

And, again, the result:

autoscaling and alt-y-grid is better

The numbers on the y-axis are adjusted better. But there's more improvement achievable. Let's add the –rigid option:

rrdtool create test.rrd --start 1245448800 DS:test:GAUGE:300:U:U RRA:AVERAGE:0:1:10

rrdtool update test.rrd 1245449100:29.97
rrdtool update test.rrd 1245449400:29.96
rrdtool update test.rrd 1245449700:29.95
rrdtool update test.rrd 1245450000:29.94
rrdtool update test.rrd 1245450300:29.95
rrdtool update test.rrd 1245450600:29.96
rrdtool update test.rrd 1245450900:29.97
rrdtool update test.rrd 1245451200:29.98
rrdtool update test.rrd 1245451500:29.99

rrdtool graph test.png --start 1245448800 --end 1245451500 \
        --title "autoscaling, alt-y-grid and rigid is perfect" \
        --alt-autoscale \
        --alt-y-grid \
        --rigid \
        DEF:test=test.rrd:test:AVERAGE \
        LINE1:test#FF0000:test

This now results in:

autoscaling, alt-y-grid and rigid is perfect

which is quite acceptable.






Personal Tools