MRTG Implementation Manual
Table of Contents

 

8. Generating on-demand MRTG graphs based on the data stored in the RRD databases
 

Similar to the XPORT function is the GRAPH function, which builds graphs for specific past periods of time and is also able to graph multiple variables in the same graph. 
 

The syntax is: 
 

rrdtool graph filename   [-s|--start seconds] [-e|--end seconds] [-x|--x-grid x-axis grid and label] 
                                       [-y|--y-grid y-axis grid and label] [--alt-y-grid] [--alt-y-mrtg] [--alt-autoscale] 
                                       [--alt-autoscale-max] [--units-exponent] value]> [-v|--vertical-label text] 
                                       [-w|--width pixels] [-h|--height pixels] [-i|--interlaced] 
                                       [-f|--imginfo formatstring] [-a|--imgformat  GIF| PNG| GD] 
                                       [ -B|--background value] [ -O|--overlay value] [ -U|--unit value] [-z|--lazy] 
                                       [-o|--logarithmic] [-u|--upper-limit value] [-l|--lower-limit value] 
                                       [-g|--no-legend] [-r|--rigid] [--step value] [-b|--base value] 
                                       [-c|--color  COLORTAG#rrggbb] [-t|--title title] 
                                       [ DEF:vname=rrd:ds-name: CF] [ CDEF:vname=rpn-expression] 
                                       [ PRINT:vname: CF:format] [ GPRINT:vname: CF:format] 
                                       [ COMMENT:text] [ HRULE:value#rrggbb[:legend]] 
                                       [ VRULE:time#rrggbb[:legend]] [ LINE{1|2|3}:vname[#rrggbb[:legend]]] 
                                       [ AREA:vname[#rrggbb[:legend]]] [ STACK:vname[#rrggbb[:legend]]]
 

An example: 

rrdtool graph my-graph.gif         -s 1035289500    -e 1035295200    -t Interface/Port-channel1
                                                 DEF:xx=10.0.0.1_po1.rrd:ds0:AVERAGE
                                                 DEF:yy=10.0.0.1_po1.rrd:ds1:AVERAGE
                                                 CDEF:myxx=xx,8,*
                                                 CDEF:myyy=yy,8,*
                                                 AREA:myxx#00ff00:Input-traffic/Bits-per-sec 
                                                 LINE1:myyy#0000ff:Output-traffic/Bits-per-sec

The output of this command is the following graph: 
 


 

The GRAPH function could be called from the command prompt or from a web interface to have the graphs available over http. 

Note: For more details on all GRAPH options go to http://www.rrdtool.com/
 


<Next Chapter>