Changeset 1497

Show
Ignore:
Timestamp:
02/28/08 23:28:02 (4 years ago)
Author:
jo
Message:

Repaired limits handling in munin-html.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • people/jo/multilevel-groups-2/server/Munin.pm.in

    r1496 r1497  
    12221222# - Failure: undef 
    12231223sub munin_field_status { 
    1224     my ($config, $limits, $check_draw) = @_; 
     1224    my ($hash, $limits, $check_draw) = @_; 
    12251225    my $state = undef; 
    12261226 
    12271227    # Return undef if nagios is turned off, or the field doesn't have any limits 
    1228     if ((!defined munin_get ($config, "warning", undef)) and (!defined munin_get ($config, "critical"))) { 
     1228    if ((!defined munin_get ($hash, "warning", undef)) and (!defined munin_get ($hash, "critical"))) { 
    12291229        return undef; 
    12301230    } 
    12311231 
    1232     my $loc = munin_get_node_loc ($config); 
    1233  
    1234     if (defined munin_get_node ($limits, [$loc,"critical"]) and (!defined $check_draw or !$check_draw or munin_draw_field ($config))) { 
    1235         return "critical"; 
    1236     } elsif (defined munin_get_node ($limits, [$loc,"warning"]) and (!defined $check_draw or !$check_draw or munin_draw_field ($config))) { 
    1237         return "warning"; 
    1238     } else { 
    1239         return "ok"; 
     1232    if (!defined $check_draw or !$check_draw or munin_draw_field ($hash)) { 
     1233        my $loc  = munin_get_node_loc ($hash); 
     1234        my $node = munin_get_node ($limits, $loc); 
     1235        return $node->{"state"} || "ok"; 
    12401236    } 
    12411237} 
  • people/jo/multilevel-groups-2/server/munin-graph.in

    r1494 r1497  
    986986    my $dirname = shift; 
    987987 
    988     if (!$log->opened) 
    989     { 
    990           unless (open ($log, ">>$dirname/munin-graph.log")) 
    991           { 
    992                   print STDERR "Warning: Could not open log file \"$dirname/munin-graph.log\" for writing: $!"; 
    993           } 
     988    if (!$log->opened) { 
     989        unless (open ($log, ">>$dirname/munin-graph.log")) { 
     990            print STDERR "Warning: Could not open log file \"$dirname/munin-graph.log\" for writing: $!"; 
     991        } 
     992    } else { 
     993        close (STDERR); 
     994        *STDERR = \$log; 
    994995    } 
    995996} 
    996997 
    997998sub logger { 
    998   my ($comment) = @_; 
    999   my $now = strftime "%b %d %H:%M:%S", localtime; 
    1000  
    1001   print "$now - $comment\n" if $stdout; 
    1002   if ($log->opened) 
    1003   { 
    1004           print $log "$now - $comment\n"; 
    1005   } 
    1006   else 
    1007   { 
    1008           if (defined $config->{logdir}) 
    1009           { 
    1010                   if (open ($log, ">>$config->{logdir}/munin-graph.log")) 
    1011                   { 
    1012                           print $log "$now - $comment\n"; 
    1013                           $log->flush; 
    1014                           close (STDERR); 
    1015                           open (STDERR, ">&", $log); 
    1016                   } 
    1017                   else 
    1018                   { 
    1019                           print STDERR "Warning: Could not open log file \"$config->{logdir}/munin-graph.log\" for writing: $!"; 
    1020                           print STDERR "$now - $comment\n"; 
    1021                   } 
    1022           } 
    1023           else 
    1024           { 
    1025                   print STDERR "$now - $comment\n"; 
    1026           } 
     999    my ($comment) = @_; 
     1000    my $now = strftime "%b %d %H:%M:%S", localtime; 
     1001 
     1002    print "$now - $comment\n" if $stdout; 
     1003    if ($log->opened) { 
     1004        print $log "$now - $comment\n"; 
     1005    } else { 
     1006        if (defined $config->{logdir}) { 
     1007            if (open ($log, ">>$config->{logdir}/munin-graph.log")) { 
     1008                print $log "$now - $comment\n"; 
     1009                $log->flush; 
     1010                close (STDERR); 
     1011                open (STDERR, ">&", $log); 
     1012            } else { 
     1013                print STDERR "Warning: Could not open log file \"$config->{logdir}/munin-graph.log\" for writing: $!"; 
     1014                print STDERR "$now - $comment\n"; 
     1015            } 
     1016        } else { 
     1017            print STDERR "$now - $comment\n"; 
     1018        } 
    10271019    } 
    10281020} 
  • people/jo/multilevel-groups-2/server/munin-html.in

    r1493 r1497  
    103103$config = &munin_config ($conffile, $config); 
    104104$limits = &munin_readconfig ($config->{dbdir}."/limits", 1, 1); 
     105print "Dumper: ", Dumper($limits); 
    105106if (!defined $config->{'cgiurl_graph'}) 
    106107{ 
     
    554555        $field_info{'info'}  = munin_get ($fieldobj, "info"); 
    555556 
    556         my $state = munin_field_status ($config, $limits, 1); 
     557        my $state = munin_field_status ($fieldobj, $limits, 1); 
     558        logger ("state of ".join('::',@{munin_get_node_loc ($fieldobj)}).": $state"); 
    557559 
    558560        if (defined $state) {