2 # this is for after install
3 use lib qw( @prefix@/lib/perl );
11 RRDs::create ($rrd, "--start",$start-1, "--step",300,
14 "RRA:AVERAGE:0.5:1:300");
15 my $ERROR = RRDs::error;
16 die "$0: unable to create `$rrd': $ERROR\n" if $ERROR;
18 # dropt some data into the rrd
20 for ($t=$start; $t<$start+300*300; $t+=300){
21 RRDs::update $rrd, "$t:".rand(100).":".(sin($t/800)*50+50);
22 if ($ERROR = RRDs::error) {
23 die "$0: unable to update `$rrd': $ERROR\n";
27 RRDs::graph "$name.png",
28 "--title", uc($name)." Demo",
29 "--start", "$start + 1 h",
30 "--end", "start + 1000 min",
34 "DEF:a=$rrd:a:AVERAGE",
35 "DEF:b=$rrd:b:AVERAGE",
36 "CDEF:line=TIME,2400,%,300,LT,a,UNKN,IF",
38 "AREA:line#0022e9:alpha",
43 if ($ERROR = RRDs::error) {
44 print "ERROR: $ERROR\n";
48 print "This script has created $name.png in the current directory\n";
49 print "This demonstrates the use of the TIME and % RPN operators\n";