]> git.etc.gen.nz Git - spong.git/commitdiff
removed pingecho use and fixed problem with alarm() in the eval{} block
authorStephen L Johnson <sjohnson@monsters.org>
Tue, 19 Dec 2000 20:00:42 +0000 (20:00 +0000)
committerStephen L Johnson <sjohnson@monsters.org>
Tue, 19 Dec 2000 20:00:42 +0000 (20:00 +0000)
src/lib/Spong/Network/plugins/check_ping

index b5a8f57134420a115818222c8ab926aba2c75cf7..1e99efe3af7d49b4a54e239a6cc3ff50fcbb157b 100755 (executable)
@@ -20,36 +20,31 @@ sub check_ping {
    }
 
    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";