By: ysuncn (You are welcome to reprint it. Please specify the original information)
I read some articles about the graph usage of the rrdtool drawing command. Some versions are outdated and the commands are different. Some of them are just like the graph in the "Hello World" I wrote before, extensive bandwidth, not targeted. Here are two examples that I think are classic and hope to help you: PS: If you practice it yourself, it's okay to change it to something related to the database.
Example 1: def extract data + understand the influence of time granularity (interval) on plotting.
Rrdtool graph def.png/
-- End now -- start end-120000s -- width 400/
-T "def application examples + comparison of different time granularities "/
-- Font title: 14: fzzhyjw. TTF/
Def: DSA =/home/rrdtool/data/router1.rrd: DSA: Average/
Def: DSB =/home/rrdtool/data/router1.rrd: DSB: average: Step = 1800/
Def: DSC =/home/rrdtool/data/router1.rrd: DSC: average: Step = 7200/
Line1: ds0a # 0000ff: "Default resolution 300 seconds/L "/
Line1: ds0b #00 CCFF: "resolution 1800 seconds per interval/L "/
Line1: ds0c # ff00ff: "Resolution 7200 seconds per interval/L"
Plot:
Example 2: vdef and cdef usage + axis label + horizontal and vertical lines + report generation + Update Time
Rrdtool graph graph.png/
-- End now -- start end-120000s -- width 400/
-T "Examples of vdef and cdef Applications "/
-- Font title: 14: fzzhyjw. TTF/
-- X-grid minute: 30: hour: 4: hour: 4: 0: % H: % m/
# One line per 30 minutes, one main line per 4 hours, and one label per 4 hours under the main line. The label format is "hour: minute"
-Y/
Def: ds0 =/home/rrdtool/data/router2.rrd: Inbound: Average/
Def: ds1 =/home/rrdtool/data/router2.rrd: Outbound: Average/
Vdef: ds0max = ds0, maximum/
Vdef: ds0avg = ds0, average/
Vdef: ds0min = ds0, minimum/
Vdef: ds0pct = ds0, 95, percent/
Vdef: ds1max = ds1, maximum/
Vdef: ds1avg = ds1, average/
Vdef: ds1min = ds1, minimum/
Vdef: ds1pct = ds1, 95, percent/
Cdef: ds0bits = ds0, 8 ,*/
Cdef: ds1bits = ds1, 8 ,*/
Comment :""/
Comment: "maximum "/
Comment: "average "/
Comment: "minimum "/
Comment: "95th percentile/L "/
Area: ds0bits #00ff00: "inbound "/
Uplint: ds0max: "% 6.2lf % sbps "/
Uplint: ds0avg: "% 6.2lf % sbps "/
Uplint: ds0min: "% 6.2lf % sbps "/
Uplint: ds0pct: "% 6.2lf % sbps/L "/
Line1: ds1bits # ff0000: "outbound "/
Uplint: ds1max: "% 6.2lf % sbps "/
Uplint: ds1avg: "% 6.2lf % sbps "/
Uplint: ds1min: "% 6.2lf % sbps "/
Uplint: ds1pct: "% 6.2lf % sbps/L "/
Comment: "/s "/
Vrule: 1186562026 #000000: X-mark/
Hrule: 1700000000 # 0000ff: Y-mark/
Comment: "Update Time/: 'date/" + % Y/% m/% d % H/: % m/: % S/"'" comment: "/L"
Plot:
Copyright 2007 ysuncn