new command rrdtool xport integrated
[rrdtool.git] / doc / rrdgraph_examples.src
1 =include name
2
3 =head1 SYNOPSYS
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 Nicely formatted legend section
18
19     DEF:ds0=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
20     DEF:ds1=/home/rrdtool/data/router1.rrd:ds1:AVERAGE
21     VDEF:ds0max=ds0,MAXIMUM,8,*
22     VDEF:ds0avg=ds0,AVERAGE,8,*
23     VDEF:ds0min=ds0,MINIMUM,8,*
24     VDEF:ds0pct=95,ds0,PERCENTILE,8,*
25     VDEF:ds1max=ds1,MAXIMUM,8,*
26     VDEF:ds1avg=ds1,AVERAGE,8,*
27     VDEF:ds1min=ds1,MINIMUM,8,*
28     VDEF:ds1pct=95,ds1,PERCENTILE,8,*
29 Note: consolidation occurs here.
30     CDEF:ds0bits=ds0,8,*
31     CDEF:ds1bits=ds1,8,*
32 Note: 10 spaces to move text to the right
33     COMMENT:"          "
34 Note: three times size == 11 chars, "###.## xBps"
35     COMMENT:"Maximum    "
36     COMMENT:"Average    "
37     COMMENT:"Minimum    "
38 Note: last line contains new-line character
39     COMMENT:"95th percentile\n"
40     AREA:ds0bits#00C000:"Inbound "
41     GPRINT:ds0max:"%6.2lf %Sbps"
42     GPRINT:ds0avg:"%6.2lf %Sbps"
43     GPRINT:ds0min:"%6.2lf %Sbps"
44     GPRINT:ds0pct:"%6.2lf %Sbps\n"
45     LINE1:ds1bits#0000FF:"Outbound"
46     GPRINT:ds1max:"%6.2lf %Sbps"
47     GPRINT:ds1avg:"%6.2lf %Sbps"
48     GPRINT:ds1min:"%6.2lf %Sbps"
49     GPRINT:ds1pct:"%6.2lf %Sbps\n"
50
51 =head2 Offsetting a line on the y-axis
52
53 Depending on your needs you can do this in two ways:
54
55 =over 4
56
57 =item *
58
59 Offset the data, then graph this
60
61     DEF:mydata=my.rrd:ds:AVERAGE
62 Note: this will also influence anything that uses "data"
63     CDEF:data=mydata,100,+
64     LINE1:data#FF0000:"Data with offset"
65
66 =item *
67
68 Graph the original data, with an offset
69
70     DEF:mydata=my.rrd:ds:AVERAGE
71 Note: no color in the first line so it is not visible
72     LINE1:100
73 Note: the second line gets stacked on top of the first one
74     LINE1:data#FF0000:"Data with offset":STACK
75
76 =back
77
78 =head2 Time ranges
79
80     Last four weeks: --start end-4w --end 00:00
81     Januari 2001:    --start 200101010000 --end start+31d
82     Januari 2001:    --start 200101010000 --end 200102010000
83     Last hour:       --start end-1h
84     Last 24 hours:   <nothing at all>
85     Yesterday:       --end 00:00
86
87 =head2 Viewing Januari+Februari 2000 and 2001 together
88
89 Define a graph area of 31+29 days (!) spanning Jan. and Feb.
90     --start 20000101 --end 20000301
91     DEF:jan2000=router.rrd:ds0:AVERAGE:start 20000101 end start+31d
92     DEF:jan2001=router.rrd:ds0:AVERAGE:start 20010101 end start+31d
93 Note: mind the extra day in 2000 ...
94     DEF:feb2000=router.rrd:ds0:AVERAGE:start 20000201 end start+29d
95 Note: 29 feb 2001 is *unknown*
96     DEF:feb2001=router.rrd:ds0:AVERAGE:start 20010201 end start+28d
97     VDEF:offset=jan2001,FIRST,jan2000,FIRST,-,-1,*
98     [ more of the usual VDEF and CDEF stuff if you like ]
99     LINE1:jan2000#00003F:"Januari 2000"
100     [ gprint stuff ]
101     LINE1:feb2001#003F00:"Februari 2000"
102     [ gprint stuff ]
103 Note: offset is made negative by the VDEF statement
104     SHIFT:offset
105     LINE1:jan2001#0000FF:"Januari 2001"
106     [ gprint stuff ]
107     LINE1:feb2001#00FF00:"Februari 2001"
108     [ gprint stuff ]
109
110 =include see_also
111