}
foreach $host ( @hostlist ) {
- if( ! pingecho( $host, 3 ) ) {
- # Try again with a IMCP ping, for those goofy machines that don't run
- # the echo service... This is a bit slower... Make sure your ping
- # program only sends a finite number of pings...
-
- my $myping = $PING;
- my $pingok = 0;
- $myping =~ s/HOST/$host/g;
-
- eval {
- local $SIG{'ALRM'} = sub { die };
- alarm(5);
-
- open( PING, "$myping 2>&1 |") || warn "can't call ping: $!";
- while( <PING> ) {
- $message .= $_;
- if( /bytes from/ ) { $pingok = 1; }
- if( /is alive/ ) { $pingok = 1; }
- }
-
- alarm(0);
- };
- close PING;
-
- if( ! $pingok ) {
- $color = "red";
- $message .= "\n";
- push( @down, $host );
- }
+ my $myping = $PING;
+ my $pingok = 0;
+ $myping =~ s/HOST/$host/g;
+
+ eval {
+ local $SIG{'ALRM'} = sub { die };
+ alarm(5);
+
+ open( PING, "$myping 2>&1 |") || warn "can't call ping: $!";
+ while( <PING> ) {
+ $message .= $_;
+ if( /bytes from/ ) { $pingok = 1; }
+ if( /is alive/ ) { $pingok = 1; }
+ }
+
+ };
+ close PING;
+ alarm(0);
+
+ if( ! $pingok ) {
+ $color = "red";
+ $message .= "\n";
+ push( @down, $host );
}
+
}
$summary = "ping failed for " . join( ',', @down ) if $color eq "red";