2 use lib qw( @prefix@/lib/perl );
5 use vars qw(@ISA $loaded);
10 RRDs::create ($rrd, "--start",$start-1, "--step",300,
13 "RRA:AVERAGE:0.5:1:200");
14 my $ERROR = RRDs::error;
15 die "$0: unable to create `$rrd': $ERROR\n" if $ERROR;
17 for ($t=$start; $t<$start+200*300; $t+=300){
18 RRDs::update $rrd, "$t:".rand(100).":".(sin($t/800)*50+50);
19 if ($ERROR = RRDs::error) {
20 die "$0: unable to update `$rrd': $ERROR\n";
23 RRDs::graph "stripes.png",
24 "--title", "Stripes Demo",
26 "--end", "start + 400 min",
30 "DEF:a=$rrd:a:AVERAGE",
31 "DEF:b=$rrd:b:AVERAGE",
32 "CDEF:alpha=TIME,1200,%,600,LT,a,UNKN,IF",
33 "CDEF:beta=TIME,1200,%,600,GE,b,UNKN,IF",
34 "AREA:alpha#0022e9:alpha",
35 "AREA:beta#00b674:beta",
36 "LINE1:b#ff4400:beta envelope\\c",
38 "COMMENT:alpha=TIME,1200,%,600,LT,a,UNKN,IF",
39 "COMMENT:beta=TIME,1200,%,600,GE,b,UNKN,IF\\j";
40 if ($ERROR = RRDs::error) {
41 print "ERROR: $ERROR\n";
45 print "This script has created stripes.png in the current directory\n";
46 print "This demonstrates the use of the TIME and % RPN operators\n";