3 #makes things work when run without install
4 use lib qw( ../libraries/perl-shared/blib/lib ../libraries/perl-shared/blib/arch );
6 #makes programm work AFTER install
7 use lib qw( /usr/local/rrdtool-1.0.33/lib/perl ../lib/perl );
10 use vars qw(@ISA $loaded);
14 my $rrd="randome.rrd";
15 RRDs::create ($rrd, "--start",$start-1, "--step",300,
18 "RRA:AVERAGE:0.5:1:200");
19 my $ERROR = RRDs::error;
20 die "$0: unable to create `$rrd': $ERROR\n" if $ERROR;
22 for ($t=$start; $t<$start+200*300; $t+=300){
23 RRDs::update $rrd, "$t:".rand(100).":".(sin($t/800)*50+50);
24 if ($ERROR = RRDs::error) {
25 die "$0: unable to update `$rrd': $ERROR\n";
28 RRDs::graph "stripes.png",
29 "--title", 'Stripes Demo',
31 "--end", "start + 400 min",
35 "DEF:a=$rrd:a:AVERAGE",
36 "DEF:b=$rrd:b:AVERAGE",
37 "CDEF:alpha=TIME,1200,%,600,LT,a,UNKN,IF",
38 "CDEF:beta=TIME,1200,%,600,GE,b,UNKN,IF",
39 "AREA:alpha#0022e9:alpha",
40 "AREA:beta#00b674:beta",
41 "LINE1:b#ff4400:beta envelope\\c",
43 "COMMENT:CDEF\:alpha=TIME,1200,%,600,LT,a,UNKN,IF",
44 "COMMENT:CDEF\:beta=TIME,1200,%,600,GE,b,UNKN,IF\\j";
45 if ($ERROR = RRDs::error) {
46 print "ERROR: $ERROR\n";
50 print "This script has created stripes.png in the current directory\n";
51 print "This demonstrates the use of the TIME and % RPN operators\n";