Changeset 1497
- Timestamp:
- 02/28/08 23:28:02 (4 years ago)
- Files:
-
- people/jo/multilevel-groups-2/server/Munin.pm.in (modified) (1 diff)
- people/jo/multilevel-groups-2/server/munin-graph.in (modified) (1 diff)
- people/jo/multilevel-groups-2/server/munin-html.in (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
people/jo/multilevel-groups-2/server/Munin.pm.in
r1496 r1497 1222 1222 # - Failure: undef 1223 1223 sub munin_field_status { 1224 my ($ config, $limits, $check_draw) = @_;1224 my ($hash, $limits, $check_draw) = @_; 1225 1225 my $state = undef; 1226 1226 1227 1227 # 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"))) { 1229 1229 return undef; 1230 1230 } 1231 1231 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"; 1240 1236 } 1241 1237 } people/jo/multilevel-groups-2/server/munin-graph.in
r1494 r1497 986 986 my $dirname = shift; 987 987 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; 994 995 } 995 996 } 996 997 997 998 sub 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 } 1027 1019 } 1028 1020 } people/jo/multilevel-groups-2/server/munin-html.in
r1493 r1497 103 103 $config = &munin_config ($conffile, $config); 104 104 $limits = &munin_readconfig ($config->{dbdir}."/limits", 1, 1); 105 print "Dumper: ", Dumper($limits); 105 106 if (!defined $config->{'cgiurl_graph'}) 106 107 { … … 554 555 $field_info{'info'} = munin_get ($fieldobj, "info"); 555 556 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"); 557 559 558 560 if (defined $state) {
