summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eba5e24)
raw | patch | inline | side by side (parent: eba5e24)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 23 Mar 2010 14:14:25 +0000 (14:14 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 23 Mar 2010 14:14:25 +0000 (14:14 +0000) |
contrib/rrdjig/rrdjig.pl | patch | blob | history |
index ff7e2986911cc6c484341894317dd77874b4397a..7c90f622f405327e52b861415becfc4ff998cf9b 100755 (executable)
--- a/contrib/rrdjig/rrdjig.pl
+++ b/contrib/rrdjig/rrdjig.pl
@tmpl = split /:/, $opt{'src-tmpl'};
}
my %map;
- my @min;
- my @max;
for my $cf (keys %$tasks){
print STDERR "FETCH #### CF $cf #####################################\n"
if $opt{verbose};
print STDERR "FETCH: want setp $t->{step} -> got step $step / want start $t->{start} -> got start $start\n" if $opt{verbose};
my $now = $start;
while (my $row = shift @$array){
- for (my $i = 0;$i < scalar @$array;$i++){
- if (defined $row->[$i]){
- $min[$i] = $row->[$i] if not defined $min[$i] or $row->[$i] < $min[$i];
- $max[$i] = $row->[$i] if not defined $max[$i] or $row->[$i] > $max[$i];
- }
- }
if (@tmpl){
push @{$data{$cf}} , [ $now, $step, [ @$row[@map{@tmpl}] ] ];
}
my $step = $start - $first;
unshift @{$data{AVERAGE}}, [ $start, $step, [ map {undef} @{$data{AVERAGE}[0][2]} ] ];
}
- if (@tmpl){
- return (\%data,[@min[@map{@tmpl}]],[@max[@map{@tmpl}]]);
- }
- else {
- return (\%data,\@min,\@max);
- }
+ return (\%data);
}
-sub reupdate($$$$$){
+sub reupdate($$$){
my $step = shift;
my $dst = shift;
my $data = shift;
- my $min = shift;
- my $max = shift;
+ my @min;
+ my @max;
my @pending = map { 0 } @{$data->{AVERAGE}[0][2]};
my $hide_cnt = 0;
my @up;
my $crow = $m->[2];
if ($cend >= $t and $cend - $cstep <= $t - $step){
my $row = "$t:".join(':',map {defined $_ ? $_ : 'U'} @{$crow});
+ if ($cf eq 'MIN'){
+ @min = @{$crow};
+ } else {
+ @max = @{$crow};
+ }
print STDERR ($cf eq 'MIN' ? 'm' : 'M' ) ,$row,"\n" if $opt{verbose};
push @up, $row;
$hide_cnt++;
for (my $i = 0; $i < @out; $i++){
if (defined $out[$i] and defined $pending[$i] and $pending[$i] != 0){
my $new = $out[$i] + $pending[$i];
- if (defined $max->[$i] and $new > $max->[$i]) {
- $pending[$i] = $new - $max->[$i];
- $out[$i] = $max->[$i];
+ if (defined $max[$i] and $new > $max[$i]) {
+ $pending[$i] = $new - $max[$i];
+ $out[$i] = $max[$i];
# print STDERR " - maxout $i $out[$i]\n" if $opt{verbose};
}
- elsif (defined $min->[$i] and $new < $min->[$i]){
- $pending[$i] = $new - $min->[$i];
- $out[$i] = $min->[$i];
+ elsif (defined $min[$i] and $new < $min[$i]){
+ $pending[$i] = $new - $min[$i];
+ $out[$i] = $min[$i];
# print STDERR " - minout $i $out[$i]\n" if $opt{verbose};
}
else {
my $src_info = RRDs::info($src);
rrd_err_check();
my ($first,$fetch_tasks) = prep_fetch_tasks($src_info,$dst_info);
- my ($updates,$min,$max) = fetch_data($src,$first,$fetch_tasks);
+ my $updates = fetch_data($src,$first,$fetch_tasks);
set_gauge($dst,$dst_info);
- reupdate($src_info->{step},$dst,$updates,$min,$max);
+ reupdate($src_info->{step},$dst,$updates);
unset_gauge($dst,$dst_info);
}