rrdtool

Removing unwanted gridlines in RRDtool


I'm currently making a number of graphs for users on a server.

The code 'm using is as follows:

$RRDTOOL graph $SCUMCOUNTPATH/mtghour.png \
    --start now-3600s --end now \
    --alt-autoscale \
    -w 343 -h 85 \
    --lower-limit 0 \
    --title "Last 90 Minutes" \
    --color CANVAS#36393f00 \
    --color BACK#36393f00 \
    --color FONT#5b80e0 \
    --color GRID#888888 \
    --color MGRID#888888 \
    --color SHADEA#36393f \
    --color SHADEB#36393f \
    --x-grid MINUTE:5:HOUR:20:MINUTE:30:0:%M \
    --alt-y-grid --rigid \
    --left-axis-format %2.0lf \
    --rigid \
    --watermark "$(date +'%a %b %d %H:%M %Z %Y')" \
    DEF:nowcount=$SCUMCOUNTPATH/mtg.rrd:count:AVERAGE \
    CDEF:up=nowcount,0,*,0,EQ,0,1,IF \
    TICK:up#3b455e:1.0 \
    LINE2:nowcount#5b80e0: \
    GPRINT:nowcount:LAST:"         Current\:%2.0lf" \
    GPRINT:nowcount:AVERAGE:"Average\:%2.1lf" \
    GPRINT:nowcount:MAX:"Maximum\:%2.0lf         " >/dev/null

What this produces is this:

Too many Gridlines

What I would like it to produce is this (Photoshopped):

enter image description here

Extra info:

I'm using RRDtool 1.5.5 in a linux environment and running the script with BASH scheduled with cron.


Solution

  • The option you require is --y-grid, or possibly --alt-y-grid.

    First try using --alt-y-grid which tries to use a more intelligent algorithm to calculate optimum line placement. It might work better for you in general.

    Failing that, try --y-grid 1:1. This means "put a line every 1.0, and label every line". As comparison, what you're seeing in your first graph (that you don't want) is --y-grid 0.1:10 where a line goes every 0.1 but only 1 in 10 are labelled.

    More details in the RRDTool documentation here