From 30371366d5da31e06fec6dde676dbe430f7bd4d3 Mon Sep 17 00:00:00 2001 From: slerena Date: Thu, 7 Jun 2007 10:55:18 +0000 Subject: [PATCH] 2007-06-07 Sancho Lerena * bin/pandora_recon.pl: Now uses ping() from PingExternal. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@491 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 2 ++ pandora_server/bin/pandora_recon.pl | 20 ++++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 53629c68e3..fe53fdf541 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -19,6 +19,8 @@ user (it uses PING from system). * bin/PandoraFMS: Now contains all .PM files for PandoraFMS. + + * bin/pandora_recon.pl: Now uses ping() from PingExternal. 2007-06-05 Sancho Lerena diff --git a/pandora_server/bin/pandora_recon.pl b/pandora_server/bin/pandora_recon.pl index d425511326..335e21176d 100755 --- a/pandora_server/bin/pandora_recon.pl +++ b/pandora_server/bin/pandora_recon.pl @@ -21,11 +21,10 @@ use strict; use warnings; -use Date::Manip; # Needed to manipulate DateTime formats - # of input, output and compare -use Time::Local; # DateTime basic manipulation -use Net::Ping; # ICMP -use NetAddr::IP; # To manage IP Addresses +use Date::Manip; # Needed to manipulate DateTime formats + # of input, output and compare +use Time::Local; # DateTime basic manipulation +use NetAddr::IP; # To manage IP Addresses use POSIX; # to use ceil() function use Socket; # to resolve address use threads; @@ -34,6 +33,7 @@ use threads; use PandoraFMS::Config; use PandoraFMS::Tools; use PandoraFMS::DB; +use PandoraFMS::PingExternal; # FLUSH in each IO (only for debug, very slooow) # ENABLED in DEBUGMODE @@ -222,17 +222,13 @@ sub pandora_exec_task { ############################################################################## sub scan_icmp { - my $p; my $dest = $_[0]; my $l_timeout = $_[1]; - - $p = Net::Ping->new("icmp",$l_timeout); - if ($p->ping($dest)) { - $p->close(); + $result = ping(hostname => $dest, timeout => $l_timeout, size => 32, count => 1); + if ($result) { return 1; } else { - $p->close(); - return 0; + return 0; } }