mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
2007-06-07 Sancho Lerena <slerena@artica.es>
* bin/pandora_network.pl: Net::Ping::External does not solve our odd problems. Fallback again to Net::Ping interface, not using a double check to be sure that data is good. I hope this works :( git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@493 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
75fb40a0b3
commit
8bd7e3d589
@ -22,6 +22,9 @@
|
|||||||
|
|
||||||
* bin/pandora_recon.pl: Now uses ping() from PingExternal.
|
* bin/pandora_recon.pl: Now uses ping() from PingExternal.
|
||||||
|
|
||||||
|
* bin/pandora_network.pl: Net::Ping::External does not solve our
|
||||||
|
odd problems. Fallback again to Net::Ping interface, not using a
|
||||||
|
double check to be sure that data is good. I hope this works :(
|
||||||
|
|
||||||
2007-06-05 Sancho Lerena <slerena@gmail.com>
|
2007-06-05 Sancho Lerena <slerena@gmail.com>
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ use threads;
|
|||||||
use PandoraFMS::Config;
|
use PandoraFMS::Config;
|
||||||
use PandoraFMS::Tools;
|
use PandoraFMS::Tools;
|
||||||
use PandoraFMS::DB;
|
use PandoraFMS::DB;
|
||||||
use PandoraFMS::PingExternal; # Use Net:Ping:External (renamed to pandora_ping_external)
|
|
||||||
|
|
||||||
# FLUSH in each IO (only for debug, very slooow)
|
# FLUSH in each IO (only for debug, very slooow)
|
||||||
# ENABLED in DEBUGMODE
|
# ENABLED in DEBUGMODE
|
||||||
@ -328,22 +327,31 @@ sub pandora_ping_icmp {
|
|||||||
my $l_timeout = $_[1];
|
my $l_timeout = $_[1];
|
||||||
# temporal vars.
|
# temporal vars.
|
||||||
my $result = 0;
|
my $result = 0;
|
||||||
|
my $result2 = 0;
|
||||||
|
my $p;
|
||||||
|
|
||||||
# Check for valid destination
|
# Check for valid destination
|
||||||
if (!defined($dest)) {
|
if (!defined($dest)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$result = ping(hostname => $dest, timeout => $l_timeout, size => 32, count => 1);
|
# Some hosts don't accept ICMP with too small payload. Use 16 Bytes
|
||||||
|
$p = Net::Ping->new("icmp",$l_timeout,16);
|
||||||
|
$p->source_verify(1);
|
||||||
|
|
||||||
|
$result = $p->ping($dest);
|
||||||
|
$result2 = $p->ping($dest);
|
||||||
|
|
||||||
# Check for valid result
|
# Check for valid result
|
||||||
if (!defined($result)) {
|
if ((!defined($result)) || (!defined($result2))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Lets see the result
|
# Lets see the result
|
||||||
if ($result == 1) {
|
if (($result == 1) && ($result2 == 1)) {
|
||||||
|
$p->close();
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
$p->close();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -548,7 +556,7 @@ sub exec_network_module {
|
|||||||
$nm->close();
|
$nm->close();
|
||||||
} else {
|
} else {
|
||||||
$module_result = 0; # Done but, with zero value
|
$module_result = 0; # Done but, with zero value
|
||||||
$module_data = 0;
|
$module_data = 0; # This should don't happen
|
||||||
}
|
}
|
||||||
# SNMP Modules (Proc=18, inc, data, string)
|
# SNMP Modules (Proc=18, inc, data, string)
|
||||||
# ------------
|
# ------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user