started updating for 1.2 release
[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 This week and last week together
98
99     --end now --start end-1w
100     DEF:thisweek=router.rrd:ds0:AVERAGE
101     DEF:lastweek=router.rrd:ds0:AVERAGE:end=now-1w:start=end-1w
102 shift the data forward by one week (604800 seconds)
103     SHIFT:lastweek:604800
104     [ more of the usual VDEF and CDEF stuff if you like ]
105     AREA:lastweek#0000FF:Last\ week
106     LINE1:thisweek#FF0000:This\ week
107
108 =include see_also
109