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