From d5cde61230aac6c78189114ba4f5dc641e6107d8 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Wed, 21 Aug 2019 10:33:58 +0200 Subject: [PATCH] add ipc_file in config file --- connectors/vmware/src/centreon/script/centreon_vmware.pm | 7 ++++--- connectors/vmware/src/centreon/vmware/connector.pm | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/connectors/vmware/src/centreon/script/centreon_vmware.pm b/connectors/vmware/src/centreon/script/centreon_vmware.pm index 33e4874ac..a856104e2 100644 --- a/connectors/vmware/src/centreon/script/centreon_vmware.pm +++ b/connectors/vmware/src/centreon/script/centreon_vmware.pm @@ -98,11 +98,11 @@ my @load_modules = ( sub new { my $class = shift; - my $self = $class->SUPER::new("centreon_vmware"); + my $self = $class->SUPER::new('centreon_vmware'); bless $self, $class; $self->add_options( - "config-extra=s" => \$self->{opt_extra}, + 'config-extra=s' => \$self->{opt_extra}, ); %{$self->{centreon_vmware_default_config}} = @@ -115,6 +115,7 @@ sub new { dynamic_timeout_kill => 86400, refresh_keeper_session => 15, port => 5700, + ipc_file => '/tmp/centreon_vmware/routing.ipc', case_insensitive => 0, vsphere_server => { #'default' => {'url' => 'https://XXXXXX/sdk', @@ -545,7 +546,7 @@ sub run { zmq_setsockopt($frontend, ZMQ_LINGER, 0); # we discard zmq_bind($frontend, 'tcp://*:' . $centreon_vmware->{centreon_vmware_config}->{port}); - $centreon_vmware->bind_ipc(socket => $frontend, ipc_file => '/tmp/centreon_vmware/routing.ipc'); + $centreon_vmware->bind_ipc(socket => $frontend, ipc_file => $centreon_vmware->{centreon_vmware_config}->{ipc_file}); foreach (keys %{$centreon_vmware->{centreon_vmware_config}->{vsphere_server}}) { $centreon_vmware->{counter_stats}->{$_} = 0; diff --git a/connectors/vmware/src/centreon/vmware/connector.pm b/connectors/vmware/src/centreon/vmware/connector.pm index f559ac9e7..6a0fa9071 100644 --- a/connectors/vmware/src/centreon/vmware/connector.pm +++ b/connectors/vmware/src/centreon/vmware/connector.pm @@ -54,6 +54,7 @@ sub new { $connector->{modules_registry} = $options{modules_registry}; $connector->{logger} = $options{logger}; $connector->{whoaim} = $options{name}; + $connector->{config_ipc_file} = $options{config}->{ipc_file}; $connector->{config_child_timeout} = $options{config}->{timeout}; $connector->{config_stop_child_timeout} = $options{config}->{timeout_kill}; $connector->{config_vsphere_session_heartbeat} = $options{config}->{refresh_keeper_session}; @@ -178,7 +179,7 @@ sub reqclient { $self->{modules_registry}->{$result->{command}}->initArgs(arguments => $result); $self->{modules_registry}->{$result->{command}}->run(); - centreon::vmware::common::response(token => 'RESPSERVER2', endpoint => $backend, reinit => 'ipc:///tmp/centreon_vmware/routing.ipc'); + centreon::vmware::common::response(token => 'RESPSERVER2', endpoint => $backend, reinit => 'ipc://' . $self->{config_ipc_file}); zmq_close($backend); exit(0); } @@ -219,7 +220,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:///tmp/centreon_vmware/routing.ipc'); + zmq_connect($backend, 'ipc://' . $connector->{config_ipc_file}); centreon::vmware::common::response(token => 'READY', endpoint => $backend, force_response => ''); # Initialize poll set