From: <dba...@us...> - 2009-09-11 07:27:37
|
Revision: 147 http://devmon.svn.sourceforge.net/devmon/?rev=147&view=rev Author: dbaldwin Date: 2009-09-11 07:27:31 +0000 (Fri, 11 Sep 2009) Log Message: ----------- dm_tests.pm - fixes for TRANSFORM dependencies undefined and multiple RRD data items Modified Paths: -------------- trunk/modules/dm_tests.pm Modified: trunk/modules/dm_tests.pm =================================================================== --- trunk/modules/dm_tests.pm 2009-09-11 07:15:51 UTC (rev 146) +++ trunk/modules/dm_tests.pm 2009-09-11 07:27:31 UTC (rev 147) @@ -94,11 +94,19 @@ $g{'hobbit_color'}{$device} eq 'green') { # First transform any data and do threshold evaluations - for my $oid (keys %$oids) { + my @translist = keys %$oids; + my %skiplist = (); + for my $oid (@translist) { # Only transform if we dont already have values for this oid next if !$oids->{$oid}{'transform'} or defined $oids->{$oid}{'val'}; - transform($device, $oids, $oid, $thr); + # Only transform if we have dependent value, otherwise push onto end of queue (not a perfect solution, but better than before) + if(ref $oids->{$oid}{trans_data} eq "HASH" && ! defined $oids->{$oids->{$oid}{trans_data}{dep_oid}}{val}) { + do_log("Skipping oid $oid until ".$oids->{$oid}{trans_data}{dep_oid}." defined for $device") if $g{debug}; + push @translist,($oid) unless $skiplist{$oid}++; + } else { + transform($device, $oids, $oid, $thr); + } } } @@ -1898,7 +1906,8 @@ $rrd{$name}{'pri'} = $oid if $rrd{$name}{'pri'} eq 'pri'; if ($rrd{$name}{'all'} or $alarm) { - push @{$rrd{$name}{'leaves'}}, $leaf; + # add to list, but check we're not pushing multiple times + push @{$rrd{$name}{'leaves'}}, $leaf unless grep {$_ eq $leaf} @{$rrd{$name}{'leaves'}}; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |