mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-23 13:45:18 +02:00
parent
d5862c4495
commit
0870631b9f
@ -23,9 +23,9 @@ sub getCommandName {
|
||||
sub checkArgs {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
if (!defined($options{arguments}->{esx_hostname}) || $options{arguments}->{esx_hostname} eq "") {
|
||||
if (defined($options{arguments}->{esx_hostname}) && $options{arguments}->{esx_hostname} eq "") {
|
||||
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => "Argument error: need esx hostname");
|
||||
short_msg => "Argument error: esx hostname cannot be null");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@ -103,7 +103,7 @@ sub run {
|
||||
}
|
||||
|
||||
# Storage
|
||||
if ($self->{storage_status} == 1 && defined($storageStatusInfo)) {
|
||||
if (defined($self->{storage_status}) && defined($storageStatusInfo)) {
|
||||
foreach (@$storageStatusInfo) {
|
||||
if ($_->status->key =~ /^red$/i) {
|
||||
$self->{manager}->{output}->output_add(long_msg => $_->name . ": " . $_->status->summary);
|
||||
|
@ -13,6 +13,7 @@ use centreon::plugins::output;
|
||||
use centreon::plugins::perfdata;
|
||||
|
||||
my $manager_display = {};
|
||||
my $flag = ZMQ_NOBLOCK | ZMQ_SNDMORE;
|
||||
|
||||
sub init_response {
|
||||
$manager_display->{options} = centreon::plugins::options->new();
|
||||
@ -39,11 +40,14 @@ sub response {
|
||||
my $context = zmq_init();
|
||||
$options{endpoint} = zmq_socket($context, ZMQ_DEALER);
|
||||
zmq_connect($options{endpoint}, $options{reinit});
|
||||
# we wait 10 seconds after. If not there is a problem... so we can quit
|
||||
# dialog from vsphere response to router
|
||||
zmq_setsockopt($options{endpoint}, ZMQ_LINGER, 10000);
|
||||
}
|
||||
if (defined($options{identity})) {
|
||||
zmq_sendmsg($options{endpoint}, $options{identity}, ZMQ_SNDMORE);
|
||||
zmq_sendmsg($options{endpoint}, $options{identity}, $flag);
|
||||
}
|
||||
zmq_sendmsg($options{endpoint}, $options{token} . " " . $stdout);
|
||||
zmq_sendmsg($options{endpoint}, $options{token} . " " . $stdout, ZMQ_NOBLOCK);
|
||||
}
|
||||
|
||||
sub vmware_error {
|
||||
|
@ -34,7 +34,6 @@ sub new {
|
||||
$connector->{perfcounter_refreshrate} = 20;
|
||||
$connector->{perfcounter_speriod} = -1;
|
||||
$connector->{stop} = 0;
|
||||
$connector->{childs_vpshere_pid} = {};
|
||||
$connector->{session1} = undef;
|
||||
|
||||
$connector->{modules_registry} = $options{modules_registry};
|
||||
@ -120,7 +119,10 @@ sub verify_child {
|
||||
# Verify process
|
||||
foreach (keys %{$self->{child_proc}}) {
|
||||
# Check ctime
|
||||
if (time() - $self->{child_proc}->{$_}->{ctime} > $self->{config_child_timeout}) {
|
||||
if (defined($self->{return_child}->{$self->{child_proc}->{$_}->{pid}})) {
|
||||
delete $self->{return_child}->{$_};
|
||||
delete $self->{child_proc}->{$_};
|
||||
} elsif (time() - $self->{child_proc}->{$_}->{ctime} > $self->{config_child_timeout}) {
|
||||
$self->response_router(severity => 'UNKNOWN', msg => 'Timeout process',
|
||||
identity => $_);
|
||||
kill('INT', $self->{child_proc}->{$_}->{pid});
|
||||
@ -196,6 +198,7 @@ sub run {
|
||||
|
||||
$backend = zmq_socket($context, ZMQ_DEALER);
|
||||
zmq_setsockopt($backend, ZMQ_IDENTITY, "server-" . $connector->{whoaim});
|
||||
zmq_setsockopt($backend, ZMQ_LINGER, 0); # we discard
|
||||
zmq_connect($backend, 'ipc://routing.ipc');
|
||||
|
||||
# Initialize poll set
|
||||
|
@ -291,8 +291,9 @@ sub request {
|
||||
return ;
|
||||
}
|
||||
|
||||
zmq_sendmsg($frontend, "server-" . $result->{container}, ZMQ_SNDMORE);
|
||||
zmq_sendmsg($frontend, 'REQCLIENT ' . $options{data});
|
||||
my $flag = ZMQ_NOBLOCK | ZMQ_SNDMORE;
|
||||
zmq_sendmsg($frontend, "server-" . $result->{container}, $flag);
|
||||
zmq_sendmsg($frontend, 'REQCLIENT ' . $options{data}, ZMQ_NOBLOCK);
|
||||
}
|
||||
|
||||
sub repserver {
|
||||
@ -374,6 +375,7 @@ sub run {
|
||||
my $context = zmq_init();
|
||||
$frontend = zmq_socket($context, ZMQ_ROUTER);
|
||||
|
||||
zmq_setsockopt($frontend, ZMQ_LINGER, 0); # we discard
|
||||
zmq_bind($frontend, 'tcp://*:5700');
|
||||
zmq_bind($frontend, 'ipc://routing.ipc');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user