3 #makes things work when run without install
4 use lib qw( ../libraries/perl-shared/blib/lib ../libraries/perl-shared/blib/arch );
5 # this is for after install
6 use lib qw( @prefix@/lib/perl ../lib/perl );
10 my $rrd="randome.rrd";
14 RRDs::create ($rrd, "--start",$start-1, "--step",300,
17 "RRA:AVERAGE:0.5:1:300");
18 my $ERROR = RRDs::error;
19 die "$0: unable to create `$rrd': $ERROR\n" if $ERROR;
21 # dropt some data into the rrd
23 for ($t=$start; $t<$start+300*300; $t+=300){
24 RRDs::update $rrd, "$t:".rand(100).":".(sin($t/800)*50+50);
25 if ($ERROR = RRDs::error) {
26 die "$0: unable to update `$rrd': $ERROR\n";
30 RRDs::graph "$name.png",
31 "--title", uc($name)." Demo",
32 "--start", "$start + 1 h",
33 "--end", "start + 1000 min",
37 "DEF:a=$rrd:a:AVERAGE",
38 "DEF:b=$rrd:b:AVERAGE",
39 "CDEF:line=TIME,2400,%,300,LT,a,UNKN,IF",
41 "AREA:line#0022e9:alpha",
46 if ($ERROR = RRDs::error) {
47 print "ERROR: $ERROR\n";
51 print "This script has created $name.png in the current directory\n";
52 print "This demonstrates the use of the TIME and % RPN operators\n";