3 #makes things work when run without install
4 use lib qw( ../bindings/perl-shared/blib/lib ../bindings/perl-shared/blib/arch );
5 # this is for after install
6 use lib qw( @prefix@/lib/perl ../lib/perl );
11 my $rrd="randome.rrd";
15 RRDs::create ($rrd, "--start",$start-1, "--step",300,
18 "RRA:AVERAGE:0.5:1:300",
23 my $ERROR = RRDs::error;
24 die "$0: unable to create `$rrd': $ERROR\n" if $ERROR;
26 # dropt some data into the rrd
28 for ($t=$start; $t<$start+300*300; $t+=300){
29 RRDs::update $rrd, "$t:".(sin($t/3000)*50+50).":".(sin($t/2500)*50+50);
30 if ($ERROR = RRDs::error) {
31 die "$0: unable to update `$rrd': $ERROR\n";
40 RRDs::graph "$name-L.png",
49 "DEF:a=$rrd:a:AVERAGE",
50 "DEF:b=$rrd:b:AVERAGE",
51 "LINE1:a#$c1:Value A",
52 "LINE3:b#$c2:Value B",
55 RRDs::graph "$name-A.png",
56 "--title", "LINE and AREA",
64 "DEF:a=$rrd:a:AVERAGE",
65 "DEF:b=$rrd:b:AVERAGE",
67 "LINE2:b#$c2:Value B",
70 RRDs::graph "$name-S.png",
71 "--title", "STACKED AREAS",
79 "DEF:a=$rrd:a:AVERAGE",
80 "DEF:b=$rrd:b:AVERAGE",
82 "STACK:b#$c2:Value B",
86 RRDs::graph "$name-M.png",
87 "--title", "RPN Magic",
95 "DEF:a=$rrd:a:AVERAGE",
96 "DEF:b=$rrd:b:AVERAGE",
97 "CDEF:alpha=TIME,3600,%,1800,LT,a,UNKN,IF",
98 "CDEF:beta=TIME,3600,%,1800,GE,b,UNKN,IF",
99 "AREA:alpha#$c1:Value A",
101 "AREA:beta#$c2:Value B",
105 RRDs::graph "$name-sample.png",
108 "--end", "start+15h",
114 "DEF:a=$rrd:a:AVERAGE",
116 "AREA:a#00ff00:Incoming",
117 "LINE1:b#ff0000:Max Incoming",
120 if ($ERROR = RRDs::error) {
121 print "ERROR: $ERROR\n";
124 print "This script has created $name.png in the current directory\n";
125 print "This demonstrates the use of the TIME and % RPN operators\n";