mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-29 16:45:04 +02:00
+ Enhance error message
This commit is contained in:
parent
38384a2223
commit
8e7fb2b339
@ -67,7 +67,11 @@ sub check_options {
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $icmp_sock = new IO::Socket::INET(Proto=>"icmp");
|
||||
my $icmp_sock = new IO::Socket::INET(Proto => "icmp");
|
||||
if (!defined($icmp_sock)) {
|
||||
$self->{output}->add_option_msg(short_msg => "Cannot create socket: $!");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $read_set = new IO::Select();
|
||||
$read_set->add($icmp_sock);
|
||||
|
||||
@ -78,7 +82,8 @@ sub run {
|
||||
|
||||
$sock->send("Hello");
|
||||
close($sock);
|
||||
(my $new_readable) = IO::Select->select($read_set, undef, undef, $self->{option_results}->{timeout});
|
||||
|
||||
my ($new_readable) = IO::Select->select($read_set, undef, undef, $self->{option_results}->{timeout});
|
||||
my $icmp_arrived = 0;
|
||||
foreach $sock (@$new_readable) {
|
||||
if ($sock == $icmp_sock) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user