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",
22 my $ERROR = RRDs::error;
23 die "$0: unable to create `$rrd': $ERROR\n" if $ERROR;
25 # dropt some data into the rrd
27 for ($t=$start; $t<$start+300*300; $t+=300){
28 RRDs::update $rrd, "$t:".(sin($t/3000)*50+50).":".(sin($t/2500)*50+50);
29 if ($ERROR = RRDs::error) {
30 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",
120 print "ERROR: $ERROR\n" if $ERROR = RRDs::error;
125 print "This script has created $name.png in the current directory\n";
126 print "This demonstrates the use of the TIME and % RPN operators\n";