3 #makes things work when run without install
4 use lib qw( @prefix@/lib/perl );
13 RRDs::create ($rrd, "--start",$start-1, "--step",300,
16 "RRA:AVERAGE:0.5:1:300",
21 my $ERROR = RRDs::error;
22 die "$0: unable to create `$rrd': $ERROR\n" if $ERROR;
24 # dropt some data into the rrd
26 for ($t=$start; $t<$start+300*300; $t+=300){
27 RRDs::update $rrd, "$t:".(sin($t/3000)*50+50).":".(sin($t/2500)*50+50);
28 if ($ERROR = RRDs::error) {
29 die "$0: unable to update `$rrd': $ERROR\n";
38 RRDs::graph "$name-L.png",
47 "DEF:a=$rrd:a:AVERAGE",
48 "DEF:b=$rrd:b:AVERAGE",
49 "LINE1:a#$c1:Value A",
50 "LINE3:b#$c2:Value B",
53 RRDs::graph "$name-A.png",
54 "--title", "LINE and AREA",
62 "DEF:a=$rrd:a:AVERAGE",
63 "DEF:b=$rrd:b:AVERAGE",
65 "LINE2:b#$c2:Value B",
68 RRDs::graph "$name-S.png",
69 "--title", "STACKED AREAS",
77 "DEF:a=$rrd:a:AVERAGE",
78 "DEF:b=$rrd:b:AVERAGE",
80 "STACK:b#$c2:Value B",
84 RRDs::graph "$name-M.png",
85 "--title", "RPN Magic",
93 "DEF:a=$rrd:a:AVERAGE",
94 "DEF:b=$rrd:b:AVERAGE",
95 "CDEF:alpha=TIME,3600,%,1800,LT,a,UNKN,IF",
96 "CDEF:beta=TIME,3600,%,1800,GE,b,UNKN,IF",
97 "AREA:alpha#$c1:Value A",
99 "AREA:beta#$c2:Value B",
103 RRDs::graph "$name-sample.png",
106 "--end", "start+15h",
112 "DEF:a=$rrd:a:AVERAGE",
114 "AREA:a#00ff00:Incoming",
115 "LINE1:b#ff0000:Max Incoming",
118 if ($ERROR = RRDs::error) {
119 print "ERROR: $ERROR\n";
122 print "This script has created $name.png in the current directory\n";
123 print "This demonstrates the use of the TIME and % RPN operators\n";