1 #!/usr/bin/perl
2 #$ENV{PATH}='/scratch/rrd4/bin';
3 use Math::BigInt;
4 $ENV{PATH}=$ENV{HOME}.'/checkouts/rrdtool/branches/1.3/program/src:'.$ENV{PATH};
5 my $R=rrdtool;
6 my $w=320 ;
7 my $h=200 ;
8 my $start = 1199999700;
9 if (not -f 'b.rrd'){
10 system $R,'create','b.rrd',
11 '--step' => 300,
12 '--start' => ($start-1),
13 'DS:a:COUNTER:600:U:U',
14 'RRA:AVERAGE:0.4:1:2100';
16 my @updates;
17 my $count = Math::BigInt->new(0);
18 my $add = Math::BigInt->new('70000000000000') ;
19 for (my $i = 1; $i < 100;$i++){
20 $count = $count + $add * Math::BigInt->new(''.int(rand(10)));
21 print "$count\n";
22 push @updates, ($i*300+$start).':'.$count;
23 }
24 system $R,'update','b.rrd',@updates;
25 }
27 sub rg {
28 my $file = shift;
29 print STDERR $file,"\t";
30 if (-f $file){
31 print STDERR " skip\n";
32 return;
33 }
34 my @G = ( '--start' => $start+3600,
35 '--end' => $start + 100 * 280,
36 # '--full-size-mode',
37 '--color=BACK#ffff',
38 '--color=CANVAS#ffff',
39 '--color=SHADEA#ffff',
40 '--color=SHADEB#ffff',
41 '--lower-limit' => 0,
42 '--pango-markup',
43 '--height' => $h, '--width' => $w,
44 '--imgformat' => 'PDF',
45 'DEF:a=b.rrd:a:AVERAGE');
46 system $R, 'graph', $file, @G, @_;
47 }
49 rg 'bigLINE.pdf',
50 '--lower-limit' => 1000,
51 'LINE:a#11a03b:DEF\:a=x.rrd\:a\:AVERAGE',