Changeset 461
- Timestamp:
- 21/11/04 00:17:47 (7 years ago)
- Files:
-
- trunk/ChangeLog (modified) (1 diff, 1 prop)
- trunk/node/munin-node.in (modified) (8 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
- Property cvs2svn:cvs-rev changed from 1.178 to 1.179
r460 r461 26 26 * The node now changes dir to /, to make sure it's in a directory 27 27 readable by all users. 28 * Added per-plugin timeouts, contributed by Chan Wilson (SF#881044). 28 29 29 30 - Plugins trunk/node/munin-node.in
- Property cvs2svn:cvs-rev changed from 1.16 to 1.17
r429 r461 21 21 # 22 22 # $Log$ 23 # Revision 1.17 2004/11/20 23:17:47 jimmyo 24 # Added per-plugin timeouts, contributed by Chan Wilson (SF#881044). 25 # 23 26 # Revision 1.16 2004/11/16 20:00:42 jimmyo 24 27 # License cleanups. … … 136 139 my $paranoia= 0; 137 140 my @ignores = (); 138 my %sconf = (); 139 my $timeout = 10; 141 my %sconf = ('timeout' => 10); 140 142 my $caddr = ""; 141 143 … … 239 241 elsif (($1 eq "timeout") and defined $2) 240 242 { 241 $ timeout= $2;243 $sconf{'timeout'} = $2; 242 244 } 243 245 } … … 407 409 { 408 410 print ("# timeout pid $child - killing..."); 409 logger ("Plugin timeout ($timeout seconds): $text (pid $child)");411 logger ("Plugin timeout: $text (pid $child)"); 410 412 kill (-1, $child); sleep 2; 411 413 kill (-9, $child); … … 421 423 if ($services{$service} and ($caddr eq "" or &has_access ($service))) { 422 424 my $child = 0; 425 my $timeout = get_var (\%sconf, $service, 'timeout'); 426 $timeout = $sconf{'timeout'} 427 unless defined $timeout and $timeout =~ /^\d+$/; 423 428 424 429 if ($child = open (CHILD, "-|")) { … … 556 561 print "# munin node at $FQDN\n"; 557 562 local $SIG{ALRM} = sub { logger ("Connection timed out."); die "timeout" }; 558 alarm($ timeout);563 alarm($sconf{'timeout'}); 559 564 while( <STDIN> ){ 560 alarm($ timeout);565 alarm($sconf{'timeout'}); 561 566 chomp; 562 567 if (m/^list\s*([0-9a-zA-Z\.\-]+)?/) { … … 691 696 $sconf->{$service}{'host_name'} = $1; 692 697 } 698 elsif (/^\s*timeout\s+(\d+)\s*$/) 699 { 700 $sconf->{$service}{'timeout'} = $1; 701 print "DEBUG: $service: setting timeout to $1\n" 702 if $DEBUG; 703 } 693 704 elsif (/^\s*(allow)\s+(.+)\s*$/ or /^\s*(deny)\s+(.+)\s*$/) 694 705 { … … 960 971 =cut 961 972 962 # vim:syntax=perl 973 # vim:syntax=perl ts=8
