big spell checking patch -- slif@bellsouth.net
[rrdtool.git] / doc / rrdgraph_examples.src
1 =include name
2
3 =head1 SYNOPSIS
4
5 B<rrdtool graph /home/httpd/html/test.png --img-format PNG \>
6
7 followed by any of the examples below
8
9 =head1 DESCRIPTION
10
11 For your convenience some of the commands are explained here
12 by using detailed examples. They are not always cut-and-paste
13 ready because comments are intermixed with the examples.
14
15 =head1 EXAMPLES
16
17 =head2 Data with multiple resolutions
18
19     --end now --start end-120000s --width 400
20     DEF:ds0a=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
21     DEF:ds0b=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=1800
22     DEF:ds0c=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=7200
23     LINE1:ds0a#0000FF:"default resolution\n"
24     LINE1:ds0b#00CCFF:"resolution 1800 seconds per interval\n"
25     LINE1:ds0c#FF00FF:"resolution 7200 seconds per interval\n"
26
27 =head2 Nicely formatted legend section
28
29     DEF:ds0=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
30     DEF:ds1=/home/rrdtool/data/router1.rrd:ds1:AVERAGE
31     VDEF:ds0max=ds0,MAXIMUM,8,*
32     VDEF:ds0avg=ds0,AVERAGE,8,*
33     VDEF:ds0min=ds0,MINIMUM,8,*
34     VDEF:ds0pct=95,ds0,PERCENTILE,8,*
35     VDEF:ds1max=ds1,MAXIMUM,8,*
36     VDEF:ds1avg=ds1,AVERAGE,8,*
37     VDEF:ds1min=ds1,MINIMUM,8,*
38     VDEF:ds1pct=95,ds1,PERCENTILE,8,*
39 Note: consolidation occurs here.
40     CDEF:ds0bits=ds0,8,*
41     CDEF:ds1bits=ds1,8,*
42 Note: 10 spaces to move text to the right
43     COMMENT:"          "
44 Note: three times size == 11 chars, "###.## xBps"
45     COMMENT:"Maximum    "
46     COMMENT:"Average    "
47     COMMENT:"Minimum    "
48 Note: last line contains new-line character
49     COMMENT:"95th percentile\n"
50     AREA:ds0bits#00C000:"Inbound "
51     GPRINT:ds0max:"%6.2lf %Sbps"
52     GPRINT:ds0avg:"%6.2lf %Sbps"
53     GPRINT:ds0min:"%6.2lf %Sbps"
54     GPRINT:ds0pct:"%6.2lf %Sbps\n"
55     LINE1:ds1bits#0000FF:"Outbound"
56     GPRINT:ds1max:"%6.2lf %Sbps"
57     GPRINT:ds1avg:"%6.2lf %Sbps"
58     GPRINT:ds1min:"%6.2lf %Sbps"
59     GPRINT:ds1pct:"%6.2lf %Sbps\n"
60
61 =head2 Offsetting a line on the y-axis
62
63 Depending on your needs you can do this in two ways:
64
65 =over 4
66
67 =item *
68
69 Offset the data, then graph this
70
71     DEF:mydata=my.rrd:ds:AVERAGE
72 Note: this will also influence anything that uses "data"
73     CDEF:data=mydata,100,+
74     LINE1:data#FF0000:"Data with offset"
75
76 =item *
77
78 Graph the original data, with an offset
79
80     DEF:mydata=my.rrd:ds:AVERAGE
81 Note: no color in the first line so it is not visible
82     LINE1:100
83 Note: the second line gets stacked on top of the first one
84     LINE1:data#FF0000:"Data with offset":STACK
85
86 =back
87
88 =head2 Time ranges
89
90     Last four weeks: --start end-4w --end 00:00
91     Januari 2001:    --start 200101010000 --end start+31d
92     Januari 2001:    --start 200101010000 --end 200102010000
93     Last hour:       --start end-1h
94     Last 24 hours:   <nothing at all>
95     Yesterday:       --end 00:00
96
97 =head2 Viewing Januari+Februari 2000 and 2001 together
98
99 Define a graph area of 31+29 days (!) spanning Jan. and Feb.
100     --start 20000101 --end 20000301
101     DEF:jan2000=router.rrd:ds0:AVERAGE:start 20000101 end start+31d
102     DEF:jan2001=router.rrd:ds0:AVERAGE:start 20010101 end start+31d
103 Note: mind the extra day in 2000 ...
104     DEF:feb2000=router.rrd:ds0:AVERAGE:start 20000201 end start+29d
105 Note: 29 feb 2001 is *unknown*
106     DEF:feb2001=router.rrd:ds0:AVERAGE:start 20010201 end start+28d
107     VDEF:offset=jan2001,FIRST,jan2000,FIRST,-,-1,*
108     [ more of the usual VDEF and CDEF stuff if you like ]
109     LINE1:jan2000#00003F:"Januari 2000"
110     [ gprint stuff ]
111     LINE1:feb2001#003F00:"Februari 2000"
112     [ gprint stuff ]
113 Note: offset is made negative by the VDEF statement
114     SHIFT:offset
115     LINE1:jan2001#0000FF:"Januari 2001"
116     [ gprint stuff ]
117     LINE1:feb2001#00FF00:"Februari 2001"
118     [ gprint stuff ]
119
120 =include see_also
121