add ipc_file in config file

This commit is contained in:
garnier-quentin 2019-08-21 10:33:58 +02:00
parent 4ec0b5677d
commit d5cde61230
2 changed files with 7 additions and 5 deletions

View File

@ -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;

View File

@ -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