From ebe36ac484a5b3b83a039d2ffdbe93ecaf2bd1fb Mon Sep 17 00:00:00 2001 From: Kevin Duret Date: Mon, 14 Jan 2019 18:29:30 +0100 Subject: [PATCH] fix(broker): fix wizard broker configuration with one peer retention (#6959) * fix(broker): fix wizard broker configuration with one peer retention mode * enh(broker): add poller name in one peer retention configuration name Refs: #6910 #6978 #6987 * add comments * fix broker configuration methods * Remote server add multiple authorized master (#7063) * fix(remote-server): Update authorizedMaster value using enableRemote * enh(remote-server): authorize multiple master * fix syntax error * improve centcore debug * fix bam broker configuration on remote server * test(ut): fix unit tests of remote server * test(ut): update value of mocked constants --- bin/centreon | 3 - bootstrap.php | 5 + .../poller/enable_remote.rst | 3 +- .../poller/enable_remote.rst | 1 + lib/perl/centreon/script/centcore.pm | 450 ++++---- .../Domain/Entity/CfgCentreonBrokerInfo.php | 106 ++ .../CfgCentreonBorkerInfoRepository.php | 42 - .../CfgCentreonBorkerRepository.php | 49 - .../CfgCentreonBrokerInfoRepository.php | 96 ++ .../CfgCentreonBrokerRepository.php | 124 ++ .../Repository/InformationsRepository.php | 3 + .../CfgCentreonBrokerInfoInterface.php | 24 + .../Interfaces/CfgCentreonBrokerInterface.php | 7 + .../Service/BrokerConfigurationService.php | 48 + .../Service/CentcoreConfigService.php | 14 +- src/Centreon/ServiceProvider.php | 36 +- src/Centreon/Tests/ServiceProviderTest.php | 8 +- .../Clapi/CentreonRemoteServer.php | 91 +- .../Application/Clapi/CentreonWorker.php | 172 +-- .../WizardConfigurationRequestValidator.php | 34 +- .../CentreonConfigurationRemote.php | 105 +- .../Webservice/CentreonTaskService.php | 109 +- .../Domain/Exporter/PollerExporter.php | 18 +- .../DefaultConfig/CfgCentreonBroker.php | 56 + .../DefaultConfig/CfgCentreonBrokerInfo.php | 1001 +++++++++++++++++ .../Resources/DefaultConfig/CfgNagios.php | 145 +++ .../DefaultConfig/CfgNagiosBrokerModule.php | 28 + .../Resources/DefaultConfig/CfgResource.php | 33 + .../Resources/DefaultConfig/NagiosServer.php | 40 + .../RemoteConfig/BamBrokerCfgInfo.php | 243 ++++ .../RemoteConfig/BrokerInfo/InputBroker.php | 147 +++ .../RemoteConfig/BrokerInfo/InputRrd.php | 147 +++ .../RemoteConfig/BrokerInfo/LoggerBroker.php | 84 ++ .../RemoteConfig/BrokerInfo/LoggerModule.php | 84 ++ .../RemoteConfig/BrokerInfo/LoggerRrd.php | 84 ++ .../RemoteConfig/BrokerInfo/LoggerSql.php | 84 ++ .../RemoteConfig/BrokerInfo/OutputCentral.php | 147 +++ .../BrokerInfo/OutputForwardMaster.php | 147 +++ .../BrokerInfo/OutputModuleMaster.php | 147 +++ .../BrokerInfo/OutputPerfdata.php | 163 +++ .../RemoteConfig/BrokerInfo/OutputRrd.php | 119 ++ .../BrokerInfo/OutputRrdMaster.php | 147 +++ .../BrokerInfo/OutputSqlMaster.php | 142 +++ .../RemoteConfig/BrokerInfo/OutputStatus.php | 162 +++ .../RemoteConfig/CfgCentreonBroker.php | 67 ++ .../RemoteConfig/CfgCentreonBrokerInfo.php | 64 ++ .../Resources/RemoteConfig/CfgNagios.php | 151 +++ .../RemoteConfig/CfgNagiosBrokerModule.php | 33 + .../InputFlowOnePeerRetention.php | 43 + .../Resources/RemoteConfig/NagiosServer.php | 45 + .../default_config/cfg_centreonbroker.php | 40 - .../cfg_centreonbroker_info.php | 985 ---------------- .../Resources/default_config/cfg_nagios.php | 128 --- .../cfg_nagios_broker_module.php | 12 - .../Resources/default_config/cfg_resource.php | 16 - .../default_config/nagios_server.php | 23 - .../remote_config/bam_broker_cfg_info.php | 227 ---- .../broker_info/input_broker.php | 130 --- .../remote_config/broker_info/input_rrd.php | 130 --- .../broker_info/logger_broker.php | 67 -- .../broker_info/logger_module.php | 67 -- .../remote_config/broker_info/logger_rrd.php | 67 -- .../remote_config/broker_info/logger_sql.php | 67 -- .../broker_info/output_central.php | 130 --- .../broker_info/output_forward_master.php | 130 --- .../broker_info/output_module_master.php | 130 --- .../broker_info/output_perfdata.php | 146 --- .../remote_config/broker_info/output_rrd.php | 102 -- .../broker_info/output_rrd_master.php | 130 --- .../broker_info/output_sql_master.php | 125 -- .../broker_info/output_status.php | 145 --- .../remote_config/cfg_centreonbroker.php | 50 - .../remote_config/cfg_centreonbroker_info.php | 48 - .../Resources/remote_config/cfg_nagios.php | 134 --- .../cfg_nagios_broker_module.php | 16 - .../remote_config/input_poller_open_flow.php | 132 --- .../Resources/remote_config/nagios_server.php | 26 - .../LinkedPollerConfigurationService.php | 186 ++- .../PollerConfigurationRequestBridge.php | 114 +- .../PollerConnectionConfigurationService.php | 70 +- .../RemoteConnectionConfigurationService.php | 17 +- .../ServerConnectionConfigurationService.php | 55 +- .../Domain/Service/NotifyMasterService.php | 35 +- .../PollerDefaultsOverwriteService.php | 90 +- .../Domain/Service/TaskService.php | 84 +- .../Domain/Value/PollerServer.php | 32 +- .../Domain/Value/ServerWizardIdentity.php | 27 +- .../Export/ExportCommitment.php | 12 +- .../Infrastructure/Service/ExportService.php | 10 +- src/CentreonRemote/ServiceProvider.php | 45 +- .../Tests/ServiceProviderTest.php | 39 +- .../Core/Widget/FactoryTest.php | 4 - tests/php/bootstrap.php | 18 +- www/class/centreonRestHttp.class.php | 10 +- www/front_src/src/axios/remote.js | 7 - .../wizardFormInstallingStatus/index.js | 4 +- .../remoteServerStep3/index.js | 205 ++-- .../src/styles/partials/form/_form.scss | 7 +- www/install/step_upgrade/step5.php | 2 +- www/install/steps/templates/step9.tpl | 2 +- 100 files changed, 5548 insertions(+), 4231 deletions(-) create mode 100644 src/Centreon/Domain/Entity/CfgCentreonBrokerInfo.php delete mode 100644 src/Centreon/Domain/Repository/CfgCentreonBorkerInfoRepository.php delete mode 100644 src/Centreon/Domain/Repository/CfgCentreonBorkerRepository.php create mode 100644 src/Centreon/Domain/Repository/CfgCentreonBrokerInfoRepository.php create mode 100644 src/Centreon/Domain/Repository/CfgCentreonBrokerRepository.php create mode 100644 src/Centreon/Domain/Repository/Interfaces/CfgCentreonBrokerInfoInterface.php create mode 100644 src/Centreon/Domain/Repository/Interfaces/CfgCentreonBrokerInterface.php create mode 100644 src/Centreon/Domain/Service/BrokerConfigurationService.php create mode 100644 src/CentreonRemote/Domain/Resources/DefaultConfig/CfgCentreonBroker.php create mode 100644 src/CentreonRemote/Domain/Resources/DefaultConfig/CfgCentreonBrokerInfo.php create mode 100644 src/CentreonRemote/Domain/Resources/DefaultConfig/CfgNagios.php create mode 100644 src/CentreonRemote/Domain/Resources/DefaultConfig/CfgNagiosBrokerModule.php create mode 100644 src/CentreonRemote/Domain/Resources/DefaultConfig/CfgResource.php create mode 100644 src/CentreonRemote/Domain/Resources/DefaultConfig/NagiosServer.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BamBrokerCfgInfo.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/InputBroker.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/InputRrd.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerBroker.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerModule.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerRrd.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerSql.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputCentral.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputForwardMaster.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputModuleMaster.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputPerfdata.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputRrd.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputRrdMaster.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputSqlMaster.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputStatus.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/CfgCentreonBroker.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/CfgCentreonBrokerInfo.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/CfgNagios.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/CfgNagiosBrokerModule.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/InputFlowOnePeerRetention.php create mode 100644 src/CentreonRemote/Domain/Resources/RemoteConfig/NagiosServer.php delete mode 100644 src/CentreonRemote/Domain/Resources/default_config/cfg_centreonbroker.php delete mode 100644 src/CentreonRemote/Domain/Resources/default_config/cfg_centreonbroker_info.php delete mode 100644 src/CentreonRemote/Domain/Resources/default_config/cfg_nagios.php delete mode 100644 src/CentreonRemote/Domain/Resources/default_config/cfg_nagios_broker_module.php delete mode 100644 src/CentreonRemote/Domain/Resources/default_config/cfg_resource.php delete mode 100644 src/CentreonRemote/Domain/Resources/default_config/nagios_server.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/bam_broker_cfg_info.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/input_broker.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/input_rrd.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_broker.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_module.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_rrd.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_sql.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_central.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_forward_master.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_module_master.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_perfdata.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_rrd.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_rrd_master.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_sql_master.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_status.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/cfg_centreonbroker.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/cfg_centreonbroker_info.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/cfg_nagios.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/cfg_nagios_broker_module.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/input_poller_open_flow.php delete mode 100644 src/CentreonRemote/Domain/Resources/remote_config/nagios_server.php delete mode 100755 www/front_src/src/axios/remote.js diff --git a/bin/centreon b/bin/centreon index efb3a002cf5..900ed5c455d 100755 --- a/bin/centreon +++ b/bin/centreon @@ -99,9 +99,6 @@ require_once _CENTREON_ETC_ . "/centreon.conf.php"; require_once _CLAPI_CLASS_ . "/centreonAPI.class.php"; require_once _CLAPI_CLASS_ . "/centreonUtils.class.php"; -error_reporting(0); -ini_set("display_errors", "Off"); - $dbConfig['host'] = $conf_centreon['hostCentreon']; $dbConfig['username'] = $conf_centreon['user']; $dbConfig['password'] = $conf_centreon['password']; diff --git a/bootstrap.php b/bootstrap.php index 0e2a0239fa3..f76421fa13d 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -78,6 +78,11 @@ function loadDependencyInjector() return new \CentreonDB('centstorage'); }; +// Define Centreon Rest Http Client +$dependencyInjector['rest_http'] = function ($c) { + return new \CentreonRestHttp(); +}; + // Define filesystem $dependencyInjector['filesystem'] = function ($c) { return new \Symfony\Component\Filesystem\Filesystem(); diff --git a/doc/en/administration_guide/poller/enable_remote.rst b/doc/en/administration_guide/poller/enable_remote.rst index ed387b71940..81c74e0ac87 100644 --- a/doc/en/administration_guide/poller/enable_remote.rst +++ b/doc/en/administration_guide/poller/enable_remote.rst @@ -7,7 +7,8 @@ Connect to your **Remoter Server** and execute following command:: # /usr/share/centreon/bin/centreon -u admin -p centreon -a enableRemote -o CentreonRemoteServer -v @IP_CENTREON_CENTRAL .. note:: - Replace **@IP_CENTREON_CENTRAL** by the IP of the Centreon server seen by the poller + Replace **@IP_CENTREON_CENTRAL** by the IP of the Centreon server seen by the poller. + You can define multiple IP address using a coma as separator. This command will enable **Remote Server** mode:: diff --git a/doc/fr/administration_guide/poller/enable_remote.rst b/doc/fr/administration_guide/poller/enable_remote.rst index 501a4c76a24..7e87f0db1ee 100644 --- a/doc/fr/administration_guide/poller/enable_remote.rst +++ b/doc/fr/administration_guide/poller/enable_remote.rst @@ -9,6 +9,7 @@ la commande suivante :: .. note:: Remplacez **@IP_CENTREON_CENTRAL** par l'IP du serveur Centreon vu par le collecteur. + Vous pouvez définir plusieurs adresse IP en utilisant la virgule comme séparateur. Cette commande va activer le mode **Remote Server** :: diff --git a/lib/perl/centreon/script/centcore.pm b/lib/perl/centreon/script/centcore.pm index abb3cbafa37..4685af5289d 100755 --- a/lib/perl/centreon/script/centcore.pm +++ b/lib/perl/centreon/script/centcore.pm @@ -62,13 +62,13 @@ sub new { $self->{sudo} = "sudo"; $self->{service} = "service"; $self->{timeout} = 5; - $self->{cmd_timeout} = 5; - + $self->{cmd_timeout} = 5; + $self->{ssh} .= " -o ConnectTimeout=$self->{timeout} -o StrictHostKeyChecking=yes -o PreferredAuthentications=publickey -o ServerAliveInterval=10 -o ServerAliveCountMax=3 -o Compression=yes "; $self->{rsync} .= " --timeout=$self->{timeout} "; $self->{scp} .= " -o ConnectTimeout=$self->{timeout} -o StrictHostKeyChecking=yes -o PreferredAuthentications=publickey -o ServerAliveInterval=10 -o ServerAliveCountMax=3 -o Compression=yes "; - + $self->{timeBetween2SyncPerf} = 60; $self->{perfdataSync} = 0; $self->{logSync} = 0; @@ -78,9 +78,9 @@ sub new { $self->{timeSyncPerf} = 0; $self->{difTime} = 10; - + %{$self->{commandBuffer}} = (); - + $self->set_signal_handlers; return $self; @@ -258,7 +258,7 @@ sub getBrokerStats($) { ); if ($lerror == -1) { $self->{logger}->writeLogError("Could not read pipe " . $statistics_file . " on poller ".$server_info->{ns_ip_address}); - } + } if (defined($stdout) && $stdout) { $self->{logger}->writeLogInfo("Result : $stdout"); } @@ -269,7 +269,7 @@ sub getBrokerStats($) { logger => $self->{logger}, timeout => $self->{cmd_timeout} ); - if ($lerror == -1) { + if ($lerror == -1 && defined($stdout) && $stdout) { $self->{logger}->writeLogError("Result : $stdout"); } } @@ -277,7 +277,7 @@ sub getBrokerStats($) { } # ------------------- -# Functions +# Functions # ------------------- sub getNagiosConfigurationField($$){ @@ -307,7 +307,9 @@ sub getLocalServerID(){ sub getServerConfig($){ my $self = shift; - my ($status, $sth) = $self->{centreon_dbc}->query("SELECT * FROM `nagios_server` WHERE `id` = '" . $_[0] . "' AND `ns_activate` = '1' LIMIT 1"); + my ($status, $sth) = $self->{centreon_dbc}->query( + "SELECT * FROM `nagios_server` WHERE `id` = '" . $_[0] . "' AND `ns_activate` = '1' LIMIT 1" + ); if ($status == -1) { $self->{logger}->writeLogError("Error when getting server properties"); return undef; @@ -326,8 +328,10 @@ sub startWorker($) { my $self = shift; my ($lerror, $stdout, $cmd_line); - my ($status, $sth) = $self->{centreon_dbc}->query("SELECT * FROM `contact` WHERE `contact_admin` = '1' AND `contact_activate` = '1' LIMIT 1"); - if ($status == -1){ + my ($status, $sth) = $self->{centreon_dbc}->query( + "SELECT * FROM `contact` WHERE `contact_admin` = '1' AND `contact_activate` = '1' LIMIT 1" + ); + if ($status == -1) { $self->{logger}->writeLogError("Error selecting admin from db for starting worker"); return undef; } @@ -335,15 +339,24 @@ sub startWorker($) { my $data = $sth->fetchrow_hashref(); my $username = $data->{'contact_alias'}; my $passwordEnc = $data->{'contact_passwd'}; + # parse md5 password if ($passwordEnc =~ m/^md5__(.*)/) { $passwordEnc = $1; } - my $cmdexec = "$self->{centreonDir}/bin/centreon -u $username -p $passwordEnc -w -o CentreonWorker -a processQueue >> /var/log/centreon/worker.log"; - $self->{logger}->writeLogDebug("cmd: " . $cmdexec); - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmdexec, logger => $self->{logger}, timeout => $self->{cmd_timeout}); - if ($lerror == -1){ - $self->{logger}->writeLogError("Result : $stdout"); + my $cmdexec = "$self->{centreonDir}/bin/centreon -u %s -p %s -w -o CentreonWorker -a processQueue"; + $self->{logger}->writeLogDebug("cmd: " . sprintf($cmdexec, '', '')); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => sprintf($cmdexec, $username, $passwordEnc), + logger => $self->{logger}, + timeout => $self->{cmd_timeout} + ); + if (defined($stdout) && $stdout) { + if ($lerror == -1) { + $self->{logger}->writeLogError("Result : $stdout"); + } else { + $self->{logger}->writeLogDebug("Result : $stdout"); + } } return undef; } @@ -359,8 +372,10 @@ sub createRemote($) { return undef; } my ($lerror, $stdout, $cmd_line); - my ($status, $sth) = $self->{centreon_dbc}->query("SELECT * FROM `contact` WHERE `contact_admin` = '1' AND `contact_activate` = '1' LIMIT 1"); - if ($status == -1){ + my ($status, $sth) = $self->{centreon_dbc}->query( + "SELECT * FROM `contact` WHERE `contact_admin` = '1' AND `contact_activate` = '1' LIMIT 1" + ); + if ($status == -1) { $self->{logger}->writeLogError("Error selecting admin from db for starting worker"); return undef; } @@ -368,15 +383,25 @@ sub createRemote($) { my $data = $sth->fetchrow_hashref(); my $username = $data->{'contact_alias'}; my $passwordEnc = $data->{'contact_passwd'}; + # parse md5 password if ($passwordEnc =~ m/^md5__(.*)/) { $passwordEnc = $1; } - my $cmdexec = "$self->{centreonDir}/bin/centreon -u $username -p $passwordEnc -w -o CentreonWorker -a createRemoteTask -v '".$taskId."' >> /var/log/centreon/worker.log"; - $self->{logger}->writeLogDebug("cmd: " . $cmdexec); - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmdexec, logger => $self->{logger}, timeout => $self->{cmd_timeout}); - if ($lerror == -1){ - $self->{logger}->writeLogError("Result : $stdout"); + my $cmdexec = "$self->{centreonDir}/bin/centreon -u %s -p %s " + . "-w -o CentreonWorker -a createRemoteTask -v '" . $taskId . "'"; + $self->{logger}->writeLogDebug("cmd: " . sprintf($cmdexec, '', '')); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => sprintf($cmdexec, $username, $passwordEnc), + logger => $self->{logger}, + timeout => $self->{cmd_timeout} + ); + if (defined($stdout) && $stdout) { + if ($lerror == -1) { + $self->{logger}->writeLogError("Result : $stdout"); + } else { + $self->{logger}->writeLogDebug("Result : $stdout"); + } } return undef; } @@ -409,8 +434,8 @@ sub sendExternalCommand($$){ # Get server informations my $server_info = $self->getServerConfig($id); my $port = checkSSHPort($server_info->{ssh_port}); - - # Get command file + + # Get command file my $command_file = $self->getNagiosConfigurationField($id, "command_file"); # check if ip address is defined @@ -418,15 +443,19 @@ sub sendExternalCommand($$){ $cmd =~ s/\\/\\\\/g; if ($server_info->{localhost} == 1) { my $result = waitPipe($command_file); + if ($result == 0) { - # split $cmd in order to send it in multiple line my $count = 0; foreach my $cmd1 (split(/\n/, $cmd)) { if ($count >= 200) { $cmd2 = "$self->{echo} \"".$cmd_line."\" >> ".$command_file; $self->{logger}->writeLogInfo("External command on Central Server: ($id) : \"".$cmd_line."\""); - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd2, logger => $self->{logger}, timeout => $self->{cmd_timeout}); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd2, + logger => $self->{logger}, + timeout => $self->{cmd_timeout} + ); $cmd_line = ""; $count = 0; } else { @@ -437,56 +466,65 @@ sub sendExternalCommand($$){ if ($count gt 0) { $cmd2 = "$self->{echo} \"".$cmd_line."\" >> ".$command_file; $self->{logger}->writeLogInfo("External command on Central Server: ($id) : \"".$cmd_line."\""); - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd2, logger => $self->{logger}, timeout => $self->{cmd_timeout}); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd2, + logger => $self->{logger}, + timeout => $self->{cmd_timeout} + ); $cmd_line = ""; $count = 0; - } + } if ($lerror == -1) { - $self->{logger}->writeLogError("Could not write into pipe file ".$command_file." on poller ".$id); + $self->{logger}->writeLogError( + "Could not write into pipe file " . $command_file . " on poller " . $id + ); } } else { - $self->{logger}->writeLogError("Cannot write external command on central server : \"".$cmd_line."\""); + $self->{logger}->writeLogError( + 'Cannot write external command on central server : "' . $cmd_line . '"' + ); } } else { $cmd =~ s/\'/\'\\\'\'/g; - + # split $cmd in order to send it in multiple line my $count = 0; - foreach my $cmd1 (split(/\n/, $cmd)) { - if ($count >= 200) { + my $totalCount = 0; + my @splittedCommands = split(/\n/, $cmd); + my $countCommands = @splittedCommands; + foreach my $cmd1 (@splittedCommands) { + $cmd_line .= $cmd1 . "\n"; + $count++; + $totalCount++; + + if ($count >= 200 || $totalCount == $countCommands) { if (defined($server_info->{remote_id}) && $server_info->{remote_id} != 0 && $self->{instance_mode} ne "remote") { my $remote_server = $self->getServerConfig($server_info->{remote_id}); $cmd_line =~ s/^\s+|\s+$//g; - $cmd2 = "$self->{ssh} -q " . $remote_server->{ns_ip_address} . " -p $port \"$self->{echo} 'EXTERNALCMD:$id:" . $cmd_line . "' > " . $self->{cmdDir} . time() . "-sendcmd\""; - $self->{logger}->writeLogInfo("Send external command using Remote Server: " . $remote_server->{ns_ip_address}); + $cmd2 = "$self->{ssh} -q " . $remote_server->{ns_ip_address} . " -p $port " + . "\"$self->{echo} 'EXTERNALCMD:$id:" . $cmd_line . "' " + . "> " . $self->{cmdDir} . time() . "-sendcmd\""; + $self->{logger}->writeLogInfo( + "Send external command using Remote Server: " . $remote_server->{ns_ip_address} + ); } else { - $cmd2 = "$self->{ssh} -q " . $server_info->{ns_ip_address} . " -p $port \"$self->{echo} '" . $cmd_line."' >> " . $command_file . "\""; - $self->{logger}->writeLogInfo("External command : ".$server_info->{ns_ip_address}." ($id) : \"".$cmd_line."\""); + $cmd2 = "$self->{ssh} -q " . $server_info->{ns_ip_address} . " -p $port " + . "\"$self->{echo} '" . $cmd_line."' >> " . $command_file . "\""; + $self->{logger}->writeLogInfo( + "External command : ".$server_info->{ns_ip_address}." ($id) : \"".$cmd_line."\"" + ); + } + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd2, + logger => $self->{logger}, + timeout => $self->{cmd_timeout} + ); + if ($lerror == -1) { + $self->{logger}->writeLogError("Could not write into pipe file " . $command_file . " on poller " . $id); } - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd2, logger => $self->{logger}, timeout => $self->{cmd_timeout}); $cmd_line = ""; $count = 0; - } else { - $cmd_line .= $cmd1."\n"; } - $count++; - } - if ($count gt 0) { - if (defined($server_info->{remote_id}) && $server_info->{remote_id} != 0 && $self->{instance_mode} ne "remote") { - my $remote_server = $self->getServerConfig($server_info->{remote_id}); - $cmd_line =~ s/^\s+|\s+$//g; - $cmd2 = "$self->{ssh} -q " . $remote_server->{ns_ip_address} . " -p $port \"$self->{echo} 'EXTERNALCMD:$id:" . $cmd_line . "' > " . $self->{cmdDir} . time() . "-sendcmd\""; - $self->{logger}->writeLogInfo("Send external command using Remote Server: " . $remote_server->{ns_ip_address}); - } else { - $cmd2 = "$self->{ssh} -q " . $server_info->{ns_ip_address} . " -p $port \"$self->{echo} '" . $cmd_line . "' >> " . $command_file . "\""; - $self->{logger}->writeLogInfo("External command : " . $server_info->{ns_ip_address} . " ($id) : \"" . $cmd_line . "\""); - } - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd2, logger => $self->{logger}, timeout => $self->{cmd_timeout}); - $cmd_line = ""; - $count = 0; - } - if ($lerror == -1) { - $self->{logger}->writeLogError("Could not write into pipe file " . $command_file . " on poller " . $id); } } @@ -495,7 +533,7 @@ sub sendExternalCommand($$){ } } else { $self->{logger}->writeLogError("Ip address not defined for poller $id"); - } + } } ####################################### @@ -525,30 +563,32 @@ sub checkRotation($$$$$) { my $localLogFile = $_[3]; my $port = $_[4]; my ($lerror, $stdout, $cmd); - + my $archivePath = $self->getNagiosConfigurationField($instanceId, 'log_archive_path'); my $getLastCmd = 'echo "$(find '.$archivePath.' -type f -exec stat -c "%Z:%n" {} \; | sort | tail -1)"'; - $cmd = "$self->{ssh} -p $port -q $remoteConnection '".$getLastCmd."'"; - - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, - logger => $self->{logger}, - timeout => 120 - ); + $cmd = "$self->{ssh} -p $port -q $remoteConnection '$getLastCmd'"; + + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd, + logger => $self->{logger}, + timeout => 120 + ); my $updateTime = $1; my $fileName = $2; if (defined($updateTime) && defined($lastUpdate) && $updateTime > $lastUpdate) { $cmd = "$self->{scp} -P $port $remoteConnection:$fileName $localLogFile.rotate > /dev/null"; - - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, - logger => $self->{logger}, - timeout => 120 - ); + + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd, + logger => $self->{logger}, + timeout => 120 + ); $self->{logger}->writeLogInfo("Info: copied rotated file for instance $instanceId"); } } ################################################## -# Send config files to a remote server +# Send config files to a remote server # sub sendConfigFile($){ my $self = shift; @@ -562,38 +602,48 @@ sub sendConfigFile($){ my $port = checkSSHPort($server_info->{ssh_port}); if (!defined($cfg_dir) || $cfg_dir =~ //) { - $self->{logger}->writeLogError("Engine configuration file is empty for poller $id. Please check nagios.cfg file."); + $self->{logger}->writeLogError( + "Engine configuration file is empty for poller $id. Please check nagios.cfg file." + ); return; } + # Send configuration for Centreon Engine if (defined($server_info->{remote_id}) && $server_info->{remote_id} != 0 && $self->{instance_mode} ne "remote") { - $self->{logger}->writeLogError("use Remote Server to send configuration"); + $remote_server = $self->getServerConfig($server_info->{remote_id}); + $self->{logger}->writeLogInfo( + 'Send Centreon Engine config files ' . + 'on poller "' . $server_info->{name} . '" (' . $server_info->{id} . ') ' . + 'using remote server "' . $remote_server->{name} . '" (' . $remote_server->{id} . ')' + ); $origin = $self->{centreonDir} . "/filesGeneration/engine/" . $id; - $remote_server = $self->getServerConfig($server_info->{remote_id}); $dest = $remote_server->{'ns_ip_address'} . ":" . $self->{centreonDir} . "/filesGeneration/engine"; $cmd = "$self->{scp} -r -P $port $origin $dest 2>&1"; } else { - $self->{logger}->writeLogError("direct access"); - $origin = $self->{centreonDir} . "/filesGeneration/engine/" . $id . "/*"; - $dest = $server_info->{'ns_ip_address'}.":$cfg_dir"; + $dest = $server_info->{'ns_ip_address'} . ":$cfg_dir"; # Send data with SCP - $self->{logger}->writeLogInfo("Start: Send config files on poller $id"); + $self->{logger}->writeLogInfo( + 'Send Centreon Engine config files ' . + 'on poller "' . $server_info->{name} . '" (' . $server_info->{id} . ')' + ); $cmd = "$self->{scp} -P $port $origin $dest 2>&1"; } - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, - logger => $self->{logger}, - timeout => 300 - ); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd, + logger => $self->{logger}, + timeout => 300 + ); - $self->{logger}->writeLogInfo("Result : $stdout"); - $self->{logger}->writeLogInfo("End: Send config files on poller $id"); + if (defined($stdout) && $stdout){ + $self->{logger}->writeLogInfo("Result : $stdout"); + } # Send configuration for Centreon Broker - if ( -e $self->{centreonDir} . "/filesGeneration/broker/" . $id) { + if (-e $self->{centreonDir} . "/filesGeneration/broker/" . $id) { # Check availability of broker files. my $count = 0; opendir(my $dh, $self->{centreonDir} . "/filesGeneration/broker/" . $id); @@ -605,46 +655,66 @@ sub sendConfigFile($){ if ($count > 2) { if ($server_info->{localhost} == 0) { if (defined($server_info->{remote_id}) && $server_info->{remote_id} != 0 && $self->{instance_mode} ne "remote") { - $self->{logger}->writeLogDebug("Start: Send Centreon Broker config files on poller $id using Remote Server"); + $remote_server = $self->getServerConfig($server_info->{remote_id}); + $self->{logger}->writeLogInfo( + 'Send Centreon Broker config files ' . + 'on poller "' . $server_info->{name} . '" (' . $server_info->{id} . ') ' . + 'using remote server "' . $remote_server->{name} . '" (' . $remote_server->{id} . ')' + ); $origin = $self->{centreonDir} . "/filesGeneration/broker/" . $id; $dest = $remote_server->{'ns_ip_address'} . ":" . $self->{centreonDir} . "/filesGeneration/broker"; $cmd = "$self->{scp} -r -P $port $origin $dest 2>&1"; } else { - $self->{logger}->writeLogDebug("Start: Send Centreon Broker config files on poller $id"); + $self->{logger}->writeLogInfo( + 'Send Centreon Broker config files ' . + 'on poller "' . $server_info->{name} . '" (' . $server_info->{id} . ')' + ); $cfg_dir = $server_info->{'centreonbroker_cfg_path'}; $origin = $self->{centreonDir} . "/filesGeneration/broker/" . $id . "/*.*"; $dest = $server_info->{ns_ip_address}.":$cfg_dir"; $cmd = "$self->{scp} -P $port $origin $dest 2>&1"; } - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, - logger => $self->{logger}, - timeout => 300 - ); - $self->{logger}->writeLogInfo("Result : $stdout"); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd, + logger => $self->{logger}, + timeout => 300 + ); } else { - $self->{logger}->writeLogDebug("Start: Send Centreon Broker config files on poller $id"); + $self->{logger}->writeLogInfo( + 'Send Centreon Broker config files ' . + 'on poller "' . $server_info->{name} . '" (' . $server_info->{id} . ')' + ); $cmd = "cp $origin $cfg_dir 2>&1"; - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, - logger => $self->{logger}, - timeout => 60 - ); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd, + logger => $self->{logger}, + timeout => 60 + ); + } + if (defined($stdout) && $stdout) { $self->{logger}->writeLogInfo("Result : $stdout"); } - $self->{logger}->writeLogDebug("End: Send Centreon Broker config files on poller $id"); } } + + # send command on remote server to export configuration if (defined($server_info->{remote_id}) && $server_info->{remote_id} != 0 && $self->{instance_mode} ne "remote") { - $self->{logger}->writeLogDebug("Send command on Remote Server to apply configuration"); - $cmd = "$self->{ssh} -p $port " . $remote_server->{'ns_ip_address'} . " 'echo \"SENDCFGFILE:" . $id . "\" > $self->{cmdDir}/" . time() . "-sendcmd'"; - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, - logger => $self->{logger}, - timeout => 300 - ); + $remote_server = $self->getServerConfig($server_info->{remote_id}); + $self->{logger}->writeLogDebug( + 'Send command on Remote Server "' . $remote_server->{name} . '" to export configuration' + ); + $cmd = "$self->{ssh} -p $port " . $remote_server->{'ns_ip_address'} . " " + . "'echo \"SENDCFGFILE:" . $id . "\" > $self->{cmdDir}/" . time() . "-sendcmd'"; + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd, + logger => $self->{logger}, + timeout => 300 + ); } } ################################################## -# Send export files to a remote server +# Send export files to a remote server # sub sendExportFile($){ my $self = shift; @@ -661,33 +731,37 @@ sub sendExportFile($){ my $port = checkSSHPort($server_info->{ssh_port}); if (!defined($cfg_dir) || $cfg_dir =~ //) { - $self->{logger}->writeLogError("Engine configuration file is empty for poller $id. Please check nagios.cfg file."); + $self->{logger}->writeLogError( + "Engine configuration file is empty for poller $id. Please check nagios.cfg file." + ); return; } - unless ( -e $self->{centreonDir} . "filesGeneration/export/".$id) { - $self->{logger}->writeLogInfo("Export directory is empty for poller $self->{centreonDir}filesGeneration/export/$id."); + unless (-e $self->{centreonDir} . "filesGeneration/export/" . $id) { + $self->{logger}->writeLogInfo( + "Export directory is empty for poller " . $server_info->{name} . " " . + $self->{centreonDir} . "filesGeneration/export/$id." + ); return; } - my $origin = $self->{centreonDir} . "/filesGeneration/export/".$id."/*"; - my $dest = $server_info->{'ns_ip_address'}.":/var/lib/centreon/remote-data/"; + my $origin = $self->{centreonDir} . "/filesGeneration/export/" . $id . "/*"; + my $dest = $server_info->{'ns_ip_address'} . ":/var/lib/centreon/remote-data/"; # Send data with rSync - $self->{logger}->writeLogInfo("Start: Send export files on poller $id"); + $self->{logger}->writeLogInfo('Export files on poller "' . $server_info->{name} . '" (' . $id . ')'); $cmd = "$self->{rsync} -ra --port=$port $origin $dest 2>&1"; - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, - logger => $self->{logger}, - timeout => 300 - ); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd, + logger => $self->{logger}, + timeout => 300 + ); if (defined($stdout) && $stdout){ $self->{logger}->writeLogInfo("Result : $stdout"); } $self->createRemote($taskId); - - $self->{logger}->writeLogInfo("End: Send export files on poller $id"); } ################################################## @@ -709,9 +783,9 @@ sub initEngine($$$){ my $port = checkSSHPort($conf->{ssh_port}); if (!defined($conf)) { - $self->{logger}->writeLogError("Poller $id doesn't exists..."); + $self->{logger}->writeLogError("Poller $id doesn't exist..."); $self->{logger}->writeLogError("Cannot manage undefined poller..."); - return ; + return; } if (defined($conf->{ns_ip_address}) && $conf->{ns_ip_address}) { @@ -720,28 +794,38 @@ sub initEngine($$$){ my $remote_server = $self->getServerConfig($conf->{remote_id}); $action =~ s/^\s+|\s+$//g; $cmd = "$self->{ssh} -p $port " . $remote_server->{ns_ip_address} . " 'echo \"$action\" > $self->{cmdDir}" . time() . "-sendcmd'"; - $self->{logger}->writeLogDebug("Send command using Remote Server"); + $self->{logger}->writeLogInfo( + 'Send command "' . $action . '" to Centreon Engine ' . + 'on poller "' . $conf->{name} . '" (' . $conf->{id} . ') ' . + 'using remote server "' . $remote_server->{name} . '" (' . $remote_server->{id} . ')' + ); } else { - $cmd = "$self->{ssh} -p $port ". $conf->{ns_ip_address} ." $self->{sudo} $self->{service} ".$conf->{init_script}." ".$options; + $cmd = "$self->{ssh} -p $port " . $conf->{ns_ip_address} . " $self->{sudo} $self->{service} " + . $conf->{init_script} . " " . $options; + $self->{logger}->writeLogInfo( + 'Init Script : "' . $self->{sudo} . ' ' . $self->{service} . ' ' . $conf->{init_script} . ' ' . $options . '" ' . + 'on poller "' . $conf->{name} . '" (' . $id . ')' + ); } - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, logger => $self->{logger}, timeout => 120); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd, + logger => $self->{logger}, + timeout => 120 + ); } else { $self->{logger}->writeLogError("Cannot $options Engine for poller $id"); } - # Logs Actions - $self->{logger}->writeLogInfo("Init Script : '$self->{sudo} $self->{service} ".$conf->{init_script}." ".$options."' On poller ".$conf->{ns_ip_address}." ($id)"); - my $line; if (defined($stdout)) { - foreach $line (split(/\n/, $stdout)){ - $self->{logger}->writeLogDebug("Engine : ".$line); + foreach my $line (split(/\n/, $stdout)) { + $self->{logger}->writeLogDebug("Engine : " . $line); } } } ################################################## # Function for synchronize SNMP trap configuration -# +# sub syncTraps($) { my $self = shift; my $id = $_[0]; @@ -762,7 +846,7 @@ sub syncTraps($) { $cmd = "$self->{scp} -P $port /etc/snmp/centreon_traps/$id/centreontrapd.sdb $ns_server->{ns_ip_address}:$ns_server->{snmp_trapd_path_conf} 2>&1"; } $self->{logger}->writeLogDebug($cmd); - + ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, logger => $self->{logger}, timeout => 300 @@ -773,10 +857,11 @@ sub syncTraps($) { if (defined($ns_server->{remote_id}) && $ns_server->{remote_id} != 0 && $self->{instance_mode} ne "remote") { $cmd = "$self->{ssh} " . $remote_server->{'ns_ip_address'} . " 'echo \"SYNCTRAP:" . $id . "\" > $self->{cmdDir}/" . time() . "-sendcmd'"; - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, - logger => $self->{logger}, - timeout => 300 - ); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd, + logger => $self->{logger}, + timeout => 300 + ); if (defined($stdout) && $stdout){ $self->{logger}->writeLogInfo("Result : $stdout"); } @@ -784,7 +869,9 @@ sub syncTraps($) { } } else { # synchronize Archives for all pollers - my ($status, $sth) = $self->{centreon_dbc}->query("SELECT `id`, `snmp_trapd_path_conf` FROM `nagios_server` WHERE `ns_activate` = '1' AND `localhost` = '0'"); + my ($status, $sth) = $self->{centreon_dbc}->query( + "SELECT `id`, `snmp_trapd_path_conf` FROM `nagios_server` WHERE `ns_activate` = '1' AND `localhost` = '0'" + ); return if ($status == -1); while (my $server = $sth->fetchrow_hashref()) { # Get configuration @@ -823,26 +910,6 @@ sub syncTraps($) { } } -################################### -## Test Engine configuration -# -sub testConfig($) { - my $self = shift; - my $id = $_[0]; - my ($lerror, $stdout, $cmd); - - my $cfg_dir = $self->getNagiosConfigurationField($id, "cfg_dir"); - my $data = $self->getServerConfig($id); - my $port = checkSSHPort($data->{ssh_port}); - my $distantconnexion = $data->{ns_ip_address}; - $cmd = "$self->{ssh} -p ".$port." $distantconnexion ".$data->{nagios_bin}." -v $cfg_dir/nagios.cfg"; - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, - logger => $self->{logger}, - timeout => 60 - ); - $self->{logger}->writeLogInfo("Test Config Result: $stdout"); -} - ################################## ## Get Monitoring Engine. # @@ -858,19 +925,21 @@ sub getInfos($) { if (defined($ns_server->{ns_ip_address}) && $ns_server->{ns_ip_address}) { # Launch command if (defined($ns_server->{localhost}) && $ns_server->{localhost}) { - $cmd = "$self->{sudo} ".$ns_server->{nagios_bin}; + $cmd = "$self->{sudo} " . $ns_server->{nagios_bin}; $self->{logger}->writeLogDebug($cmd); - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, - logger => $self->{logger}, - timeout => 60 - ); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd, + logger => $self->{logger}, + timeout => 60 + ); } else { - $cmd = "$self->{ssh} -p $port ". $ns_server->{ns_ip_address} ." ".$ns_server->{nagios_bin}; + $cmd = "$self->{ssh} -p $port " . $ns_server->{ns_ip_address} . " " . $ns_server->{nagios_bin}; $self->{logger}->writeLogDebug($cmd); - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, - logger => $self->{logger}, - timeout => 60 - ); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd, + logger => $self->{logger}, + timeout => 60 + ); } my @tab = split("\n", $stdout); foreach my $str (@tab) { @@ -885,7 +954,7 @@ sub getInfos($) { $self->{logger}->writeLogInfo("Version: $2"); $self->updateEngineInformation($id, $1, $2); last; - } + } } } else { $self->{logger}->writeLogError("Cannot get informations for poller $id"); @@ -898,10 +967,14 @@ sub getInfos($) { sub updateEngineInformation($$$) { my $self = shift; my $id = $_[0]; - my $engine_name = $_[1]; + my $engine_name = $_[1]; my $engine_version = $_[2]; - - $self->{centreon_dbc}->query("UPDATE `nagios_server` SET `engine_name` = '$engine_name', `engine_version` = '$engine_version' WHERE `id` = '$id'"); + + $self->{centreon_dbc}->query( + "UPDATE `nagios_server` " . + "SET `engine_name` = '$engine_name', `engine_version` = '$engine_version' " . + "WHERE `id` = '$id'" + ); } ################################ @@ -921,10 +994,11 @@ sub initCentreonTrapd { if (defined($ns_server->{localhost}) && $ns_server->{localhost}) { $cmd = "$self->{sudo} $self->{service} ".$ns_server->{init_script_centreontrapd} . " " . $start_type; $self->{logger}->writeLogDebug($cmd); - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, - logger => $self->{logger}, - timeout => 120 - ); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd, + logger => $self->{logger}, + timeout => 120 + ); } else { if (defined($ns_server->{remote_id}) && $ns_server->{remote_id} != 0 && $self->{instance_mode} ne "remote") { my $remote_server = $self->getServerConfig($ns_server->{remote_id}); @@ -935,10 +1009,11 @@ sub initCentreonTrapd { $cmd = "$self->{ssh} -p $port ". $ns_server->{ns_ip_address} ." $self->{sudo} $self->{service} ".$ns_server->{init_script_centreontrapd}. " " . $start_type; } $self->{logger}->writeLogDebug($cmd); - ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd, - logger => $self->{logger}, - timeout => 60 - ); + ($lerror, $stdout) = centreon::common::misc::backtick( + command => $cmd, + logger => $self->{logger}, + timeout => 60 + ); } $self->{logger}->writeLogInfo($start_type . " CentreonTrapd on poller $id ($ns_server->{ns_ip_address})"); } else { @@ -956,8 +1031,8 @@ sub parseRequest($){ if (!$action) { return ; } - - # Checks keys for launching commands + + # Checks keys for launching commands if ($action =~ /^RESTART\:([0-9]*)/){ $self->initEngine($1, "restart", $action); } elsif ($action =~ /^RELOAD\:([0-9]*)/){ @@ -972,9 +1047,6 @@ sub parseRequest($){ $self->sendConfigFile($1); } elsif ($action =~ /^SENDEXPORTFILE\:([0-9]*)\:(.*)/){ $self->sendExportFile($1, $2); - } elsif ($action =~ /^TEST\:([0-9]*)/){ - # Experimental - $self->testConfig($1); } elsif ($action =~ /^SYNCTRAP\:([0-9]*)/){ $self->syncTraps($1); } elsif ($action =~ /^RESTARTCENTREONTRAPD\:([0-9]*)/){ @@ -1081,8 +1153,7 @@ sub run { while (){ $self->parseRequest($_); } - my $poller; - foreach $poller (keys(%{$self->{commandBuffer}})) { + foreach my $poller (keys(%{$self->{commandBuffer}})) { if (length($self->{commandBuffer}{$poller}) != 0) { $self->sendExternalCommand($poller, $self->{commandBuffer}{$poller}); $self->{commandBuffer}{$poller} = ""; @@ -1092,7 +1163,7 @@ sub run { $self->{logger}->writeLogError("Error When removing ".$self->{cmdFile}."_read file : $!") if (!unlink($self->{cmdFile}."_read")); } } - + # Read Centcore Directory if (-d $self->{cmdDir}) { opendir(my $dh, $self->{cmdDir}); @@ -1102,8 +1173,7 @@ sub run { while (){ $self->parseRequest($_); } - my $poller; - foreach $poller (keys(%{$self->{commandBuffer}})) { + foreach my $poller (keys(%{$self->{commandBuffer}})) { if (length($self->{commandBuffer}{$poller}) != 0) { $self->sendExternalCommand($poller, $self->{commandBuffer}{$poller}); $self->{commandBuffer}{$poller} = ""; @@ -1116,11 +1186,11 @@ sub run { } closedir $dh; } - + if (defined($self->{timeSyncPerf}) && $self->{timeSyncPerf}) { $self->{difTime} = time() - $self->{timeSyncPerf}; } - + # Get PerfData on Nagios Poller if ((defined($self->{difTime}) && $self->{timeBetween2SyncPerf} <= $self->{difTime}) || $self->{timeSyncPerf} == 0){ # Check Activity profile Status diff --git a/src/Centreon/Domain/Entity/CfgCentreonBrokerInfo.php b/src/Centreon/Domain/Entity/CfgCentreonBrokerInfo.php new file mode 100644 index 00000000000..59e00d170cb --- /dev/null +++ b/src/Centreon/Domain/Entity/CfgCentreonBrokerInfo.php @@ -0,0 +1,106 @@ +configKey = $configKey; + $this->configValue = $configValue; + } + + public function setConfigId(int $configId): void + { + $this->configId = $configId; + } + + public function getConfigId(): int + { + return $this->configId; + } + + public function setConfigGroup(string $configGroup): void + { + $this->configGroup = $configGroup; + } + + public function getConfigGroup(): string + { + return $this->configGroup; + } + + public function setConfigGroupId(int $configGroupId): void + { + $this->configGroupId = $configGroupId; + } + + public function getConfigGroupId(): int + { + return $this->configGroupId; + } + + public function setConfigGroupLevel(int $configGroupLevel): void + { + $this->configGroupLevel = $configGroupLevel; + } + + public function getConfigGroupLevel(): int + { + return $this->configGroupLevel; + } + + public function setConfigKey(string $configKey): void + { + $this->configKey = $configKey; + } + + public function getConfigKey(): string + { + return $this->configKey; + } + + public function setConfigValue(string $configValue): void + { + $this->configValue = $configValue; + } + + public function getConfigValue(): string + { + return $this->configValue; + } +} diff --git a/src/Centreon/Domain/Repository/CfgCentreonBorkerInfoRepository.php b/src/Centreon/Domain/Repository/CfgCentreonBorkerInfoRepository.php deleted file mode 100644 index ce75afcd33b..00000000000 --- a/src/Centreon/Domain/Repository/CfgCentreonBorkerInfoRepository.php +++ /dev/null @@ -1,42 +0,0 @@ -db->prepare($sql); - $stmt->execute(); - - $result = []; - - while ($row = $stmt->fetch()) { - $result[] = $row; - } - - return $result; - } -} diff --git a/src/Centreon/Domain/Repository/CfgCentreonBorkerRepository.php b/src/Centreon/Domain/Repository/CfgCentreonBorkerRepository.php deleted file mode 100644 index 652fbe3c7ee..00000000000 --- a/src/Centreon/Domain/Repository/CfgCentreonBorkerRepository.php +++ /dev/null @@ -1,49 +0,0 @@ -db->prepare($sql); - $stmt->execute(); - - $result = []; - - while ($row = $stmt->fetch()) { - $result[] = $row; - } - - return $result; - } - - public function truncate() - { - $sql = <<db->prepare($sql); - $stmt->execute(); - } -} diff --git a/src/Centreon/Domain/Repository/CfgCentreonBrokerInfoRepository.php b/src/Centreon/Domain/Repository/CfgCentreonBrokerInfoRepository.php new file mode 100644 index 00000000000..3ed984ec179 --- /dev/null +++ b/src/Centreon/Domain/Repository/CfgCentreonBrokerInfoRepository.php @@ -0,0 +1,96 @@ +db->prepare($sql); + $stmt->bindParam(':config_id', $configId, \PDO::PARAM_INT); + $stmt->bindParam(':config_group', $flow, \PDO::PARAM_STR); + $stmt->execute(); + + $row = $stmt->fetch(); + if (!is_null($row['max_config_group_id'])) { + // to get the new new config group id, we need to increment the max exsting one + $configGroupId = $row['max_config_group_id'] + 1; + } + + return $configGroupId; + } + + /** + * Insert broker configuration in database (table cfg_centreonbroker_info) + * + * @param CfgCentreonBrokerInfo $brokerInfoEntity the broker info entity + */ + public function add(CfgCentreonBrokerInfo $brokerInfoEntity): void + { + $sql = "INSERT INTO " . $brokerInfoEntity::TABLE . ' ' + . '(config_id, config_group, config_group_id, config_key, config_value) ' + . 'VALUES (:config_id, :config_group, :config_group_id, :config_key, :config_value)'; + $stmt = $this->db->prepare($sql); + $stmt->bindValue(':config_id', $brokerInfoEntity->getConfigId(), \PDO::PARAM_INT); + $stmt->bindValue(':config_group', $brokerInfoEntity->getConfigGroup(), \PDO::PARAM_STR); + $stmt->bindValue(':config_group_id', $brokerInfoEntity->getConfigGroupId(), \PDO::PARAM_INT); + $stmt->bindValue(':config_key', $brokerInfoEntity->getConfigKey(), \PDO::PARAM_STR); + $stmt->bindValue(':config_value', $brokerInfoEntity->getConfigValue(), \PDO::PARAM_STR); + $stmt->execute(); + } + + /** + * Export + * + * @param int[] $pollerIds + * @return array + */ + public function export(array $pollerIds): array + { + // prevent SQL exception + if (!$pollerIds) { + return []; + } + + $ids = join(',', $pollerIds); + + $sql = <<db->prepare($sql); + $stmt->execute(); + + $result = []; + + while ($row = $stmt->fetch()) { + $result[] = $row; + } + + return $result; + } +} diff --git a/src/Centreon/Domain/Repository/CfgCentreonBrokerRepository.php b/src/Centreon/Domain/Repository/CfgCentreonBrokerRepository.php new file mode 100644 index 00000000000..a6953d35f6e --- /dev/null +++ b/src/Centreon/Domain/Repository/CfgCentreonBrokerRepository.php @@ -0,0 +1,124 @@ +db->prepare($sql); + $stmt->execute(); + + if ($row = $stmt->fetch()) { + $configId = $row['config_id']; + } else { + throw new NotFoundException(_('Central broker config id not found')); + } + + return $configId; + } + + /** + * Get config id of poller broker + * + * @param int pollerId the poller id + * @return int the config id of poller broker + * @throws NotFoundException + */ + public function findBrokerConfigIdByPollerId(int $pollerId): int + { + // to find poller broker configuration, + // we search a configuration with an input which is listing on port 5669 + $sql = 'SELECT cb.config_id ' + . 'FROM cfg_centreonbroker cb, cfg_centreonbroker_info cbi, nagios_server ns ' + . 'WHERE cb.ns_nagios_server = ns.id ' + . 'AND cb.config_id = cbi.config_id ' + . 'AND cb.ns_nagios_server = :poller_id ' + . 'AND cb.daemon = 1 ' // central broker should be linked to cbd daemon + . 'AND cb.config_activate = "1" ' + . 'AND cbi.config_group = "input" ' + . 'AND cbi.config_value = "5669"'; + $stmt = $this->db->prepare($sql); + $stmt->bindParam(':poller_id', $pollerId, \PDO::PARAM_INT); + $stmt->execute(); + + if ($row = $stmt->fetch()) { + $configId = $row['config_id']; + } else { + throw new NotFoundException(_('Poller broker config id not found')); + } + + return $configId; + } + + /** + * Export poller's broker configurations + * + * @param int[] $pollerIds + * @return array + */ + public function export(array $pollerIds): array + { + // prevent SQL exception + if (!$pollerIds) { + return []; + } + + $ids = join(',', $pollerIds); + + $sql = <<db->prepare($sql); + $stmt->execute(); + + $result = []; + + while ($row = $stmt->fetch()) { + $result[] = $row; + } + + return $result; + } + + /** + * Truncate centreon broker configuration in database (cfg_centreonbroker, cfg_centreonbroker_info) + */ + public function truncate(): void + { + $sql = <<db->prepare($sql); + $stmt->execute(); + } +} diff --git a/src/Centreon/Domain/Repository/InformationsRepository.php b/src/Centreon/Domain/Repository/InformationsRepository.php index 48398a2c59b..a64e7800561 100644 --- a/src/Centreon/Domain/Repository/InformationsRepository.php +++ b/src/Centreon/Domain/Repository/InformationsRepository.php @@ -68,6 +68,9 @@ public function toggleRemote(string $flag): void */ public function authorizeMaster(string $ip): void { + $sql = "DELETE FROM `informations` WHERE `key` = 'authorizedMaster'"; + $stmt = $this->db->prepare($sql); + $stmt->execute(); $sql = "INSERT INTO `informations` (`key`, `value`) VALUES ('authorizedMaster', :ip)"; $stmt = $this->db->prepare($sql); $stmt->bindParam(':ip', $ip, PDO::PARAM_STR); diff --git a/src/Centreon/Domain/Repository/Interfaces/CfgCentreonBrokerInfoInterface.php b/src/Centreon/Domain/Repository/Interfaces/CfgCentreonBrokerInfoInterface.php new file mode 100644 index 00000000000..964296ad51c --- /dev/null +++ b/src/Centreon/Domain/Repository/Interfaces/CfgCentreonBrokerInfoInterface.php @@ -0,0 +1,24 @@ +brokerInfoRepository = $cfgCentreonBrokerInfo; + } + + /** + * Add flow (input, output, log...) + * + * @param int $configId the config id to update + * @param string $configGroup the config group to add (input, output...) + * @param CfgCentreonBrokerInfo[] $brokerInfoEntities the flow parameters to insert + */ + public function addFlow(int $configId, string $configGroup, array $brokerInfoEntities): void + { + // get new input config group id on central broker configuration + // to add new IPv4 input + $configGroupId = $this->brokerInfoRepository->getNewConfigGroupId($configId, $configGroup); + + // insert each line of configuration in database thanks to BrokerInfoEntity + foreach ($brokerInfoEntities as $brokerInfoEntity) { + $brokerInfoEntity->setConfigId($configId); + $brokerInfoEntity->setConfigGroup($configGroup); + $brokerInfoEntity->setConfigGroupId($configGroupId); + $this->brokerInfoRepository->add($brokerInfoEntity); + } + } +} \ No newline at end of file diff --git a/src/Centreon/Infrastructure/Service/CentcoreConfigService.php b/src/Centreon/Infrastructure/Service/CentcoreConfigService.php index a743a7c3867..5946f513f15 100644 --- a/src/Centreon/Infrastructure/Service/CentcoreConfigService.php +++ b/src/Centreon/Infrastructure/Service/CentcoreConfigService.php @@ -17,7 +17,7 @@ class CentcoreConfigService /** * Macros getter - * + * * @return array */ public function getMacros(): array @@ -28,20 +28,20 @@ public function getMacros(): array return $this->macros; } - + /** * Replace macros with their values - * + * * @param string $string */ public function replaceMacros(&$string): void { $macros = $this->getMacros(); - + foreach ($macros as $key => $val) { $key = str_replace("'", "\\'", $key); $macro = sprintf(static::MACROS_DELIMITER_TEMPLATE, $key); - + $string = str_replace($macro, $val, $string); } } @@ -114,7 +114,7 @@ private function _initMacros(): void * centreon_plugins */ } - + private function _parseIniFile($filename): array { $reslt = []; @@ -122,7 +122,7 @@ private function _parseIniFile($filename): array try { $reslt = parse_ini_file($filename); } catch (\Exception $ex) { - + } return $reslt; diff --git a/src/Centreon/ServiceProvider.php b/src/Centreon/ServiceProvider.php index a107b8d19b6..c64865b4f7b 100644 --- a/src/Centreon/ServiceProvider.php +++ b/src/Centreon/ServiceProvider.php @@ -9,6 +9,9 @@ use Centreon\Infrastructure\Service\CentcoreConfigService; use Centreon\Infrastructure\Service\CentreonDBManagerService; use Centreon\Domain\Service\AppKeyGeneratorService; +use Centreon\Domain\Service\BrokerConfigurationService; +use Centreon\Domain\Repository\CfgCentreonBrokerRepository; +use Centreon\Domain\Repository\CfgCentreonBrokerInfoRepository; use CentreonClapi\CentreonACL; class ServiceProvider implements AutoloadServiceProviderInterface @@ -16,7 +19,7 @@ class ServiceProvider implements AutoloadServiceProviderInterface /** * Register Centreon services - * + * * @param \Pimple\Container $pimple */ public function register(Container $pimple): void @@ -66,12 +69,39 @@ public function register(Container $pimple): void }; $pimple['centreon.config'] = function(Container $container) : CentcoreConfigService { - $service = new CentcoreConfigService($container); + $service = new CentcoreConfigService(); + + return $service; + }; + + /** + * Repositories + */ + + $pimple['centreon.broker_repository'] = function(Container $container): CfgCentreonBrokerRepository { + $service = new CfgCentreonBrokerRepository($container['configuration_db']); + + return $service; + }; + + $pimple['centreon.broker_info_repository'] = function(Container $container): CfgCentreonBrokerInfoRepository { + $service = new CfgCentreonBrokerInfoRepository($container['configuration_db']); + + return $service; + }; + + /** + * Services + */ + + $pimple['centreon.broker_configuration_service'] = function(Container $container): BrokerConfigurationService { + $service = new BrokerConfigurationService($container['configuration_db']); + $service->setBrokerInfoRepository($container['centreon.broker_info_repository']); return $service; }; } - + public static function order() : int { return 1; } diff --git a/src/Centreon/Tests/ServiceProviderTest.php b/src/Centreon/Tests/ServiceProviderTest.php index a00c722be49..2912584be95 100644 --- a/src/Centreon/Tests/ServiceProviderTest.php +++ b/src/Centreon/Tests/ServiceProviderTest.php @@ -26,7 +26,7 @@ protected function setUp() $this->container = new Container; $this->container['realtime_db'] = $this->container['configuration_db'] = new Mock\CentreonDB; // $this->container['configuration_db']->addResultSet("SELECT * FROM informations WHERE `key` = :key LIMIT 1", []); - + $this->provider->register($this->container); } @@ -49,9 +49,9 @@ public function testCheckServicesByList() // check list of services foreach ($checkList as $serviceName => $className) { $this->assertTrue($this->container->offsetExists($serviceName)); - + $service = $this->container->offsetGet($serviceName); - + $this->assertInstanceOf($className, $service); } } @@ -62,7 +62,7 @@ public function testCheckServicesByList() public function testUserService() { $this->assertTrue($this->container->offsetExists('centreon.user')); - + (new Mock\Centreon())->generateSession(); $service = $this->container->offsetGet('centreon.user'); diff --git a/src/CentreonRemote/Application/Clapi/CentreonRemoteServer.php b/src/CentreonRemote/Application/Clapi/CentreonRemoteServer.php index 771ede91d29..b9926093250 100644 --- a/src/CentreonRemote/Application/Clapi/CentreonRemoteServer.php +++ b/src/CentreonRemote/Application/Clapi/CentreonRemoteServer.php @@ -9,6 +9,9 @@ use Centreon\Infrastructure\Service\CentreonClapiServiceInterface; use ReflectionClass; +/** + * Class to manage remote server with clapi (enable, disable, import) + */ class CentreonRemoteServer implements CentreonClapiServiceInterface { @@ -28,70 +31,98 @@ public static function getName() : string return (new \ReflectionClass(__CLASS__))->getShortName(); } - public function enableRemote($ip) + /** + * Clapi command to enable remote server + * + * @param string $ip ip address of the central server + */ + public function enableRemote(string $string_ip) { - if (!filter_var($ip, FILTER_VALIDATE_IP)) { - echo "Incorrect IP parameter, please pass `-v IP` of the master server\n"; return 200; + $ipList = explode(',', $string_ip); + foreach ($ipList as $ip) { + if (!filter_var($ip, FILTER_VALIDATE_IP)) { + printf("Incorrect IP parameter: '%s', please pass `-v IP` of the master server\n", $ip); + return null; + } } echo "Starting Centreon Remote enable process: \n"; - echo "\n Limiting Menu Access..."; + echo "Limiting Menu Access..."; $result = $this->getDi()['centreon.db-manager']->getRepository(TopologyRepository::class)->disableMenus(); echo ($result) ? 'Success' : 'Fail' . "\n"; - echo "\n Limiting Actions..."; - $result = $this->getDi()['centreon.db-manager']->getRepository(InformationsRepository::class)->toggleRemote('yes'); - echo 'Done'. "\n"; + echo "Limiting Actions..."; + $this->getDi()['centreon.db-manager']->getRepository(InformationsRepository::class)->toggleRemote('yes'); + echo "Done\n"; - echo "\n Authorizing Master..."; - $result = $this->getDi()['centreon.db-manager']->getRepository(InformationsRepository::class)->authorizeMaster($ip); - echo 'Done'. "\n"; + echo "Authorizing Master..."; + $this->getDi()['centreon.db-manager']->getRepository(InformationsRepository::class)->authorizeMaster($string_ip); + echo "Done\n"; - echo "\n Set 'remote' instance type..."; - system("sed -i -r 's/(\\\$instance_mode?\s+=?\s+\")([a-z]+)(\";)/\\1remote\\3/' " . _CENTREON_ETC_ . "/conf.pm"); - echo 'Done'. "\n"; + echo "Set 'remote' instance type..."; + system( + "sed -i -r 's/(\\\$instance_mode?\s+=?\s+\")([a-z]+)(\";)/\\1remote\\3/' " . _CENTREON_ETC_ . "/conf.pm" + ); + echo "Done\n"; - echo "\n Notifying Master..."; + echo "Notifying Master..."; $result = $this->getDi()['centreon.notifymaster']->pingMaster($ip); - echo (!empty($result['status']) && $result['status'] == 'success') ? 'Success' : 'Fail' . "\n"; + $result = ""; + foreach ($ipList as $ip) { + $result = $this->getDi()['centreon.notifymaster']->pingMaster($ip); + if (!empty($result['status']) && $result['status'] == 'success') { + echo "Success\n"; + continue; + } + } + if (empty($result['status']) || $result['status'] != 'success') { + printf("Fail: %s\n", $result['details']); + } - echo "\n Centreon Remote enabling finished.\n"; + echo "Centreon Remote enabling finished.\n"; } - public function disableRemote() + /** + * Clapi command to disable remote server + */ + public function disableRemote(): void { echo "Starting Centreon Remote disable process: \n"; - echo "\n Restoring Menu Access..."; + echo "Restoring Menu Access..."; $result = $this->getDi()['centreon.db-manager']->getRepository(TopologyRepository::class)->enableMenus(); echo ($result) ? 'Success' : 'Fail' . "\n"; - echo "\n Restoring Actions..."; - $result = $this->getDi()['centreon.db-manager']->getRepository(InformationsRepository::class)->toggleRemote('no'); + echo "Restoring Actions..."; + $this->getDi()['centreon.db-manager']->getRepository(InformationsRepository::class)->toggleRemote('no'); echo 'Done'. "\n"; - echo "\n Restore 'central' instance type..."; - system("sed -i -r 's/(\\\$instance_mode?\s+=?\s+\")([a-z]+)(\";)/\\1central\\3/' " . _CENTREON_ETC_ . "/conf.pm"); - echo 'Done'. "\n"; + echo "Restore 'central' instance type..."; + system( + "sed -i -r 's/(\\\$instance_mode?\s+=?\s+\")([a-z]+)(\";)/\\1central\\3/' " . _CENTREON_ETC_ . "/conf.pm" + ); + echo "Done\n"; - echo "\n Centreon Remote disabling finished.\n"; + echo "Centreon Remote disabling finished.\n"; } - public function import() + /** + * Import files which are stored in import directory + */ + public function import(): void { echo "Starting Centreon Remote import process: \n"; - echo "\n Importing..."; + echo "Importing..."; try { $this->getDi()['centreon_remote.export']->import(); echo "Success\n"; - } catch (\Exception $ex) { - echo "Fail:\n"; - echo $ex->__toString()."\n"; + } catch (\Exception $e) { + echo "Fail: " . $e->getMessage() . "\n"; } - echo "\n Centreon Remote import finished.\n"; + echo "Centreon Remote import finished.\n"; } public function getDi(): Container diff --git a/src/CentreonRemote/Application/Clapi/CentreonWorker.php b/src/CentreonRemote/Application/Clapi/CentreonWorker.php index c6482f60627..a58273e80f1 100644 --- a/src/CentreonRemote/Application/Clapi/CentreonWorker.php +++ b/src/CentreonRemote/Application/Clapi/CentreonWorker.php @@ -5,12 +5,14 @@ use Centreon\Domain\Repository\TaskRepository; use Centreon\Infrastructure\Service\CentcoreCommandService; use CentreonRemote\Infrastructure\Export\ExportCommitment; -use Curl\Curl; use Pimple\Container; use Centreon\Infrastructure\Service\CentreonClapiServiceInterface; use Centreon\Domain\Entity\Task; use Centreon\Domain\Entity\Command; +/** + * Manage worker queue with centcore (import/export tasks...) + */ class CentreonWorker implements CentreonClapiServiceInterface { @@ -35,82 +37,105 @@ public static function getName() : string } /** - * Worker method to process task queue for import/export - * @return int + * Process task queue for import/export + * + * @return void */ - public function processQueue() + public function processQueue(): void { - $datetime = (new \DateTime())->format("Y:m:d h:i:s"); - echo "\n[{$datetime}] Checking for pending export tasks: "; - - $tasks = $this->getDi()['centreon.db-manager']->getRepository(TaskRepository::class)->findExportTasks(); - if (count($tasks) == 0) { - echo "None found"; - } else { - foreach ($tasks as $x => $task) { - /* - * mark task as being worked on - */ - $this->getDi()['centreon.taskservice']->updateStatus($task->getId(),Task::STATE_PROGRESS); - - $params = unserialize($task->getParams())['params']; - $commitment = new ExportCommitment($params['server'], $params['pollers']); - - try { - $this->getDi()['centreon_remote.export']->export($commitment); - } catch (\Exception $e) { - echo $e->__toString()."\n"; - } - - $this->getDi()['centreon.taskservice']->updateStatus($task->getId(),Task::STATE_COMPLETED); - - /** - * move export file - */ - $cmd = new Command(); - $compositeKey = $params['server'].':'.$task->getId(); - $cmd->setCommandLine(Command::COMMAND_TRANSFER_EXPORT_FILES.$compositeKey); - $cmdService = new CentcoreCommandService(); - $cmdWritten = $cmdService->sendCommand($cmd); - - echo ($x ? ', ' : '') . "#" . $task->getId(); + // check export tasks in database and execute these + $this->processExportTasks(); + + // check import tasks in database and execute these + $this->processImportTasks(); + } + + /** + * Execute export tasks which are store in task table + * + * @return void + */ + private function processExportTasks(): void + { + $datetime = (new \DateTime())->format("Y-m-d H:i:s"); + $tasks = $this->getDi()['centreon.db-manager']->getRepository(TaskRepository::class)->findExportTasks() ?? []; + + echo "{$datetime} - Checking for pending export tasks: " . count($tasks) . " task(s) found\n"; + + foreach (array_values($tasks) as $task) { + echo "{$datetime} - Processing task #" . $task->getId() . " ... "; + + /* + * mark task as being worked on + */ + $this->getDi()['centreon.taskservice']->updateStatus($task->getId(), Task::STATE_PROGRESS); + + $params = unserialize($task->getParams())['params']; + $commitment = new ExportCommitment($params['server'], $params['pollers']); + + try { + $this->getDi()['centreon_remote.export']->export($commitment); + } catch (\Exception $e) { + echo $e->getMessage() . "\n"; } + + $this->getDi()['centreon.taskservice']->updateStatus($task->getId(), Task::STATE_COMPLETED); + + /** + * move export file + */ + $cmd = new Command(); + $compositeKey = $params['server'] . ':' . $task->getId(); + $cmd->setCommandLine(Command::COMMAND_TRANSFER_EXPORT_FILES . $compositeKey); + $cmdService = new CentcoreCommandService(); + $cmdWritten = $cmdService->sendCommand($cmd); + + echo "finished.\n"; } + } + + /** + * Execute import tasks which are store in task table + * + * @return void + */ + private function processImportTasks(): void + { + $datetime = (new \DateTime())->format("Y-m-d H:i:s"); + $tasks = $this->getDi()['centreon.db-manager']->getRepository(TaskRepository::class)->findImportTasks() ?? []; + + echo "{$datetime} - Checking for pending import tasks: " . count($tasks) . " task(s) found\n"; + + foreach ($tasks as $x => $task) { + echo "{$datetime} - Processing task #" . $task->getId() . " (parent ID #" . $task->getParentId() . ") ... "; - echo "\n[{$datetime}] Checking for pending import tasks: "; - - $tasks = $this->getDi()['centreon.db-manager']->getRepository(TaskRepository::class)->findImportTasks(); - - if (count($tasks) == 0) - { - echo "None found"; - } else { - foreach ($tasks as $x => $task) { - /* - * mark task as being worked on - */ - $this->getDi()['centreon.taskservice']->updateStatus($task->getId(),Task::STATE_PROGRESS); - - try { - $this->getDi()['centreon_remote.export']->import(); - } catch (\Exception $e) { - echo $e->__toString()."\n"; - } - $this->getDi()['centreon.taskservice']->updateStatus($task->getId(),Task::STATE_COMPLETED); - - echo ($x ? ', ' : '') . "#" . $task->getId() . " (parent ID #" . $task->getParentId() . ")"; + /* + * mark task as being worked on + */ + $this->getDi()['centreon.taskservice']->updateStatus($task->getId(), Task::STATE_PROGRESS); + + try { + $this->getDi()['centreon_remote.export']->import(); + } catch (\Exception $e) { + echo $e->getMessage() . "\n"; } + $this->getDi()['centreon.taskservice']->updateStatus($task->getId(), Task::STATE_COMPLETED); + echo "finished.\n"; } - echo "\n[{$datetime}] Worker cycle completed."; + echo "{$datetime} - Worker cycle completed.\n"; } /** * Worker method to create task for import on remote. + * + * @param int $taskId the task id to create on the remote server + * @return void */ - public function createRemoteTask(int $taskId) + public function createRemoteTask(int $taskId): void { + // find task parameters (type, status, params...) $task = $this->getDi()['centreon.db-manager']->getRepository(TaskRepository::class)->findOneById($taskId); /** @@ -119,19 +144,20 @@ public function createRemoteTask(int $taskId) $params = unserialize($task->getParams())['params']; $centreonPath = trim($params['centreon_path'], '/'); $centreonPath = $centreonPath ? $centreonPath : '/centreon'; - $url = "{$params['remote_ip']}/{$centreonPath}/api/external.php?object=centreon_task_service&action=AddImportTaskWithParent"; + $url = "{$params['remote_ip']}/{$centreonPath}/api/external.php?" + . "object=centreon_task_service&action=AddImportTaskWithParent"; try { - $curl = new Curl; - $res = $curl->post($url, ['parent_id' => $task->getId()]); - - if ($curl->error) { - printf("Curl error while creating parent task: %s\n", $curl->error_message); - printf("url called: %s\n", $url); - } - } catch (\ErrorException $e) { - echo "Curl error while creating parent task\n"; - echo $e->__toString()."\n"; + $curl = new \CentreonRestHttp; + $res = $curl->call( + $url, + 'POST', + ['parent_id' => $task->getId()] + ); + + } catch (\Exception $e) { + echo "Error while creating parent task on $url\n"; + echo $e->getMessage() . "\n"; } } diff --git a/src/CentreonRemote/Application/Validator/WizardConfigurationRequestValidator.php b/src/CentreonRemote/Application/Validator/WizardConfigurationRequestValidator.php index ea8838cdefb..b08083b1b95 100644 --- a/src/CentreonRemote/Application/Validator/WizardConfigurationRequestValidator.php +++ b/src/CentreonRemote/Application/Validator/WizardConfigurationRequestValidator.php @@ -4,29 +4,48 @@ use CentreonRemote\Domain\Value\ServerWizardIdentity; +/** + * class to validate poller wizard forms + */ class WizardConfigurationRequestValidator { - public static function validate() + /** + * validate arguments sent from poller/remote server wizard + * + * @return void + */ + public static function validate(): void { (new static)->validateServerPostData(); } - public function validateServerPostData() + /** + * validate post arguments + * + * @return void + */ + public function validateServerPostData(): void { $isRemoteConnection = (new ServerWizardIdentity)->requestConfigurationIsRemote(); $this->validateServerGeneralFields(); + // if it is a remote server, validate specific fields (like database connection parameterss) if ($isRemoteConnection) { $this->validateRemoteSpecificFields(); } } - private function validateServerGeneralFields() + /** + * validate general form fields which are in poller wizard and remote server wizard + * + * @return void + */ + private function validateServerGeneralFields(): void { $missingParameterMessage = "You need to send '%s' in the request."; - + if (!isset($_POST['server_name']) || !$_POST['server_name']) { throw new \RestBadRequestException( sprintf(_($missingParameterMessage), 'server_name') @@ -58,7 +77,12 @@ private function validateServerGeneralFields() } } - private function validateRemoteSpecificFields() + /** + * validate form fields which are specific to remote server wizard + * + * @return void + */ + private function validateRemoteSpecificFields(): void { if (!isset($_POST['db_user']) || !$_POST['db_user']) { throw new \RestBadRequestException( diff --git a/src/CentreonRemote/Application/Webservice/CentreonConfigurationRemote.php b/src/CentreonRemote/Application/Webservice/CentreonConfigurationRemote.php index aa2746cb6af..19ff52a0e14 100755 --- a/src/CentreonRemote/Application/Webservice/CentreonConfigurationRemote.php +++ b/src/CentreonRemote/Application/Webservice/CentreonConfigurationRemote.php @@ -14,7 +14,7 @@ class CentreonConfigurationRemote extends CentreonWebServiceAbstract /** * Name of web service object - * + * * @return string */ public static function getName(): string @@ -49,7 +49,7 @@ public static function getName(): string * ) * * Get remotes servers waitlist - * + * * @return array */ public function postGetWaitList(): array @@ -88,6 +88,7 @@ public function postGetWaitList(): array * Get list with connected remotes * * @return array + * @example ['id' => 'poller id', 'ip' => 'poller ip address', 'name' => 'poller name'] */ public function postGetRemotesList(): array { @@ -204,83 +205,105 @@ public function postGetRemotesList(): array * * Link centreon remote server * - * @return string + * @return array + * @example ['error' => true, 'message' => 'error message'] + * @example ['success' => true, 'task_id' => 'task id'] * * @throws \RestBadRequestException */ - public function postLinkCentreonRemoteServer() + public function postLinkCentreonRemoteServer(): array { + // retrieve post values to be used in other classes $_POST = json_decode(file_get_contents('php://input'), true); - $openBrokerFlow = isset($_POST['open_broker_flow']); + + $openBrokerFlow = isset($this->arguments['open_broker_flow']) && $this->arguments['open_broker_flow'] === true; + $centreonPath = $this->arguments['centreon_folder'] ?? '/centreon/'; $serverWizardIdentity = new ServerWizardIdentity; $isRemoteConnection = $serverWizardIdentity->requestConfigurationIsRemote(); - $serverHasBamInstalled = false; $configurationServiceName = $isRemoteConnection ? 'centreon_remote.remote_connection_service' : 'centreon_remote.poller_connection_service'; + // validate form fields WizardConfigurationRequestValidator::validate(); /** @var $pollerConfigurationService LinkedPollerConfigurationService */ - /** @var $pollerConfigurationBridge PollerConfigurationRequestBridge */ - /** @var $serverConfigurationService ServerConnectionConfigurationService */ $pollerConfigurationService = $this->getDi()['centreon_remote.poller_config_service']; + /** @var $serverConfigurationService ServerConnectionConfigurationService */ $serverConfigurationService = $this->getDi()[$configurationServiceName]; + /** @var $pollerConfigurationBridge PollerConfigurationRequestBridge */ $pollerConfigurationBridge = $this->getDi()['centreon_remote.poller_config_bridge']; - $serverIP = $_POST['server_ip']; - $serverName = substr($_POST['server_name'], 0, 40); + $serverIP = $this->arguments['server_ip']; + $serverName = substr($this->arguments['server_name'], 0, 40); - $serverConfigurationService->setCentralIp($_POST['centreon_central_ip']); + $serverConfigurationService->setCentralIp($this->arguments['centreon_central_ip']); $serverConfigurationService->setServerIp($serverIP); $serverConfigurationService->setName($serverName); - $serverConfigurationService->setOpenBrokerFlow($openBrokerFlow); + $serverConfigurationService->setOnePeerRetention($openBrokerFlow); + + $pollerConfigurationService->setOnePeerRetention($openBrokerFlow); + // set linked pollers + $pollerConfigurationBridge->collectDataFromRequest(); + + // if it's a remote server, set database connection information and check if bam is installed if ($isRemoteConnection) { - $serverConfigurationService->setDbUser($_POST['db_user']); - $serverConfigurationService->setDbPassword($_POST['db_password']); - $serverHasBamInstalled = $serverWizardIdentity->fetchIfServerInstalledBam($serverIP, $_POST['centreon_folder']); + $serverConfigurationService->setDbUser($this->arguments['db_user']); + $serverConfigurationService->setDbPassword($this->arguments['db_password']); + if ($serverWizardIdentity->checkBamOnRemoteServer($serverIP, $centreonPath)) { + $serverConfigurationService->shouldInsertBamBrokers(); + } } - // Add configuration of the new server in the database + // Add configuration of the new server in the database (poller, engine, broker...) try { - if ($serverHasBamInstalled) { - $serverConfigurationService->shouldInsertBamBrokers(); + // If server not linked to a poller, then it is linked to central server + if (!$pollerConfigurationBridge->hasPollersForUpdating()) { + $serverConfigurationService->isLinkedToCentralServer(); } - $serverID = $serverConfigurationService->insert(); - } catch(\Exception $e) { + $serverId = $serverConfigurationService->insert(); + } catch (\Exception $e) { return ['error' => true, 'message' => $e->getMessage()]; } - $pollerConfigurationBridge->setServerID($serverID); - $pollerConfigurationBridge->collectDataFromRequest(); $taskId = null; - // If you want to link pollers to a remote - if ($pollerConfigurationBridge->hasPollersForUpdating()) { - $remoteServer = $pollerConfigurationBridge->getRemoteServerForConfiguration(); - $pollerServers = $pollerConfigurationBridge->getLinkedPollersSelectedForUpdate(); - $pollerConfigurationService->setOpenBrokerFlow($openBrokerFlow); - $pollerConfigurationService->setPollersConfigurationWithServer($pollerServers, $remoteServer); - - /** - * Create Export Task - */ - $params = []; - foreach ($pollerServers as $poller){ - $params['pollers'][] = $poller->getId(); + // if it is remote server wizard, create an export task and link pollers to it if needed + if ($isRemoteConnection) { + $remoteServer = $pollerConfigurationBridge->getPollerFromId($serverId); + + // set basic parameters to export task + $params = [ + 'server' => $remoteServer->getId(), + 'remote_ip' => $remoteServer->getIp(), + 'centreon_path' => $centreonPath, + 'pollers' => [] + ]; + + // If you want to link pollers to a remote + if ($pollerConfigurationBridge->hasPollersForUpdating()) { + $pollers = $pollerConfigurationBridge->getLinkedPollersSelectedForUpdate(); + $pollerConfigurationService->linkPollersToParentPoller($pollers, $remoteServer); + + foreach ($pollers as $poller) { + $params['pollers'][] = $poller->getId(); + } } - $params['server'] = $remoteServer->getId(); - $params['remote_ip'] = $remoteServer->getIp(); - $params['centreon_path'] = $_POST['centreon_folder'] ?? '/centreon/'; + + // Create export task $taskId = $this->createExportTask($params); - } - if ($isRemoteConnection) { - $centreonPath = $_POST['centreon_folder'] ?? '/centreon/'; + // add server to the list of remote servers in database (table remote_servers) $this->addServerToListOfRemotes($serverIP, $centreonPath); $this->setCentreonInstanceAsCentral(); + + // if it is poller wizard and poller is linked to another poller/remote server (instead of central) + } elseif ($pollerConfigurationBridge->hasPollersForUpdating()) { + $pollers = [$pollerConfigurationBridge->getPollerFromId($serverId)]; + $parentPoller = $pollerConfigurationBridge->getLinkedPollersSelectedForUpdate()[0]; + $pollerConfigurationService->linkPollersToParentPoller($pollers, $parentPoller); } return ['success' => true, 'task_id' => $taskId]; diff --git a/src/CentreonRemote/Application/Webservice/CentreonTaskService.php b/src/CentreonRemote/Application/Webservice/CentreonTaskService.php index 6eaac58e722..c9e05624301 100644 --- a/src/CentreonRemote/Application/Webservice/CentreonTaskService.php +++ b/src/CentreonRemote/Application/Webservice/CentreonTaskService.php @@ -11,7 +11,7 @@ class CentreonTaskService extends CentreonWebServiceAbstract /** * Name of web service object - * + * * @return string */ public static function getName(): string @@ -54,20 +54,20 @@ public static function getName(): string * * Get Status of task * - * @return string + * @return array + * @example ['success' => true, 'status' => 'status of the task'] * * @throws \RestBadRequestException */ - public function postGetTaskStatus() + public function postGetTaskStatus(): array { - $_POST = json_decode(file_get_contents('php://input'), true); - $task_id = (isset($_POST['task_id'])) ? $_POST['task_id'] : null; - - if ($task_id){ - $result = $this->getDi()['centreon.taskservice']->getStatus($task_id); + if (!isset($this->arguments['task_id'])) { + throw new \RestBadRequestException('Missing argument task_id'); } - return json_encode(['success' => true, 'status'=> $result]); + $result = $this->getDi()['centreon.taskservice']->getStatus($this->arguments['task_id']); + + return ['success' => true, 'status' => $result]; } /** @@ -105,20 +105,47 @@ public function postGetTaskStatus() * * Get Status of task by parent * - * @return string + * @return array + * @example ['success' => true, 'status' => 'status of the task'] * * @throws \RestBadRequestException */ - public function postGetTaskStatusByParent() + public function postGetRemoteTaskStatusByParent(): array { - $parent_id = (isset($_POST['parent_id'])) ? $_POST['parent_id'] : null; - $result = ''; + if (!isset($this->arguments['server_ip']) || + !isset($this->arguments['centreon_folder']) || + !isset($this->arguments['parent_id']) + ) { + throw new \RestBadRequestException('Missing arguments'); + } - if ($parent_id){ - $result = $this->getDi()['centreon.taskservice']->getStatusByParent($parent_id); + $result = $this->getDi()['centreon.taskservice'] + ->getRemoteStatusByParent( + $this->arguments['parent_id'], + $this->arguments['server_ip'], + $this->arguments['centreon_folder'] + ); + + return ['success' => true, 'status' => $result]; + } + + /** + * Find task status by parent id (used on remote server) + * + * @return array + * @example ['success' => true, 'status' => 'status of the task'] + * + * @throws \RestBadRequestException + */ + public function postGetTaskStatusByParent(): array + { + if (!isset($this->arguments['parent_id'])) { + throw new \RestBadRequestException('Missing argument parent_id'); } - return json_encode(['success' => true, 'status'=> $result]); + $result = $this->getDi()['centreon.taskservice']->getStatusByParent($this->arguments['parent_id']); + + return ['success' => true, 'status' => $result]; } /** @@ -163,46 +190,48 @@ public function postGetTaskStatusByParent() * * Add new import task with parent ID * - * @return string + * @return array + * @example ['success' => true, 'status' => 'status of the task'] * * @throws \RestBadRequestException */ - public function postAddImportTaskWithParent() + public function postAddImportTaskWithParent(): array { + if (!isset($this->arguments['parent_id'])) { + throw new \RestBadRequestException('Missing parent_id parameter'); + } + /* * make sure only authorized master can create task */ - $authorizedMaster = $this->getDi()['centreon.db-manager']->getRepository(InformationsRepository::class)->getOneByKey('authorizedMaster'); - if ($_SERVER['REMOTE_ADDR'] !== $authorizedMaster->getValue()){ - return json_encode(['success' => true, 'status'=> 'unauthorized']); + $authorizedMaster = $this->getDi()['centreon.db-manager']->getRepository(InformationsRepository::class) + ->getOneByKey('authorizedMaster'); + $authorizedMasterTab = explode(',', $authorizedMaster->getValue()); + + // if client is behind proxy or firewall, source ip can be updated + // then, we try to get HTTP_X_FORWARDED_FOR + if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']) { + $originIp = $_SERVER['HTTP_X_FORWARDED_FOR']; + } else { + $originIp = $_SERVER['REMOTE_ADDR']; + } + + if (!in_array($originIp, $authorizedMasterTab)) { + throw new \RestUnauthorizedException($originIp . ' is not authorized on this remote server'); } - $parent_id = (isset($_POST['parent_id'])) ? intval($_POST['parent_id']) : null; - $params = (isset($_POST['params'])) ? $_POST['params'] : ''; + $parentId = $this->arguments['parent_id']; + $params = isset($this->arguments['params']) ? $this->arguments['params'] : ''; // try to unserialize params string to array if (!$params = unserialize($params)) { $params = []; } - // input data validation - try { - if (!$parent_id) { - throw new Exception('Missing parent_id parameter'); - } - } catch (\Exception $ex) { - return json_encode([ - 'success' => false, - 'status' => $ex->getMessage(), - ]); - } - // add new task - $result = $this->getDi()['centreon.taskservice'] - ->addTask(Task::TYPE_IMPORT, $params, $parent_id) - ; + $result = $this->getDi()['centreon.taskservice']->addTask(Task::TYPE_IMPORT, $params, $parentId); - return json_encode(['success' => true, 'status'=> $result]); + return ['success' => true, 'status' => $result]; } /** @@ -214,7 +243,7 @@ public function postAddImportTaskWithParent() * * @return boolean If the user has access to the action */ - public function authorize($action, $user, $isInternal = false) + public function authorize($action, $user, $isInternal = false): bool { return true; } diff --git a/src/CentreonRemote/Domain/Exporter/PollerExporter.php b/src/CentreonRemote/Domain/Exporter/PollerExporter.php index b1e4251bea1..4a523a62a99 100644 --- a/src/CentreonRemote/Domain/Exporter/PollerExporter.php +++ b/src/CentreonRemote/Domain/Exporter/PollerExporter.php @@ -29,7 +29,7 @@ public function cleanup(): void $db->getRepository(Repository\NagiosServerRepository::class)->truncate(); $db->getRepository(Repository\PollerCommandRelationsRepository::class)->truncate(); $db->getRepository(Repository\CfgResourceRepository::class)->truncate(); - $db->getRepository(Repository\CfgCentreonBorkerRepository::class)->truncate(); + $db->getRepository(Repository\CfgCentreonBrokerRepository::class)->truncate(); } /** @@ -47,7 +47,7 @@ public function export(): void $nagiosServer = $this->db ->getRepository(Repository\NagiosServerRepository::class) ->export($pollerIds); - $nagiosServer = $overwritePollerService->setNagiosServer($nagiosServer); + $nagiosServer = $overwritePollerService->getNagiosServer($nagiosServer); $this->_dump($nagiosServer, $this->getFile(static::EXPORT_FILE_NAGIOS_SERVER)); })(); @@ -55,7 +55,7 @@ public function export(): void $cfgResource = $this->db ->getRepository(Repository\CfgResourceRepository::class) ->export($pollerIds); - $cfgResource = $overwritePollerService->setCfgResource($cfgResource); + $cfgResource = $overwritePollerService->getCfgResource($cfgResource); $this->_dump($cfgResource, $this->getFile(static::EXPORT_FILE_CFG_RESOURCE)); })(); @@ -79,7 +79,7 @@ public function export(): void $cfgNagios = $this->db ->getRepository(Repository\CfgNagiosRepository::class) ->export($pollerIds); - $cfgNagios = $overwritePollerService->setCfgNagios($cfgNagios); + $cfgNagios = $overwritePollerService->getCfgNagios($cfgNagios); $this->_dump($cfgNagios, $this->getFile(static::EXPORT_FILE_CFG_NAGIOS)); })(); @@ -87,23 +87,23 @@ public function export(): void $cfgNagiosBrokerModule = $this->db ->getRepository(Repository\CfgNagiosBrokerModuleRepository::class) ->export($pollerIds); - $cfgNagiosBrokerModule = $overwritePollerService->setCfgNagiosBroker($cfgNagiosBrokerModule); + $cfgNagiosBrokerModule = $overwritePollerService->getCfgNagiosBroker($cfgNagiosBrokerModule); $this->_dump($cfgNagiosBrokerModule, $this->getFile(static::EXPORT_FILE_CFG_NAGIOS_BROKER_MODULE)); })(); (function() use ($pollerIds, $overwritePollerService) { $cfgCentreonBroker = $this->db - ->getRepository(Repository\CfgCentreonBorkerRepository::class) + ->getRepository(Repository\CfgCentreonBrokerRepository::class) ->export($pollerIds); - $cfgCentreonBroker = $overwritePollerService->setCfgCentreonBroker($cfgCentreonBroker); + $cfgCentreonBroker = $overwritePollerService->getCfgCentreonBroker($cfgCentreonBroker); $this->_dump($cfgCentreonBroker, $this->getFile(static::EXPORT_FILE_CFG_CENTREONBROKER)); })(); (function() use ($pollerIds, $overwritePollerService) { $cfgCentreonBrokerInfo = $this->db - ->getRepository(Repository\CfgCentreonBorkerInfoRepository::class) + ->getRepository(Repository\CfgCentreonBrokerInfoRepository::class) ->export($pollerIds); - $cfgCentreonBrokerInfo = $overwritePollerService->setCfgCentreonBrokerInfo($cfgCentreonBrokerInfo); + $cfgCentreonBrokerInfo = $overwritePollerService->getCfgCentreonBrokerInfo($cfgCentreonBrokerInfo); $this->_dump($cfgCentreonBrokerInfo, $this->getFile(static::EXPORT_FILE_CFG_CENTREONBROKER_INFO)); })(); diff --git a/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgCentreonBroker.php b/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgCentreonBroker.php new file mode 100644 index 00000000000..d870f0f4e7c --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgCentreonBroker.php @@ -0,0 +1,56 @@ + 1, + 'config_name' => 'central-broker-master', + 'config_filename' => 'central-broker.xml', + 'config_write_timestamp' => '1', + 'config_write_thread_id' => '0', + 'config_activate' => '1', + 'event_queue_max_size' => 100000, + 'cache_directory' => '@centreonbroker_varlib@', + 'command_file' => '@centreonbroker_varlib@/command.sock', + 'daemon' => 1, + ], + [ + 'config_id' => 2, + 'config_name' => 'central-rrd-master', + 'config_filename' => 'central-rrd.xml', + 'config_write_timestamp' => '1', + 'config_write_thread_id' => '0', + 'config_activate' => '1', + 'ns_nagios_server' => 1, + 'event_queue_max_size' => 100000, + 'cache_directory' => '@centreonbroker_varlib@', + 'daemon' => 1, + ], + [ + 'config_id' => 3, + 'config_name' => 'central-module-master', + 'config_filename' => 'central-module.xml', + 'config_write_timestamp' => '0', + 'config_write_thread_id' => '0', + 'config_activate' => '1', + 'ns_nagios_server' => 1, + 'event_queue_max_size' => 100000, + 'cache_directory' => '@monitoring_var_lib@', + 'daemon' => 0, + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgCentreonBrokerInfo.php b/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgCentreonBrokerInfo.php new file mode 100644 index 00000000000..9fda8a5808b --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgCentreonBrokerInfo.php @@ -0,0 +1,1001 @@ + 1, + 'config_key' => 'name', + 'config_value' => 'central-broker-master-input', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'port', + 'config_value' => '5669', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'host', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'protocol', + 'config_value' => 'bbdo', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'tls', + 'config_value' => 'auto', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'private_key', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'public_cert', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'ca_certificate', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'negotiation', + 'config_value' => 'yes', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'one_peer_retention_mode', + 'config_value' => 'no', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'compression', + 'config_value' => 'auto', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'compression_level', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'compression_buffer', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'type', + 'config_value' => 'ipv4', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'blockId', + 'config_value' => '2_3', + 'config_group' => 'input', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'name', + 'config_value' => '@centreonbroker_log@/central-broker-master.log', + 'config_group' => 'logger', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'config', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'debug', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'error', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'info', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'level', + 'config_value' => 'low', + 'config_group' => 'logger', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'max_size', + 'config_value' => '', + 'config_group' => 'logger', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'type', + 'config_value' => 'file', + 'config_group' => 'logger', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'blockId', + 'config_value' => '3_17', + 'config_group' => 'logger', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'name', + 'config_value' => 'central-broker-master-sql', + 'config_group' => 'output', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'db_type', + 'config_value' => 'mysql', + 'config_group' => 'output', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'output', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'output', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'db_host', + 'config_value' => '@address@', + 'config_group' => 'output', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'db_port', + 'config_value' => '@port@', + 'config_group' => 'output', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'db_user', + 'config_value' => '@db_user@', + 'config_group' => 'output', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'db_password', + 'config_value' => '@db_password@', + 'config_group' => 'output', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'db_name', + 'config_value' => '@db_storage@', + 'config_group' => 'output', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'queries_per_transaction', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'read_timeout', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'type', + 'config_value' => 'sql', + 'config_group' => 'output', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'blockId', + 'config_value' => '1_16', + 'config_group' => 'output', + 'config_group_id' => 1, + ], + [ + 'config_id' => 1, + 'config_key' => 'name', + 'config_value' => 'centreon-broker-master-rrd', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'port', + 'config_value' => '5670', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'host', + 'config_value' => 'localhost', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'protocol', + 'config_value' => 'bbdo', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'tls', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'private_key', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'public_cert', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'ca_certificate', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'negotiation', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'one_peer_retention_mode', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'compression', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'compression_level', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'compression_buffer', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'type', + 'config_value' => 'ipv4', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'blockId', + 'config_value' => '1_3', + 'config_group' => 'output', + 'config_group_id' => 2, + ], + [ + 'config_id' => 1, + 'config_key' => 'name', + 'config_value' => 'central-broker-master-perfdata', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'interval', + 'config_value' => '60', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'length', + 'config_value' => '15552000', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'db_type', + 'config_value' => 'mysql', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'db_host', + 'config_value' => '@address@', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'db_port', + 'config_value' => '@port@', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'db_user', + 'config_value' => '@db_user@', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'db_password', + 'config_value' => '@db_password@', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'db_name', + 'config_value' => '@db_storage@', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'queries_per_transaction', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'read_timeout', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'check_replication', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'rebuild_check_interval', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'store_in_data_bin', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'insert_in_index_data', + 'config_value' => '1', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'type', + 'config_value' => 'storage', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + [ + 'config_id' => 1, + 'config_key' => 'blockId', + 'config_value' => '1_14', + 'config_group' => 'output', + 'config_group_id' => 3, + ], + + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + + [ + 'config_id' => 2, + 'config_key' => 'name', + 'config_value' => 'central-rrd-master-input', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + + 'config_id' => 2, + 'config_key' => 'port', + 'config_value' => '5670', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'host', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'protocol', + 'config_value' => 'bbdo', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'tls', + 'config_value' => 'auto', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'private_key', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'public_cert', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'ca_certificate', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'negotiation', + 'config_value' => 'yes', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'one_peer_retention_mode', + 'config_value' => 'no', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'compression', + 'config_value' => 'auto', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'compression_level', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'compression_buffer', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'type', + 'config_value' => 'ipv4', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'blockId', + 'config_value' => '2_3', + 'config_group' => 'input', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'name', + 'config_value' => '@centreonbroker_log@/central-rrd-master.log', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'config', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'debug', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'error', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'info', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'level', + 'config_value' => 'low', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'max_size', + 'config_value' => '', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'type', + 'config_value' => 'file', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'blockId', + 'config_value' => '3_17', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'name', + 'config_value' => 'central-rrd-master-output', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'metrics_path', + 'config_value' => '@centreon_varlib@/metrics', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'status_path', + 'config_value' => '@centreon_varlib@/status', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'path', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'port', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'write_metrics', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'write_status', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'type', + 'config_value' => 'rrd', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 2, + 'config_key' => 'blockId', + 'config_value' => '1_13', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + + [ + 'config_id' => 3, + 'config_key' => 'name', + 'config_value' => '@centreonbroker_log@/central-module-master.log', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'config', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'debug', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'error', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'info', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'level', + 'config_value' => 'low', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'max_size', + 'config_value' => '', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'type', + 'config_value' => 'file', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'blockId', + 'config_value' => '3_17', + 'config_group' => 'logger', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'name', + 'config_value' => 'central-module-master-output', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'port', + 'config_value' => '5669', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'host', + 'config_value' => 'localhost', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'protocol', + 'config_value' => 'bbdo', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'tls', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'private_key', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'public_cert', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'ca_certificate', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'negotiation', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'one_peer_retention_mode', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'compression', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'compression_level', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'compression_buffer', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'type', + 'config_value' => 'ipv4', + 'config_group' => 'output', + 'config_group_id' => 1 + ], + [ + 'config_id' => 3, + 'config_key' => 'blockId', + 'config_value' => '1_3', + 'config_group' => 'output', + 'config_group_id' => 1 + ] + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgNagios.php b/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgNagios.php new file mode 100644 index 00000000000..b98df4baa2f --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgNagios.php @@ -0,0 +1,145 @@ + 1, + 'nagios_name' => 'Centreon Engine Central', + 'log_file' => '@monitoring_varlog@/centengine.log', + 'cfg_dir' => '@monitoring_etc@', + 'temp_file' => '@monitoring_varlog@/centengine.tmp', + 'status_file' => '@monitoring_varlog@/status.dat', + 'check_result_path' => null, + 'use_check_result_path' => '0', + 'max_check_result_file_age' => null, + 'status_update_interval' => null, + 'nagios_user' => '@monitoring_user@', + 'nagios_group' => '@monitoring_group@', + 'enable_notifications' => '1', + 'execute_service_checks' => '1', + 'accept_passive_service_checks' => '1', + 'execute_host_checks' => '2', + 'accept_passive_host_checks' => '2', + 'enable_event_handlers' => '1', + 'log_rotation_method' => 'd', + 'log_archive_path' => '@monitoring_varlog@/archives/', + 'check_external_commands' => '1', + 'external_command_buffer_slots' => null, + 'command_check_interval' => '1s', + 'command_file' => '@monitoring_var_lib@/rw/centengine.cmd', + 'downtime_file' => null, + 'comment_file' => null, + 'lock_file' => '/var/lock/subsys/centengine.lock', + 'retain_state_information' => '1', + 'state_retention_file' => '@monitoring_varlog@/retention.dat', + 'retention_update_interval' => 60, + 'use_retained_program_state' => '1', + 'use_retained_scheduling_info' => '1', + 'retained_contact_host_attribute_mask' => null, + 'retained_contact_service_attribute_mask' => null, + 'retained_process_host_attribute_mask' => null, + 'retained_process_service_attribute_mask' => null, + 'retained_host_attribute_mask' => null, + 'retained_service_attribute_mask' => null, + 'use_syslog' => '0', + 'log_notifications' => '1', + 'log_service_retries' => '1', + 'log_host_retries' => '1', + 'log_event_handlers' => '1', + 'log_external_commands' => '1', + 'log_passive_checks' => '2', + 'global_host_event_handler' => null, + 'global_service_event_handler' => null, + 'sleep_time' => '0.2', + 'service_inter_check_delay_method' => 's', + 'host_inter_check_delay_method' => null, + 'service_interleave_factor' => 's', + 'max_concurrent_checks' => 400, + 'max_service_check_spread' => 5, + 'max_host_check_spread' => null, + 'check_result_reaper_frequency' => 5, + 'max_check_result_reaper_time' => null, + 'interval_length' => 60, + 'auto_reschedule_checks' => '2', + 'auto_rescheduling_interval' => null, + 'auto_rescheduling_window' => null, + 'use_aggressive_host_checking' => '1', + 'enable_flap_detection' => '0', + 'low_service_flap_threshold' => '25.0', + 'high_service_flap_threshold' => '50.0', + 'low_host_flap_threshold' => '25.0', + 'high_host_flap_threshold' => '50.0', + 'soft_state_dependencies' => '0', + 'service_check_timeout' => 60, + 'host_check_timeout' => 12, + 'event_handler_timeout' => 30, + 'notification_timeout' => 30, + 'ocsp_timeout' => 5, + 'ochp_timeout' => 5, + 'perfdata_timeout' => 5, + 'obsess_over_services' => '0', + 'ocsp_command' => null, + 'obsess_over_hosts' => '2', + 'ochp_command' => null, + 'process_performance_data' => '0', + 'host_perfdata_command' => null, + 'service_perfdata_command' => null, + 'host_perfdata_file' => null, + 'service_perfdata_file' => null, + 'host_perfdata_file_template' => null, + 'service_perfdata_file_template' => null, + 'host_perfdata_file_mode' => '2', + 'service_perfdata_file_mode' => '2', + 'host_perfdata_file_processing_interval' => null, + 'service_perfdata_file_processing_interval' => null, + 'host_perfdata_file_processing_command' => null, + 'service_perfdata_file_processing_command' => null, + 'check_for_orphaned_services' => '0', + 'check_for_orphaned_hosts' => '0', + 'check_service_freshness' => '1', + 'service_freshness_check_interval' => null, + 'freshness_check_interval' => null, + 'check_host_freshness' => '2', + 'host_freshness_check_interval' => null, + 'date_format' => 'euro', + 'illegal_object_name_chars' => '~!$%^&*"|'<>?,()=', + 'illegal_macro_output_chars' => '`~$^&"|'<>', + 'use_regexp_matching' => '2', + 'use_true_regexp_matching' => '2', + 'admin_email' => 'admin@localhost', + 'admin_pager' => 'admin', + 'nagios_comment' => 'Centreon Engine', + 'nagios_activate' => '1', + 'event_broker_options' => '-1', + 'translate_passive_host_checks' => null, + 'nagios_server_id' => 1, + 'enable_predictive_host_dependency_checks' => '2', + 'enable_predictive_service_dependency_checks' => '2', + 'cached_host_check_horizon' => 60, + 'cached_service_check_horizon' => null, + 'passive_host_checks_are_soft' => null, + 'use_large_installation_tweaks' => '2', + 'enable_environment_macros' => '2', + 'additional_freshness_latency' => null, + 'debug_file' => '@monitoring_varlog@/centengine.debug', + 'debug_level' => 0, + 'debug_level_opt' => '0', + 'debug_verbosity' => '2', + 'max_debug_file_size' => null, + 'cfg_file' => 'centengine.cfg' + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgNagiosBrokerModule.php b/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgNagiosBrokerModule.php new file mode 100644 index 00000000000..2ecec58e4a5 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgNagiosBrokerModule.php @@ -0,0 +1,28 @@ + 1, + 'broker_module' => '@centreon_engine_lib@/externalcmd.so', + ], + [ + 'cfg_nagios_id' => 1, + 'broker_module' => '@centreonbroker_cbmod@ @centreonbroker_etc@/central-module.xml', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgResource.php b/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgResource.php new file mode 100644 index 00000000000..379da2f73e4 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/DefaultConfig/CfgResource.php @@ -0,0 +1,33 @@ + '$USER1$', + 'resource_line' => '@plugin_dir@', + 'resource_comment' => 'Nagios Plugins Path', + 'resource_activate' => '1', + ], + [ + 'resource_name' => '$CENTREONPLUGINS$', + 'resource_line' => '@centreonplugins@', + 'resource_comment' => 'Centreon Plugins Path', + 'resource_activate' => '1', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/DefaultConfig/NagiosServer.php b/src/CentreonRemote/Domain/Resources/DefaultConfig/NagiosServer.php new file mode 100644 index 00000000000..135a7b960a8 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/DefaultConfig/NagiosServer.php @@ -0,0 +1,40 @@ + 'Central', + 'localhost' => '1', + 'is_default' => 1, + 'last_restart' => 0, + 'ns_ip_address' => '127.0.0.1', + 'ns_activate' => '1', + 'ns_status' => '0', + 'init_script' => '@monitoring_init_script@', + 'monitoring_engine' => 'CENGINE', + 'nagios_bin' => '@monitoring_binary@', + 'nagiostats_bin' => '@centreon_engine_stats_binary@', + 'nagios_perfdata' => '@monitoring_varlog@/service-perfdata', + 'centreonbroker_cfg_path' => '@broker_etc@', + 'centreonbroker_module_path' => '@centreonbroker_lib@', + 'centreonconnector_path' => '@centreon_engine_connectors@', + 'ssh_port' => 22, + 'ssh_private_key' => null, + 'init_script_centreontrapd' => 'centreontrapd', + 'snmp_trapd_path_conf' => '/etc/snmp/centreon_traps/', + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BamBrokerCfgInfo.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BamBrokerCfgInfo.php new file mode 100644 index 00000000000..8b1833c5455 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BamBrokerCfgInfo.php @@ -0,0 +1,243 @@ + [ + [ + 'config_key' => 'name', + 'config_value' => 'poller-bam-monitoring', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'cache', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'check_replication', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'command_file', + 'config_value' => '/var/lib/centreon-engine/rw/centengine.cmd', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_host', + 'config_value' => 'localhost', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_name', + 'config_value' => 'centreon', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_password', + 'config_value' => $dbPassword, + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_user', + 'config_value' => 'centreon', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_port', + 'config_value' => '3306', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_type', + 'config_value' => 'mysql', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'queries_per_transaction', + 'config_value' => '0', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'read_timeout', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'retry_interval', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'storage_db_name', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'bam', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '1_34', + 'config_group' => 'output', + 'config_group_id' => '4', + 'grp_level' => '0', + ], + ], + 'reporting' => [ + [ + 'config_key' => 'name', + 'config_value' => 'poller-bam-reporting', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'filters', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'category', + 'config_value' => 'bam', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'check_replication', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_host', + 'config_value' => 'localhost', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_name', + 'config_value' => 'centreon_storage', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_password', + 'config_value' => $dbPassword, + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_user', + 'config_value' => 'centreon', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_port', + 'config_value' => '3306', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_type', + 'config_value' => 'mysql', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'queries_per_transaction', + 'config_value' => '0', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'read_timeout', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'retry_interval', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'bam_bi', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '1_35', + 'config_group' => 'output', + 'config_group_id' => '5', + 'grp_level' => '0', + ], + ] + ]; + } +} \ No newline at end of file diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/InputBroker.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/InputBroker.php new file mode 100644 index 00000000000..28cbebb1f7a --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/InputBroker.php @@ -0,0 +1,147 @@ + 'name', + 'config_value' => 'central-broker-master-input', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'port', + 'config_value' => '5669', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'host', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'failover', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'protocol', + 'config_value' => 'bbdo', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'tls', + 'config_value' => 'auto', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'private_key', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'public_cert', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'ca_certificate', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'negociation', + 'config_value' => 'yes', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'one_peer_retention_mode', + 'config_value' => 'no', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression', + 'config_value' => 'auto', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression_level', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression_buffer', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'ipv4', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '2_3', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/InputRrd.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/InputRrd.php new file mode 100644 index 00000000000..e274695fcee --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/InputRrd.php @@ -0,0 +1,147 @@ + 'name', + 'config_value' => 'central-rrd-master-input', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'port', + 'config_value' => '5670', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'host', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'failover', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'protocol', + 'config_value' => 'bbdo', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'tls', + 'config_value' => 'auto', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'private_key', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'public_cert', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'ca_certificate', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'negociation', + 'config_value' => 'yes', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'one_peer_retention_mode', + 'config_value' => 'no', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression', + 'config_value' => 'auto', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression_level', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression_buffer', + 'config_value' => '', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'ipv4', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '2_3', + 'config_group' => 'input', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerBroker.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerBroker.php new file mode 100644 index 00000000000..89a05e93582 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerBroker.php @@ -0,0 +1,84 @@ + 'name', + 'config_value' => '/var/log/centreon-broker/broker-server.log', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'config', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'debug', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'error', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'info', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'level', + 'config_value' => 'low', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'max_size', + 'config_value' => '', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'file', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '3_17', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerModule.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerModule.php new file mode 100644 index 00000000000..ef74802f483 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerModule.php @@ -0,0 +1,84 @@ + 'name', + 'config_value' => '/var/log/centreon-broker/module-server.log', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'config', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'debug', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'error', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'info', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'level', + 'config_value' => 'low', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'max_size', + 'config_value' => '', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'file', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '3_17', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerRrd.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerRrd.php new file mode 100644 index 00000000000..2e2a930c689 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerRrd.php @@ -0,0 +1,84 @@ + 'name', + 'config_value' => '/var/log/centreon-broker/rrd-server.log', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'config', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'debug', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'error', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'info', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'level', + 'config_value' => 'low', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'max_size', + 'config_value' => '', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'file', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '3_17', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerSql.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerSql.php new file mode 100644 index 00000000000..dd45924b308 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/LoggerSql.php @@ -0,0 +1,84 @@ + 'name', + 'config_value' => '/var/log/centreon-broker/broker-sql.log', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'config', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'debug', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'error', + 'config_value' => 'yes', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'info', + 'config_value' => 'no', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'level', + 'config_value' => 'low', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'max_size', + 'config_value' => '', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'file', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '3_17', + 'config_group' => 'logger', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputCentral.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputCentral.php new file mode 100644 index 00000000000..5bc9805d826 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputCentral.php @@ -0,0 +1,147 @@ + 'name', + 'config_value' => 'Central-Output', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'port', + 'config_value' => '5669', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'host', + 'config_value' => 'localhost', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'failover', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'retry_interval', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'buffering_timeout', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'protocol', + 'config_value' => 'bbdo', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'tls', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'private_key', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'public_cert', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'ca_certificate', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'negociation', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'one_peer_retention_mode', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression_level', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression_buffer', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'ipv4', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '1_3', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputForwardMaster.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputForwardMaster.php new file mode 100644 index 00000000000..48317431395 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputForwardMaster.php @@ -0,0 +1,147 @@ + 'name', + 'config_value' => 'forward-to-master', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'port', + 'config_value' => '5669', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'host', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'failover', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'retry_interval', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'buffering_timeout', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'protocol', + 'config_value' => 'bbdo', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'tls', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'private_key', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'public_cert', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'ca_certificate', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'negociation', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'one_peer_retention_mode', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression_level', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression_buffer', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'ipv4', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '1_3', + 'config_group' => 'output', + 'config_group_id' => '3', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputModuleMaster.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputModuleMaster.php new file mode 100644 index 00000000000..c08657f07e0 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputModuleMaster.php @@ -0,0 +1,147 @@ + 'name', + 'config_value' => 'central-module-master-output', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'port', + 'config_value' => '5669', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'host', + 'config_value' => 'localhost', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'failover', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'protocol', + 'config_value' => 'bbdo', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'tls', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'private_key', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'public_cert', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'ca_certificate', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'negociation', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'one_peer_retention_mode', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression_level', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression_buffer', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'ipv4', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '1_3', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputPerfdata.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputPerfdata.php new file mode 100644 index 00000000000..05d4d4984b3 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputPerfdata.php @@ -0,0 +1,163 @@ + 'name', + 'config_value' => 'central-broker-master-perfdata', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'interval', + 'config_value' => '60', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'failover', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'length', + 'config_value' => '15552000', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_type', + 'config_value' => 'mysql', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_host', + 'config_value' => 'localhost', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_port', + 'config_value' => '3306', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_user', + 'config_value' => $dbUser, + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_password', + 'config_value' => $dbPassword, + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_name', + 'config_value' => 'centreon_storage', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'queries_per_transaction', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'read_timeout', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'check_replication', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'rebuild_check_interval', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'store_in_data_bin', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'insert_in_index_data', + 'config_value' => '1', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'storage', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '1_14', + 'config_group' => 'output', + 'config_group_id' => '2', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputRrd.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputRrd.php new file mode 100644 index 00000000000..affca8dffe8 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputRrd.php @@ -0,0 +1,119 @@ + 'name', + 'config_value' => 'central-rrd-master-output', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'metrics_path', + 'config_value' => '/var/lib/centreon/metrics/', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'failover', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'status_path', + 'config_value' => '/var/lib/centreon/status/', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'path', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'port', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'write_metrics', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'write_status', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'store_in_data_bin', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'insert_in_index_data', + 'config_value' => '1', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'rrd', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '1_13', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputRrdMaster.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputRrdMaster.php new file mode 100644 index 00000000000..2e94d65f6b2 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputRrdMaster.php @@ -0,0 +1,147 @@ + 'name', + 'config_value' => 'centreon-broker-master-rrd', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'port', + 'config_value' => '5670', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'host', + 'config_value' => 'localhost', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'failover', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'protocol', + 'config_value' => 'bbdo', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'tls', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'private_key', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'public_cert', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'ca_certificate', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'negociation', + 'config_value' => 'yes', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'one_peer_retention_mode', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression_level', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'compression_buffer', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'ipv4', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '1_3', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputSqlMaster.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputSqlMaster.php new file mode 100644 index 00000000000..f2ad8e0d2f7 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputSqlMaster.php @@ -0,0 +1,142 @@ + 'name', + 'config_value' => 'central-broker-master-sql', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'retry_interval', + 'config_value' => '60', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'buffering_timeout', + 'config_value' => '0', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'failover', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_type', + 'config_value' => 'mysql', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_host', + 'config_value' => 'localhost', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_port', + 'config_value' => '3306', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_user', + 'config_value' => $dbUser, + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_password', + 'config_value' => $dbPassword, + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_name', + 'config_value' => 'centreon_storage', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'queries_per_transaction', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'read_timeout', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'check_replication', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'cleanup_check_interval', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'instance_timeout', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'type', + 'config_value' => 'sql', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '1_16', + 'config_group' => 'output', + 'config_group_id' => '0', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputStatus.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputStatus.php new file mode 100644 index 00000000000..9d18e77d1e9 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/BrokerInfo/OutputStatus.php @@ -0,0 +1,162 @@ + 'name', + 'config_value' => 'Status-Master', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'retry_interval', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'buffering_timeout', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'failover', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_type', + 'config_value' => 'mysql', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_host', + 'config_value' => 'localhost', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_port', + 'config_value' => '3306', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_user', + 'config_value' => 'centreon', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_password', + 'config_value' => 'FDuM1710', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'db_name', + 'config_value' => 'centreon_storage', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'queries_per_transaction', + 'config_value' => '400', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'read_timeout', + 'config_value' => '5', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'check_replication', + 'config_value' => 'no', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + + [ + 'config_key' => 'cleanup_check_interval', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'instance_timeout', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'filters', + 'config_value' => '', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'category', + 'config_value' => 'neb', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '1', + ], + [ + 'config_key' => 'category', + 'config_value' => 'correlation', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '1', + ], + [ + 'config_key' => 'type', + 'config_value' => 'sql', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + [ + 'config_key' => 'blockId', + 'config_value' => '1_16', + 'config_group' => 'output', + 'config_group_id' => '1', + 'grp_level' => '0', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/CfgCentreonBroker.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/CfgCentreonBroker.php new file mode 100644 index 00000000000..05b42e5cb4c --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/CfgCentreonBroker.php @@ -0,0 +1,67 @@ + [ + 'config_name' => "{$configName}-broker", + 'config_filename' => "{$configName}-broker.xml", + 'config_write_timestamp' => '0', + 'config_write_thread_id' => '0', + 'config_activate' => '1', + 'ns_nagios_server' => $serverID, + 'event_queue_max_size' => '100000', + 'command_file' => '', + 'cache_directory' => '/var/lib/centreon-broker', + 'stats_activate' => '1', + 'correlation_activate' => '0', + 'daemon' => '1', + ], + 'module' => [ + 'config_name' => "{$configName}-module", + 'config_filename' => "{$configName}-module.xml", + 'config_write_timestamp' => '0', + 'config_write_thread_id' => '0', + 'config_activate' => '1', + 'ns_nagios_server' => $serverID, + 'event_queue_max_size' => '100000', + 'command_file' => '', + 'cache_directory' => '/var/lib/centreon-engine', + 'stats_activate' => '1', + 'correlation_activate' => '0', + 'daemon' => '0', + ], + 'rrd' => [ + 'config_name' => "{$configName}-rrd", + 'config_filename' => "{$configName}-rrd.xml", + 'config_write_timestamp' => '0', + 'config_write_thread_id' => '0', + 'config_activate' => '1', + 'ns_nagios_server' => $serverID, + 'event_queue_max_size' => '100000', + 'command_file' => '', + 'cache_directory' => '/var/lib/centreon-broker', + 'stats_activate' => '1', + 'correlation_activate' => '0', + 'daemon' => '1', + ] + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/CfgCentreonBrokerInfo.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/CfgCentreonBrokerInfo.php new file mode 100644 index 00000000000..ceef8729732 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/CfgCentreonBrokerInfo.php @@ -0,0 +1,64 @@ + [ + 'logger' => LoggerBroker::getConfiguration(), + 'broker' => InputBroker::getConfiguration(), + 'output_rrd' => OutputRrdMaster::getConfiguration(), + 'output_forward' => OutputForwardMaster::getConfiguration(), + 'output_prefdata' => OutputPerfdata::getConfiguration($dbUser, $dbPassword), + 'output_sql' => OutputSqlMaster::getConfiguration($dbUser, $dbPassword), + ], + 'central-module' => [ + 'logger' => LoggerModule::getConfiguration(), + 'output' => OutputModuleMaster::getConfiguration(), + ], + 'central-rrd' => [ + 'logger' => LoggerRrd::getConfiguration(), + 'input' => InputRrd::getConfiguration(), + 'output' => OutputRrd::getConfiguration(), + ] + ]; + + // update logs paths + $data['central-broker']['logger'][0]['config_value'] = "/var/log/centreon-broker/broker-{$serverName}.log"; + $data['central-module']['logger'][0]['config_value'] = "/var/log/centreon-broker/module-{$serverName}.log"; + $data['central-rrd']['logger'][0]['config_value'] = "/var/log/centreon-broker/rrd-{$serverName}.log"; + + return $data; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/CfgNagios.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/CfgNagios.php new file mode 100644 index 00000000000..17cc20be934 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/CfgNagios.php @@ -0,0 +1,151 @@ + $name, + 'use_timezone' => null, + 'log_file' => '/var/log/centreon-engine/centengine.log', + 'cfg_dir' => '/etc/centreon-engine/', + 'temp_file' => '/var/log/centreon-engine/centengine.tmp', + 'status_file' => '/var/log/centreon-engine/status.dat', + 'check_result_path' => null, + 'use_check_result_path' => '0', + 'max_check_result_file_age' => null, + 'status_update_interval' => '30', + 'nagios_user' => 'centreon-engine', + 'nagios_group' => 'centreon-engine', + 'enable_notifications' => '1', + 'execute_service_checks' => '1', + 'accept_passive_service_checks' => '1', + 'execute_host_checks' => '1', + 'accept_passive_host_checks' => '1', + 'enable_event_handlers' => '1', + 'log_rotation_method' => 'd', + 'log_archive_path' => '/var/log/centreon-engine/archives/', + 'check_external_commands' => '1', + 'external_command_buffer_slots' => '4096', + 'command_check_interval' => '2s', + 'command_file' => '/var/lib/centreon-engine/rw/centengine.cmd', + 'downtime_file' => null, + 'comment_file' => null, + 'lock_file' => '/var/lock/subsys/centengine.lock', + 'retain_state_information' => '1', + 'state_retention_file' => '/var/log/centreon-engine/retention.dat', + 'retention_update_interval' => '60', + 'use_retained_program_state' => '1', + 'use_retained_scheduling_info' => '0', + 'retained_contact_host_attribute_mask' => null, + 'retained_contact_service_attribute_mask' => null, + 'retained_process_host_attribute_mask' => null, + 'retained_process_service_attribute_mask' => null, + 'retained_host_attribute_mask' => null, + 'retained_service_attribute_mask' => null, + 'use_syslog' => '1', + 'log_notifications' => '1', + 'log_service_retries' => '0', + 'log_host_retries' => '0', + 'log_event_handlers' => '1', + 'log_initial_states' => '1', + 'log_external_commands' => '1', + 'log_passive_checks' => '1', + 'global_host_event_handler' => null, + 'global_service_event_handler' => null, + 'sleep_time' => '0.5', + 'service_inter_check_delay_method' => 's', + 'Host_inter_check_delay_method' => 's', + 'service_interleave_factor' => '2', + 'max_concurrent_checks' => '0', + 'max_service_check_spread' => '5', + 'max_host_check_spread' => '5', + 'check_result_reaper_frequency' => '10', + 'max_check_result_reaper_time' => '30', + 'interval_length' => '60', + 'auto_reschedule_checks' => '0', + 'auto_rescheduling_interval' => '30', + 'auto_rescheduling_window' => '180', + 'use_aggressive_host_checking' => '0', + 'enable_flap_detection' => '0', + 'low_service_flap_threshold' => '20.0', + 'high_service_flap_threshold' => '30.0', + 'low_host_flap_threshold' => '20.0', + 'high_host_flap_threshold' => '30.0', + 'soft_state_dependencies' => '0', + 'service_check_timeout' => '60', + 'host_check_timeout' => '30', + 'event_handler_timeout' => '30', + 'notification_timeout' => '30', + 'ocsp_timeout' => '15', + 'ochp_timeout' => '15', + 'perfdata_timeout' => '5', + 'obsess_over_services' => '0', + 'ocsp_command' => null, + 'obsess_over_hosts' => '0', + 'ochp_command' => null, + 'process_performance_data' => '0', + 'host_perfdata_command' => null, + 'service_perfdata_command' => null, + 'host_perfdata_file' => null, + 'service_perfdata_file' => null, + 'host_perfdata_file_template' => null, + 'service_perfdata_file_template' => null, + 'host_perfdata_file_mode' => '0', + 'service_perfdata_file_mode' => '0', + 'host_perfdata_file_processing_interval' => '0', + 'service_perfdata_file_processing_interval' => '0', + 'host_perfdata_file_processing_command' => null, + 'service_perfdata_file_processing_command' => null, + 'check_for_orphaned_services' => '1', + 'check_for_orphaned_hosts' => '1', + 'check_service_freshness' => '1', + 'service_freshness_check_interval' => '60', + 'freshness_check_interval' => null, + 'check_host_freshness' => '0', + 'host_freshness_check_interval' => '60', + 'date_format' => 'us', + 'illegal_object_name_chars' => "~!$%^&*\"|'<>?,()=", + 'illegal_macro_output_chars' => "`~$^&\"|'<>", + 'use_regexp_matching' => '0', + 'use_true_regexp_matching' => '0', + 'admin_email' => 'admin', + 'admin_pager' => 'admin@localhost', + 'nagios_comment' => 'Centreon Engine configuration file', + 'nagios_activate' => '1', + 'event_broker_options' => '-1', + 'translate_passive_host_checks' => '0', + 'nagios_server_id' => $serverID, + 'enable_predictive_host_dependency_checks' => '1', + 'enable_predictive_service_dependency_checks' => '1', + 'cached_host_check_horizon' => '15', + 'cached_service_check_horizon' => '15', + 'passive_host_checks_are_soft' => '0', + 'use_large_installation_tweaks' => '0', + 'enable_environment_macros' => '0', + 'use_setpgid' => '1', + 'additional_freshness_latency' => '15', + 'debug_file' => '/var/log/centreon-engine/centengine.debug', + 'debug_level' => '0', + 'debug_level_opt' => '0', + 'debug_verbosity' => '1', + 'max_debug_file_size' => '1000000000', + 'daemon_dumps_core' => '0', + 'cfg_file' => 'centengine.cfg', + 'log_pid' => '1', + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/CfgNagiosBrokerModule.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/CfgNagiosBrokerModule.php new file mode 100644 index 00000000000..65d427ed95c --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/CfgNagiosBrokerModule.php @@ -0,0 +1,33 @@ + $configID, + 'broker_module' => "/usr/lib64/nagios/cbmod.so /etc/centreon-broker/{$pollerName}-module.xml", + ], + [ + 'cfg_nagios_id' => $configID, + 'broker_module' => '/usr/lib64/centreon-engine/externalcmd.so', + ], + ]; + } +} diff --git a/src/CentreonRemote/Domain/Resources/RemoteConfig/InputFlowOnePeerRetention.php b/src/CentreonRemote/Domain/Resources/RemoteConfig/InputFlowOnePeerRetention.php new file mode 100644 index 00000000000..427452ef6b1 --- /dev/null +++ b/src/CentreonRemote/Domain/Resources/RemoteConfig/InputFlowOnePeerRetention.php @@ -0,0 +1,43 @@ + $name, + 'localhost' => '0', + 'is_default' => '0', + 'ns_ip_address' => $ip, + 'ns_activate' => '1', + 'ns_status' => '0', + 'init_script' => 'centengine', + 'init_system' => 'systemv', + 'monitoring_engine' => 'CENGINE', + 'nagios_bin' => '/usr/sbin/centengine', + 'nagiostats_bin' => '/usr/sbin/centenginestats', + 'nagios_perfdata' => '/var/log/centreon-engine/service-perfdata', + 'centreonbroker_cfg_path' => '/etc/centreon-broker', + 'centreonbroker_module_path' => '/usr/share/centreon/lib/centreon-broker', + 'centreonconnector_path' => '/usr/lib64/centreon-connector', + 'ssh_port' => '22', + 'ssh_private_key' => null, + 'init_script_centreontrapd' => 'centreontrapd', + 'snmp_trapd_path_conf' => '/etc/snmp/centreon_traps/', + 'centreonbroker_logs_path' => '/var/log/centreon-broker/', + ]; + } +} + + diff --git a/src/CentreonRemote/Domain/Resources/default_config/cfg_centreonbroker.php b/src/CentreonRemote/Domain/Resources/default_config/cfg_centreonbroker.php deleted file mode 100644 index 051b613999d..00000000000 --- a/src/CentreonRemote/Domain/Resources/default_config/cfg_centreonbroker.php +++ /dev/null @@ -1,40 +0,0 @@ - 1, - 'config_name' => 'central-broker-master', - 'config_filename' => 'central-broker.xml', - 'config_write_timestamp' => '1', - 'config_write_thread_id' => '0', - 'config_activate' => '1', - 'event_queue_max_size' => 100000, - 'cache_directory' => '@centreonbroker_varlib@', - 'command_file' => '@centreonbroker_varlib@/command.sock', - 'daemon' => 1, - ], - [ - 'config_id' => 2, - 'config_name' => 'central-rrd-master', - 'config_filename' => 'central-rrd.xml', - 'config_write_timestamp' => '1', - 'config_write_thread_id' => '0', - 'config_activate' => '1', - 'ns_nagios_server' => 1, - 'event_queue_max_size' => 100000, - 'cache_directory' => '@centreonbroker_varlib@', - 'daemon' => 1, - ], - [ - 'config_id' => 3, - 'config_name' => 'central-module-master', - 'config_filename' => 'central-module.xml', - 'config_write_timestamp' => '0', - 'config_write_thread_id' => '0', - 'config_activate' => '1', - 'ns_nagios_server' => 1, - 'event_queue_max_size' => 100000, - 'cache_directory' => '@monitoring_var_lib@', - 'daemon' => 0, - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/default_config/cfg_centreonbroker_info.php b/src/CentreonRemote/Domain/Resources/default_config/cfg_centreonbroker_info.php deleted file mode 100644 index 5942f5ddf0a..00000000000 --- a/src/CentreonRemote/Domain/Resources/default_config/cfg_centreonbroker_info.php +++ /dev/null @@ -1,985 +0,0 @@ - 1, - 'config_key' => 'name', - 'config_value' => 'central-broker-master-input', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'port', - 'config_value' => '5669', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'host', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'protocol', - 'config_value' => 'bbdo', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'tls', - 'config_value' => 'auto', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'private_key', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'public_cert', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'ca_certificate', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'negotiation', - 'config_value' => 'yes', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'one_peer_retention_mode', - 'config_value' => 'no', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'compression', - 'config_value' => 'auto', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'compression_level', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'compression_buffer', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'type', - 'config_value' => 'ipv4', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'blockId', - 'config_value' => '2_3', - 'config_group' => 'input', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'name', - 'config_value' => '@centreonbroker_log@/central-broker-master.log', - 'config_group' => 'logger', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'config', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'debug', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'error', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'info', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'level', - 'config_value' => 'low', - 'config_group' => 'logger', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'max_size', - 'config_value' => '', - 'config_group' => 'logger', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'type', - 'config_value' => 'file', - 'config_group' => 'logger', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'blockId', - 'config_value' => '3_17', - 'config_group' => 'logger', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'name', - 'config_value' => 'central-broker-master-sql', - 'config_group' => 'output', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'db_type', - 'config_value' => 'mysql', - 'config_group' => 'output', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'output', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'output', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'db_host', - 'config_value' => '@address@', - 'config_group' => 'output', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'db_port', - 'config_value' => '@port@', - 'config_group' => 'output', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'db_user', - 'config_value' => '@db_user@', - 'config_group' => 'output', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'db_password', - 'config_value' => '@db_password@', - 'config_group' => 'output', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'db_name', - 'config_value' => '@db_storage@', - 'config_group' => 'output', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'queries_per_transaction', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'read_timeout', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'type', - 'config_value' => 'sql', - 'config_group' => 'output', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'blockId', - 'config_value' => '1_16', - 'config_group' => 'output', - 'config_group_id' => 1, - ], - [ - 'config_id' => 1, - 'config_key' => 'name', - 'config_value' => 'centreon-broker-master-rrd', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'port', - 'config_value' => '5670', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'host', - 'config_value' => 'localhost', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'protocol', - 'config_value' => 'bbdo', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'tls', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'private_key', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'public_cert', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'ca_certificate', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'negotiation', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'one_peer_retention_mode', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'compression', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'compression_level', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'compression_buffer', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'type', - 'config_value' => 'ipv4', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'blockId', - 'config_value' => '1_3', - 'config_group' => 'output', - 'config_group_id' => 2, - ], - [ - 'config_id' => 1, - 'config_key' => 'name', - 'config_value' => 'central-broker-master-perfdata', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'interval', - 'config_value' => '60', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'length', - 'config_value' => '15552000', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'db_type', - 'config_value' => 'mysql', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'db_host', - 'config_value' => '@address@', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'db_port', - 'config_value' => '@port@', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'db_user', - 'config_value' => '@db_user@', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'db_password', - 'config_value' => '@db_password@', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'db_name', - 'config_value' => '@db_storage@', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'queries_per_transaction', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'read_timeout', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'check_replication', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'rebuild_check_interval', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'store_in_data_bin', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'insert_in_index_data', - 'config_value' => '1', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'type', - 'config_value' => 'storage', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - [ - 'config_id' => 1, - 'config_key' => 'blockId', - 'config_value' => '1_14', - 'config_group' => 'output', - 'config_group_id' => 3, - ], - - ///////////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////////// - - [ - 'config_id' => 2, - 'config_key' => 'name', - 'config_value' => 'central-rrd-master-input', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - - 'config_id' => 2, - 'config_key' => 'port', - 'config_value' => '5670', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'host', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'protocol', - 'config_value' => 'bbdo', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'tls', - 'config_value' => 'auto', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'private_key', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'public_cert', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'ca_certificate', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'negotiation', - 'config_value' => 'yes', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'one_peer_retention_mode', - 'config_value' => 'no', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'compression', - 'config_value' => 'auto', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'compression_level', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'compression_buffer', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'type', - 'config_value' => 'ipv4', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'blockId', - 'config_value' => '2_3', - 'config_group' => 'input', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'name', - 'config_value' => '@centreonbroker_log@/central-rrd-master.log', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'config', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'debug', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'error', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'info', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'level', - 'config_value' => 'low', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'max_size', - 'config_value' => '', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'type', - 'config_value' => 'file', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'blockId', - 'config_value' => '3_17', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'name', - 'config_value' => 'central-rrd-master-output', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'metrics_path', - 'config_value' => '@centreon_varlib@/metrics', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'status_path', - 'config_value' => '@centreon_varlib@/status', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'path', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'port', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'write_metrics', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'write_status', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'type', - 'config_value' => 'rrd', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 2, - 'config_key' => 'blockId', - 'config_value' => '1_13', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - - ///////////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////////// - - [ - 'config_id' => 3, - 'config_key' => 'name', - 'config_value' => '@centreonbroker_log@/central-module-master.log', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'config', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'debug', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'error', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'info', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'level', - 'config_value' => 'low', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'max_size', - 'config_value' => '', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'type', - 'config_value' => 'file', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'blockId', - 'config_value' => '3_17', - 'config_group' => 'logger', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'name', - 'config_value' => 'central-module-master-output', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'port', - 'config_value' => '5669', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'host', - 'config_value' => 'localhost', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'protocol', - 'config_value' => 'bbdo', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'tls', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'private_key', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'public_cert', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'ca_certificate', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'negotiation', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'one_peer_retention_mode', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'compression', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'compression_level', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'compression_buffer', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'type', - 'config_value' => 'ipv4', - 'config_group' => 'output', - 'config_group_id' => 1 - ], - [ - 'config_id' => 3, - 'config_key' => 'blockId', - 'config_value' => '1_3', - 'config_group' => 'output', - 'config_group_id' => 1 - ] -]; diff --git a/src/CentreonRemote/Domain/Resources/default_config/cfg_nagios.php b/src/CentreonRemote/Domain/Resources/default_config/cfg_nagios.php deleted file mode 100644 index a08c1e2f49b..00000000000 --- a/src/CentreonRemote/Domain/Resources/default_config/cfg_nagios.php +++ /dev/null @@ -1,128 +0,0 @@ - 1, - 'nagios_name' => 'Centreon Engine Central', - 'log_file' => '@monitoring_varlog@/centengine.log', - 'cfg_dir' => '@monitoring_etc@', - 'temp_file' => '@monitoring_varlog@/centengine.tmp', - 'status_file' => '@monitoring_varlog@/status.dat', - 'check_result_path' => null, - 'use_check_result_path' => '0', - 'max_check_result_file_age' => null, - 'status_update_interval' => null, - 'nagios_user' => '@monitoring_user@', - 'nagios_group' => '@monitoring_group@', - 'enable_notifications' => '1', - 'execute_service_checks' => '1', - 'accept_passive_service_checks' => '1', - 'execute_host_checks' => '2', - 'accept_passive_host_checks' => '2', - 'enable_event_handlers' => '1', - 'log_rotation_method' => 'd', - 'log_archive_path' => '@monitoring_varlog@/archives/', - 'check_external_commands' => '1', - 'external_command_buffer_slots' => null, - 'command_check_interval' => '1s', - 'command_file' => '@monitoring_var_lib@/rw/centengine.cmd', - 'downtime_file' => null, - 'comment_file' => null, - 'lock_file' => '/var/lock/subsys/centengine.lock', - 'retain_state_information' => '1', - 'state_retention_file' => '@monitoring_varlog@/retention.dat', - 'retention_update_interval' => 60, - 'use_retained_program_state' => '1', - 'use_retained_scheduling_info' => '1', - 'retained_contact_host_attribute_mask' => null, - 'retained_contact_service_attribute_mask' => null, - 'retained_process_host_attribute_mask' => null, - 'retained_process_service_attribute_mask' => null, - 'retained_host_attribute_mask' => null, - 'retained_service_attribute_mask' => null, - 'use_syslog' => '0', - 'log_notifications' => '1', - 'log_service_retries' => '1', - 'log_host_retries' => '1', - 'log_event_handlers' => '1', - 'log_external_commands' => '1', - 'log_passive_checks' => '2', - 'global_host_event_handler' => null, - 'global_service_event_handler' => null, - 'sleep_time' => '0.2', - 'service_inter_check_delay_method' => 's', - 'host_inter_check_delay_method' => null, - 'service_interleave_factor' => 's', - 'max_concurrent_checks' => 400, - 'max_service_check_spread' => 5, - 'max_host_check_spread' => null, - 'check_result_reaper_frequency' => 5, - 'max_check_result_reaper_time' => null, - 'interval_length' => 60, - 'auto_reschedule_checks' => '2', - 'auto_rescheduling_interval' => null, - 'auto_rescheduling_window' => null, - 'use_aggressive_host_checking' => '1', - 'enable_flap_detection' => '0', - 'low_service_flap_threshold' => '25.0', - 'high_service_flap_threshold' => '50.0', - 'low_host_flap_threshold' => '25.0', - 'high_host_flap_threshold' => '50.0', - 'soft_state_dependencies' => '0', - 'service_check_timeout' => 60, - 'host_check_timeout' => 12, - 'event_handler_timeout' => 30, - 'notification_timeout' => 30, - 'ocsp_timeout' => 5, - 'ochp_timeout' => 5, - 'perfdata_timeout' => 5, - 'obsess_over_services' => '0', - 'ocsp_command' => null, - 'obsess_over_hosts' => '2', - 'ochp_command' => null, - 'process_performance_data' => '0', - 'host_perfdata_command' => null, - 'service_perfdata_command' => null, - 'host_perfdata_file' => null, - 'service_perfdata_file' => null, - 'host_perfdata_file_template' => null, - 'service_perfdata_file_template' => null, - 'host_perfdata_file_mode' => '2', - 'service_perfdata_file_mode' => '2', - 'host_perfdata_file_processing_interval' => null, - 'service_perfdata_file_processing_interval' => null, - 'host_perfdata_file_processing_command' => null, - 'service_perfdata_file_processing_command' => null, - 'check_for_orphaned_services' => '0', - 'check_for_orphaned_hosts' => '0', - 'check_service_freshness' => '1', - 'service_freshness_check_interval' => null, - 'freshness_check_interval' => null, - 'check_host_freshness' => '2', - 'host_freshness_check_interval' => null, - 'date_format' => 'euro', - 'illegal_object_name_chars' => '~!$%^&*"|'<>?,()=', - 'illegal_macro_output_chars' => '`~$^&"|'<>', - 'use_regexp_matching' => '2', - 'use_true_regexp_matching' => '2', - 'admin_email' => 'admin@localhost', - 'admin_pager' => 'admin', - 'nagios_comment' => 'Centreon Engine', - 'nagios_activate' => '1', - 'event_broker_options' => '-1', - 'translate_passive_host_checks' => null, - 'nagios_server_id' => 1, - 'enable_predictive_host_dependency_checks' => '2', - 'enable_predictive_service_dependency_checks' => '2', - 'cached_host_check_horizon' => 60, - 'cached_service_check_horizon' => null, - 'passive_host_checks_are_soft' => null, - 'use_large_installation_tweaks' => '2', - 'enable_environment_macros' => '2', - 'additional_freshness_latency' => null, - 'debug_file' => '@monitoring_varlog@/centengine.debug', - 'debug_level' => 0, - 'debug_level_opt' => '0', - 'debug_verbosity' => '2', - 'max_debug_file_size' => null, - 'cfg_file' => 'centengine.cfg' -]; diff --git a/src/CentreonRemote/Domain/Resources/default_config/cfg_nagios_broker_module.php b/src/CentreonRemote/Domain/Resources/default_config/cfg_nagios_broker_module.php deleted file mode 100644 index b9e9a3c0ade..00000000000 --- a/src/CentreonRemote/Domain/Resources/default_config/cfg_nagios_broker_module.php +++ /dev/null @@ -1,12 +0,0 @@ - 1, - 'broker_module' => '@centreon_engine_lib@/externalcmd.so', - ], - [ - 'cfg_nagios_id' => 1, - 'broker_module' => '@centreonbroker_cbmod@ @centreonbroker_etc@/central-module.xml', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/default_config/cfg_resource.php b/src/CentreonRemote/Domain/Resources/default_config/cfg_resource.php deleted file mode 100644 index f9c9b9e723d..00000000000 --- a/src/CentreonRemote/Domain/Resources/default_config/cfg_resource.php +++ /dev/null @@ -1,16 +0,0 @@ - '$USER1$', - 'resource_line' => '@plugin_dir@', - 'resource_comment' => 'Nagios Plugins Path', - 'resource_activate' => '1', - ], - [ - 'resource_name' => '$CENTREONPLUGINS$', - 'resource_line' => '@centreonplugins@', - 'resource_comment' => 'Centreon Plugins Path', - 'resource_activate' => '1', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/default_config/nagios_server.php b/src/CentreonRemote/Domain/Resources/default_config/nagios_server.php deleted file mode 100644 index 1f30cc57b1d..00000000000 --- a/src/CentreonRemote/Domain/Resources/default_config/nagios_server.php +++ /dev/null @@ -1,23 +0,0 @@ - 'Central', - 'localhost' => '1', - 'is_default' => 1, - 'last_restart' => 0, - 'ns_ip_address' => '127.0.0.1', - 'ns_activate' => '1', - 'ns_status' => '0', - 'init_script' => '@monitoring_init_script@', - 'monitoring_engine' => 'CENGINE', - 'nagios_bin' => '@monitoring_binary@', - 'nagiostats_bin' => '@centreon_engine_stats_binary@', - 'nagios_perfdata' => '@monitoring_varlog@/service-perfdata', - 'centreonbroker_cfg_path' => '@broker_etc@', - 'centreonbroker_module_path' => '@centreonbroker_lib@', - 'centreonconnector_path' => '@centreon_engine_connectors@', - 'ssh_port' => 22, - 'ssh_private_key' => null, - 'init_script_centreontrapd' => 'centreontrapd', - 'snmp_trapd_path_conf' => '/etc/snmp/centreon_traps/', -]; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/bam_broker_cfg_info.php b/src/CentreonRemote/Domain/Resources/remote_config/bam_broker_cfg_info.php deleted file mode 100644 index ca605ce91a0..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/bam_broker_cfg_info.php +++ /dev/null @@ -1,227 +0,0 @@ - [ - [ - 'config_key' => 'name', - 'config_value' => 'poller-bam-monitoring', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'cache', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'check_replication', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'command_file', - 'config_value' => '/var/lib/centreon-engine/rw/centengine.cmd', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_host', - 'config_value' => 'localhost', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_name', - 'config_value' => 'centreon', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_password', - 'config_value' => $dbPassword, - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_user', - 'config_value' => 'centreon', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_port', - 'config_value' => '3306', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_type', - 'config_value' => 'mysql', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'queries_per_transaction', - 'config_value' => '0', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'read_timeout', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'retry_interval', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'storage_db_name', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'bam', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '1_34', - 'config_group' => 'output', - 'config_group_id' => '4', - 'grp_level' => '0', - ], - ], - 'reporting' => [ - [ - 'config_key' => 'name', - 'config_value' => 'poller-bam-reporting', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'filters', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'category', - 'config_value' => 'bam', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'check_replication', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_host', - 'config_value' => 'localhost', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_name', - 'config_value' => 'centreon_storage', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_password', - 'config_value' => $dbPassword, - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_user', - 'config_value' => 'centreon', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_port', - 'config_value' => '3306', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_type', - 'config_value' => 'mysql', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'queries_per_transaction', - 'config_value' => '0', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'read_timeout', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'retry_interval', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'bam_bi', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '1_35', - 'config_group' => 'output', - 'config_group_id' => '5', - 'grp_level' => '0', - ], - ] - ]; -}; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/input_broker.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/input_broker.php deleted file mode 100644 index 2fb34a3fbfb..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/input_broker.php +++ /dev/null @@ -1,130 +0,0 @@ - 'name', - 'config_value' => 'central-broker-master-input', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'port', - 'config_value' => '5669', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'host', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'failover', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'protocol', - 'config_value' => 'bbdo', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'tls', - 'config_value' => 'auto', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'private_key', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'public_cert', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'ca_certificate', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'negociation', - 'config_value' => 'yes', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'one_peer_retention_mode', - 'config_value' => 'no', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression', - 'config_value' => 'auto', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_level', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_buffer', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'ipv4', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '2_3', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/input_rrd.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/input_rrd.php deleted file mode 100644 index a52875054d9..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/input_rrd.php +++ /dev/null @@ -1,130 +0,0 @@ - 'name', - 'config_value' => 'central-rrd-master-input', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'port', - 'config_value' => '5670', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'host', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'failover', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'protocol', - 'config_value' => 'bbdo', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'tls', - 'config_value' => 'auto', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'private_key', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'public_cert', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'ca_certificate', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'negociation', - 'config_value' => 'yes', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'one_peer_retention_mode', - 'config_value' => 'no', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression', - 'config_value' => 'auto', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_level', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_buffer', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'ipv4', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '2_3', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_broker.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_broker.php deleted file mode 100644 index bf245d4eff0..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_broker.php +++ /dev/null @@ -1,67 +0,0 @@ - 'name', - 'config_value' => '/var/log/centreon-broker/broker-server.log', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'config', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'debug', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'error', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'info', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'level', - 'config_value' => 'low', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'max_size', - 'config_value' => '', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'file', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '3_17', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_module.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_module.php deleted file mode 100644 index 8351084d483..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_module.php +++ /dev/null @@ -1,67 +0,0 @@ - 'name', - 'config_value' => '/var/log/centreon-broker/module-server.log', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'config', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'debug', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'error', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'info', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'level', - 'config_value' => 'low', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'max_size', - 'config_value' => '', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'file', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '3_17', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_rrd.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_rrd.php deleted file mode 100644 index 5ea03c334ec..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_rrd.php +++ /dev/null @@ -1,67 +0,0 @@ - 'name', - 'config_value' => '/var/log/centreon-broker/rrd-server.log', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'config', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'debug', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'error', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'info', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'level', - 'config_value' => 'low', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'max_size', - 'config_value' => '', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'file', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '3_17', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_sql.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_sql.php deleted file mode 100644 index 6299ffe948a..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/logger_sql.php +++ /dev/null @@ -1,67 +0,0 @@ - 'name', - 'config_value' => '/var/log/centreon-broker/broker-sql.log', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'config', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'debug', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'error', - 'config_value' => 'yes', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'info', - 'config_value' => 'no', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'level', - 'config_value' => 'low', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'max_size', - 'config_value' => '', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'file', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '3_17', - 'config_group' => 'logger', - 'config_group_id' => '0', - 'grp_level' => '0', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_central.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_central.php deleted file mode 100644 index 155eb008c82..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_central.php +++ /dev/null @@ -1,130 +0,0 @@ - 'name', - 'config_value' => 'Central-Output', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'port', - 'config_value' => '5669', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'host', - 'config_value' => 'localhost', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'failover', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'retry_interval', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'buffering_timeout', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'protocol', - 'config_value' => 'bbdo', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'tls', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'private_key', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'public_cert', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'ca_certificate', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'negociation', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'one_peer_retention_mode', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_level', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_buffer', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'ipv4', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '1_3', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_forward_master.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_forward_master.php deleted file mode 100644 index a1763b34c62..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_forward_master.php +++ /dev/null @@ -1,130 +0,0 @@ - 'name', - 'config_value' => 'forward-to-master', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'port', - 'config_value' => '5669', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'host', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'failover', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'retry_interval', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'buffering_timeout', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'protocol', - 'config_value' => 'bbdo', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'tls', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'private_key', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'public_cert', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'ca_certificate', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'negociation', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'one_peer_retention_mode', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_level', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_buffer', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'ipv4', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '1_3', - 'config_group' => 'output', - 'config_group_id' => '3', - 'grp_level' => '0', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_module_master.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_module_master.php deleted file mode 100644 index 228168d9520..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_module_master.php +++ /dev/null @@ -1,130 +0,0 @@ - 'name', - 'config_value' => 'central-module-master-output', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'port', - 'config_value' => '5669', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'host', - 'config_value' => 'localhost', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'failover', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'protocol', - 'config_value' => 'bbdo', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'tls', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'private_key', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'public_cert', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'ca_certificate', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'negociation', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'one_peer_retention_mode', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_level', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_buffer', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'ipv4', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '1_3', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_perfdata.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_perfdata.php deleted file mode 100644 index eef4949b135..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_perfdata.php +++ /dev/null @@ -1,146 +0,0 @@ - 'name', - 'config_value' => 'central-broker-master-perfdata', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'interval', - 'config_value' => '60', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'failover', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'length', - 'config_value' => '15552000', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_type', - 'config_value' => 'mysql', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_host', - 'config_value' => 'localhost', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_port', - 'config_value' => '3306', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_user', - 'config_value' => $dbUser, - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_password', - 'config_value' => $dbPassword, - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_name', - 'config_value' => 'centreon_storage', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'queries_per_transaction', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'read_timeout', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'check_replication', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'rebuild_check_interval', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'store_in_data_bin', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'insert_in_index_data', - 'config_value' => '1', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'storage', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '1_14', - 'config_group' => 'output', - 'config_group_id' => '2', - 'grp_level' => '0', - ], - ]; -}; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_rrd.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_rrd.php deleted file mode 100644 index 47b6720c3a8..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_rrd.php +++ /dev/null @@ -1,102 +0,0 @@ - 'name', - 'config_value' => 'central-rrd-master-output', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'metrics_path', - 'config_value' => '/var/lib/centreon/metrics/', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'failover', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'status_path', - 'config_value' => '/var/lib/centreon/status/', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'path', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'port', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'write_metrics', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'write_status', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'store_in_data_bin', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'insert_in_index_data', - 'config_value' => '1', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'rrd', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '1_13', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_rrd_master.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_rrd_master.php deleted file mode 100644 index 17be90dc6a8..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_rrd_master.php +++ /dev/null @@ -1,130 +0,0 @@ - 'name', - 'config_value' => 'centreon-broker-master-rrd', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'port', - 'config_value' => '5670', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'host', - 'config_value' => 'localhost', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'failover', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'protocol', - 'config_value' => 'bbdo', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'tls', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'private_key', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'public_cert', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'ca_certificate', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'negociation', - 'config_value' => 'yes', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'one_peer_retention_mode', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_level', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_buffer', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'ipv4', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '1_3', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_sql_master.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_sql_master.php deleted file mode 100644 index f6c0e0d7d27..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_sql_master.php +++ /dev/null @@ -1,125 +0,0 @@ - 'name', - 'config_value' => 'central-broker-master-sql', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'failover', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_type', - 'config_value' => 'mysql', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_host', - 'config_value' => 'localhost', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_port', - 'config_value' => '3306', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_user', - 'config_value' => $dbUser, - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_password', - 'config_value' => $dbPassword, - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_name', - 'config_value' => 'centreon_storage', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'queries_per_transaction', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'read_timeout', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'check_replication', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'cleanup_check_interval', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'instance_timeout', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'sql', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '1_16', - 'config_group' => 'output', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - ]; -}; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_status.php b/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_status.php deleted file mode 100644 index d7b0a701c89..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/broker_info/output_status.php +++ /dev/null @@ -1,145 +0,0 @@ - 'name', - 'config_value' => 'Status-Master', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'retry_interval', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'buffering_timeout', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'failover', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_type', - 'config_value' => 'mysql', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_host', - 'config_value' => 'localhost', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_port', - 'config_value' => '3306', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_user', - 'config_value' => 'centreon', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_password', - 'config_value' => 'FDuM1710', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'db_name', - 'config_value' => 'centreon_storage', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'queries_per_transaction', - 'config_value' => '400', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'read_timeout', - 'config_value' => '5', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'check_replication', - 'config_value' => 'no', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - - [ - 'config_key' => 'cleanup_check_interval', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'instance_timeout', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'filters', - 'config_value' => '', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'category', - 'config_value' => 'neb', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '1', - ], - [ - 'config_key' => 'category', - 'config_value' => 'correlation', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '1', - ], - [ - 'config_key' => 'type', - 'config_value' => 'sql', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '1_16', - 'config_group' => 'output', - 'config_group_id' => '1', - 'grp_level' => '0', - ], -]; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/cfg_centreonbroker.php b/src/CentreonRemote/Domain/Resources/remote_config/cfg_centreonbroker.php deleted file mode 100644 index 80c5a6e5887..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/cfg_centreonbroker.php +++ /dev/null @@ -1,50 +0,0 @@ - [ - 'config_name' => "{$configName}-broker", - 'config_filename' => "{$configName}-broker.xml", - 'config_write_timestamp' => '0', - 'config_write_thread_id' => '0', - 'config_activate' => '1', - 'ns_nagios_server' => $serverID, - 'event_queue_max_size' => '100000', - 'command_file' => '', - 'cache_directory' => '/var/lib/centreon-broker', - 'stats_activate' => '0', - 'correlation_activate' => '0', - 'daemon' => '1', - ], - 'module' => [ - 'config_name' => "{$configName}-module", - 'config_filename' => "{$configName}-module.xml", - 'config_write_timestamp' => '0', - 'config_write_thread_id' => '0', - 'config_activate' => '1', - 'ns_nagios_server' => $serverID, - 'event_queue_max_size' => '100000', - 'command_file' => '', - 'cache_directory' => '/var/lib/centreon-engine', - 'stats_activate' => '0', - 'correlation_activate' => '0', - 'daemon' => '0', - ], - 'rrd' => [ - 'config_name' => "{$configName}-rrd", - 'config_filename' => "{$configName}-rrd.xml", - 'config_write_timestamp' => '0', - 'config_write_thread_id' => '0', - 'config_activate' => '1', - 'ns_nagios_server' => $serverID, - 'event_queue_max_size' => '100000', - 'command_file' => '', - 'cache_directory' => '/var/lib/centreon-broker', - 'stats_activate' => '0', - 'correlation_activate' => '0', - 'daemon' => '1', - ] - ]; -}; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/cfg_centreonbroker_info.php b/src/CentreonRemote/Domain/Resources/remote_config/cfg_centreonbroker_info.php deleted file mode 100644 index 052ef32e320..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/cfg_centreonbroker_info.php +++ /dev/null @@ -1,48 +0,0 @@ - [ - 'logger' => $loggerBrokerData, - 'broker' => $inputBrokerData, - 'output_rrd' => $outputRRDMasterData, - 'output_forward' => $outputForwardMasterData, - ], - 'central-module' => [ - 'logger' => $loggerModuleData, - 'output' => $outputModuleMasterData, - ], - 'central-rrd' => [ - 'logger' => $loggerRRDData, - 'input' => $inputRRDData, - 'output' => $outputRRDData, - ] -]; - -return function ($serverName, $dbUser, $dbPassword) use ($data, $outputPerfdataData, $outputSQLMasterData) { - $serverName = strtolower(str_replace(' ', '-', $serverName)); - - $data['central-broker']['output_prefdata'] = $outputPerfdataData($dbUser, $dbPassword); - $data['central-broker']['output_sql'] = $outputSQLMasterData($dbUser, $dbPassword); - $data['central-broker']['logger'][0]['config_value'] = "/var/log/centreon-broker/broker-{$serverName}.log"; - - $data['central-module']['logger'][0]['config_value'] = "/var/log/centreon-broker/module-{$serverName}.log"; - - $data['central-rrd']['logger'][0]['config_value'] = "/var/log/centreon-broker/rrd-{$serverName}.log"; - - return $data; -}; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/cfg_nagios.php b/src/CentreonRemote/Domain/Resources/remote_config/cfg_nagios.php deleted file mode 100644 index da1000101c2..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/cfg_nagios.php +++ /dev/null @@ -1,134 +0,0 @@ - $name, - 'use_timezone' => null, - 'log_file' => '/var/log/centreon-engine/centengine.log', - 'cfg_dir' => '/etc/centreon-engine/', - 'temp_file' => '/var/log/centreon-engine/centengine.tmp', - 'status_file' => '/var/log/centreon-engine/status.dat', - 'check_result_path' => null, - 'use_check_result_path' => '0', - 'max_check_result_file_age' => null, - 'status_update_interval' => '30', - 'nagios_user' => 'centreon-engine', - 'nagios_group' => 'centreon-engine', - 'enable_notifications' => '1', - 'execute_service_checks' => '1', - 'accept_passive_service_checks' => '1', - 'execute_host_checks' => '1', - 'accept_passive_host_checks' => '1', - 'enable_event_handlers' => '1', - 'log_rotation_method' => 'd', - 'log_archive_path' => '/var/log/centreon-engine/archives/', - 'check_external_commands' => '1', - 'external_command_buffer_slots' => '4096', - 'command_check_interval' => '2s', - 'command_file' => '/var/lib/centreon-engine/rw/centengine.cmd', - 'downtime_file' => null, - 'comment_file' => null, - 'lock_file' => '/var/lock/subsys/centengine.lock', - 'retain_state_information' => '1', - 'state_retention_file' => '/var/log/centreon-engine/retention.dat', - 'retention_update_interval' => '60', - 'use_retained_program_state' => '1', - 'use_retained_scheduling_info' => '0', - 'retained_contact_host_attribute_mask' => null, - 'retained_contact_service_attribute_mask' => null, - 'retained_process_host_attribute_mask' => null, - 'retained_process_service_attribute_mask' => null, - 'retained_host_attribute_mask' => null, - 'retained_service_attribute_mask' => null, - 'use_syslog' => '1', - 'log_notifications' => '1', - 'log_service_retries' => '0', - 'log_host_retries' => '0', - 'log_event_handlers' => '1', - 'log_initial_states' => '1', - 'log_external_commands' => '1', - 'log_passive_checks' => '1', - 'global_host_event_handler' => null, - 'global_service_event_handler' => null, - 'sleep_time' => '0.5', - 'service_inter_check_delay_method' => 's', - 'Host_inter_check_delay_method' => 's', - 'service_interleave_factor' => '2', - 'max_concurrent_checks' => '0', - 'max_service_check_spread' => '5', - 'max_host_check_spread' => '5', - 'check_result_reaper_frequency' => '10', - 'max_check_result_reaper_time' => '30', - 'interval_length' => '60', - 'auto_reschedule_checks' => '0', - 'auto_rescheduling_interval' => '30', - 'auto_rescheduling_window' => '180', - 'use_aggressive_host_checking' => '0', - 'enable_flap_detection' => '0', - 'low_service_flap_threshold' => '20.0', - 'high_service_flap_threshold' => '30.0', - 'low_host_flap_threshold' => '20.0', - 'high_host_flap_threshold' => '30.0', - 'soft_state_dependencies' => '0', - 'service_check_timeout' => '60', - 'host_check_timeout' => '30', - 'event_handler_timeout' => '30', - 'notification_timeout' => '30', - 'ocsp_timeout' => '15', - 'ochp_timeout' => '15', - 'perfdata_timeout' => '5', - 'obsess_over_services' => '0', - 'ocsp_command' => null, - 'obsess_over_hosts' => '0', - 'ochp_command' => null, - 'process_performance_data' => '0', - 'host_perfdata_command' => null, - 'service_perfdata_command' => null, - 'host_perfdata_file' => null, - 'service_perfdata_file' => null, - 'host_perfdata_file_template' => null, - 'service_perfdata_file_template' => null, - 'host_perfdata_file_mode' => '0', - 'service_perfdata_file_mode' => '0', - 'host_perfdata_file_processing_interval' => '0', - 'service_perfdata_file_processing_interval' => '0', - 'host_perfdata_file_processing_command' => null, - 'service_perfdata_file_processing_command' => null, - 'check_for_orphaned_services' => '1', - 'check_for_orphaned_hosts' => '1', - 'check_service_freshness' => '1', - 'service_freshness_check_interval' => '60', - 'freshness_check_interval' => null, - 'check_host_freshness' => '0', - 'host_freshness_check_interval' => '60', - 'date_format' => 'us', - 'illegal_object_name_chars' => "~!$%^&*\"|'<>?,()=", - 'illegal_macro_output_chars' => "`~$^&\"|'<>", - 'use_regexp_matching' => '0', - 'use_true_regexp_matching' => '0', - 'admin_email' => 'admin', - 'admin_pager' => 'admin@localhost', - 'nagios_comment' => 'Centreon Engine configuration file', - 'nagios_activate' => '1', - 'event_broker_options' => '-1', - 'translate_passive_host_checks' => '0', - 'nagios_server_id' => $serverID, - 'enable_predictive_host_dependency_checks' => '1', - 'enable_predictive_service_dependency_checks' => '1', - 'cached_host_check_horizon' => '15', - 'cached_service_check_horizon' => '15', - 'passive_host_checks_are_soft' => '0', - 'use_large_installation_tweaks' => '0', - 'enable_environment_macros' => '0', - 'use_setpgid' => '1', - 'additional_freshness_latency' => '15', - 'debug_file' => '/var/log/centreon-engine/centengine.debug', - 'debug_level' => '0', - 'debug_level_opt' => '0', - 'debug_verbosity' => '1', - 'max_debug_file_size' => '1000000000', - 'daemon_dumps_core' => '0', - 'cfg_file' => 'centengine.cfg', - 'log_pid' => '1', - ]; -}; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/cfg_nagios_broker_module.php b/src/CentreonRemote/Domain/Resources/remote_config/cfg_nagios_broker_module.php deleted file mode 100644 index fd2ec94c1de..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/cfg_nagios_broker_module.php +++ /dev/null @@ -1,16 +0,0 @@ - $configID, - 'broker_module' => "/usr/lib64/nagios/cbmod.so /etc/centreon-broker/{$pollerName}-module.xml", - ], - [ - 'cfg_nagios_id' => $configID, - 'broker_module' => '/usr/lib64/centreon-engine/externalcmd.so', - ], - ]; -}; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/input_poller_open_flow.php b/src/CentreonRemote/Domain/Resources/remote_config/input_poller_open_flow.php deleted file mode 100644 index 37b7f0671f2..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/input_poller_open_flow.php +++ /dev/null @@ -1,132 +0,0 @@ - 'name', - 'config_value' => 'conection-to-poller', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'port', - 'config_value' => '5669', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'retry_interval', - 'config_value' => '60', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'buffering_timeout', - 'config_value' => '0', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'host', - 'config_value' => $serverIP, - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'protocol', - 'config_value' => 'bbdo', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'tls', - 'config_value' => 'no', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'failover', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'private_key', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'public_cert', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'ca_certificate', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'negociation', - 'config_value' => 'yes', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'one_peer_retention_mode', - 'config_value' => 'no', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression', - 'config_value' => 'no', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_level', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'compression_buffer', - 'config_value' => '', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'type', - 'config_value' => 'ipv4', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - [ - 'config_key' => 'blockId', - 'config_value' => '2_3', - 'config_group' => 'input', - 'config_group_id' => '0', - 'grp_level' => '0', - ], - ]; -}; diff --git a/src/CentreonRemote/Domain/Resources/remote_config/nagios_server.php b/src/CentreonRemote/Domain/Resources/remote_config/nagios_server.php deleted file mode 100644 index d654b5c8e64..00000000000 --- a/src/CentreonRemote/Domain/Resources/remote_config/nagios_server.php +++ /dev/null @@ -1,26 +0,0 @@ - $name, - 'localhost' => '0', - 'is_default' => '0', - 'ns_ip_address' => $ip, - 'ns_activate' => '1', - 'ns_status' => '0', - 'init_script' => 'centengine', - 'init_system' => null, - 'monitoring_engine' => null, - 'nagios_bin' => '/usr/sbin/centengine', - 'nagiostats_bin' => '/usr/sbin/centenginestats', - 'nagios_perfdata' => '/var/log/centreon-engine/service-perfdata', - 'centreonbroker_cfg_path' => '/etc/centreon-broker', - 'centreonbroker_module_path' => '/usr/share/centreon/lib/centreon-broker', - 'centreonconnector_path' => null, - 'ssh_port' => '22', - 'ssh_private_key' => null, - 'init_script_centreontrapd' => 'centreontrapd', - 'snmp_trapd_path_conf' => '/etc/snmp/centreon_traps/', - 'centreonbroker_logs_path' => '/var/log/centreon-broker/', - ]; -}; diff --git a/src/CentreonRemote/Domain/Service/ConfigurationWizard/LinkedPollerConfigurationService.php b/src/CentreonRemote/Domain/Service/ConfigurationWizard/LinkedPollerConfigurationService.php index 8a87e65e81f..8c5753c70c1 100644 --- a/src/CentreonRemote/Domain/Service/ConfigurationWizard/LinkedPollerConfigurationService.php +++ b/src/CentreonRemote/Domain/Service/ConfigurationWizard/LinkedPollerConfigurationService.php @@ -8,88 +8,198 @@ require_once _CENTREON_PATH_ . 'www/class/centreonConfigCentreonBroker.php'; require_once _CENTREON_PATH_ . 'www/include/configuration/configGenerate/DB-Func.php'; +use Centreon\Infrastructure\CentreonLegacyDB\CentreonDBAdapter; use Centreon\Domain\Entity\Task; use CentreonRemote\Domain\Value\PollerServer; use CentreonRemote\Infrastructure\Service\PollerInteractionService; -use Pimple\Container; +use Centreon\Domain\Repository\Interfaces\CfgCentreonBrokerInterface; +use Centreon\Domain\Service\BrokerConfigurationService; +use CentreonRemote\Domain\Service\TaskService; + +use CentreonRemote\Domain\Resources\RemoteConfig\InputFlowOnePeerRetention; class LinkedPollerConfigurationService { - - /** @var Container */ - private $di; - /** @var \CentreonDB */ private $db; - /** @var PollerInteractionService */ - private $pollerInteraction; + protected $onePeerRetention = false; + + /** + * @var CfgCentreonBrokerInterface + */ + private $brokerRepository; + + /** + * @var BrokerConfigurationService + */ + private $brokerConfigurationService; + + /** + * @var TaskService + */ + private $taskService; + + /** + * @var PollerInteractionService + */ + private $pollerInteractionService; + + public function __construct(CentreonDBAdapter $dbAdapter) + { + $this->db = $dbAdapter->getCentreonDBInstance(); + } + + /** + * Set broker repository to manage general broker configuration + * + * @param CfgCentreonBrokerInterface $cfgCentreonBroker the centreon broker configuration repository + */ + public function setBrokerRepository(CfgCentreonBrokerInterface $cfgCentreonBroker) + { + $this->brokerRepository = $cfgCentreonBroker; + } - protected $isOpenBrokerFlow = false; + /** + * Set broker configuration service to broker info configuration + * + * @param BrokerConfigurationService $brokerConfigurationService the service to manage broker confiration + */ + public function setBrokerConfigurationService(BrokerConfigurationService $brokerConfigurationService) + { + $this->brokerConfigurationService = $brokerConfigurationService; + } + /** + * Set poller interaction service + * + * @param PollerInteractionService $pollerInteractionService the poller interaction service + */ + public function setPollerInteractionService(pollerInteractionService $pollerInteractionService) + { + $this->pollerInteractionService = $pollerInteractionService; + } - public function __construct(Container $di) + /** + * Set task service to add export task + * + * @param TaskService $taskService the task service + */ + public function setTaskService(TaskService $taskService) { - $this->di = $di; - $this->db = $di['centreon.db-manager']->getAdapter('configuration_db')->getCentreonDBInstance(); - $this->pollerInteraction = new PollerInteractionService($di); + $this->taskService = $taskService; } - public function setOpenBrokerFlow($openBrokerFlow) + /** + * Set one peer retention mode + * + * @param bool $onePeerRetention if one peer retention mode is enabled + */ + public function setOnePeerRetention(bool $onePeerRetention): void { - $this->isOpenBrokerFlow = $openBrokerFlow; + $this->onePeerRetention = $onePeerRetention; } /** + * Link a set of pollers to a parent poller by creating broker input/output + * * @param PollerServer[] $pollers * @param PollerServer $remote */ - public function setPollersConfigurationWithServer(array $pollers, PollerServer $remote) + public function linkPollersToParentPoller(array $pollers, PollerServer $remote) { - $pollerIDs = array_map(function ($poller) { + $pollerIds = array_map(function ($poller) { return $poller->getId(); }, $pollers); // Before linking the pollers to the new remote, we have to tell the old remote they are no longer linked to it - $this->triggerExportForOldRemotes($pollerIDs); + $this->triggerExportForOldRemotes($pollerIds); foreach ($pollers as $poller) { - $pollerID = $poller->getId(); - // If we do not have an open broker flow we need to set the host output of the poller - if (!$this->isOpenBrokerFlow) { - $this->setBrokerOutputOfPoller($pollerID, $remote); + // If one peer retention is enabled, add input on remote server to get data from poller + if ($this->onePeerRetention) { + $this->setBrokerInputOfRemoteServer($remote->getId(), $poller); + } else { // If one peer retention is disabled, we need to set the host output of the poller + $this->setBrokerOutputOfPoller($poller->getId(), $remote); } - $this->setPollerRelationToRemote($pollerID, $remote); + $this->setPollerRelationToRemote($poller->getId(), $remote); } // Generate configuration for pollers and restart them - $this->pollerInteraction->generateAndExport($pollerIDs); + $this->pollerInteractionService->generateAndExport($pollerIds); + } + + /** + * Add broker input configuration on remote server to get data from poller + * + * @param int $pollerId + * @param PollerServer $remote + */ + private function setBrokerInputOfRemoteServer($remoteId, PollerServer $poller): void + { + // get broker config id of linked remote server (cbd broker) + $remoteBrokerConfigId = $this->brokerRepository->findBrokerConfigIdByPollerId($remoteId); + + // get template function to generate input flow in remote server broker configuration + $brokerInfosEntities = InputFlowOnePeerRetention::getConfiguration($poller->getName(), $poller->getIp()); + $this->brokerConfigurationService->addFlow($remoteBrokerConfigId, 'input', $brokerInfosEntities); } - private function setBrokerOutputOfPoller($pollerID, PollerServer $remote) + /** + * Update host field of broker output on poller to link it the the remote server + * + * @param int $pollerId + * @param PollerServer $remote + */ + private function setBrokerOutputOfPoller($pollerId, PollerServer $remote): void { - $configQuery = "SELECT `config_id` FROM `cfg_centreonbroker` WHERE `ns_nagios_server` = :id - AND `config_filename` LIKE '%-module.xml'"; + // find broker config id of poller module + $configQuery = "SELECT `config_id` " + . "FROM `cfg_centreonbroker` " + . "WHERE `ns_nagios_server` = :id " + . "AND `daemon` = 0"; $statement = $this->db->prepare($configQuery); - $statement->execute([':id' => $pollerID]); - $configID = $statement->fetchColumn(); - - $updateQuery = "UPDATE `cfg_centreonbroker_info` SET `config_value` = '{$remote->getIp()}' - WHERE `config_id` = {$configID} AND `config_key` = 'host'"; - $this->db->query($updateQuery); + $statement->bindParam(':id', $pollerId, \PDO::PARAM_INT); + $statement->execute(); + $configId = $statement->fetchColumn(); + + // update host field of poller module output to link it the remote server + $updateQuery = "UPDATE `cfg_centreonbroker_info` " + . "SET `config_value` = :config_value " + . "WHERE `config_id` = :config_id " + . "AND `config_key` = 'host'"; + $statement = $this->db->prepare($updateQuery); + $statement->bindValue(':config_value', $remote->getIp(), \PDO::PARAM_STR); + $statement->bindValue(':config_id', $configId, \PDO::PARAM_INT); + $statement->execute(); } - private function setPollerRelationToRemote($pollerID, PollerServer $remote) + /** + * Link poller with remote server in database + * + * @param int $pollerId + * @param PollerServer $remote + */ + private function setPollerRelationToRemote($pollerId, PollerServer $remote): void { - $query = "UPDATE `nagios_server` SET `remote_id` = '{$remote->getId()}' - WHERE `id` = :id"; + $query = "UPDATE `nagios_server` " + . "SET `remote_id` = :remote_id " + . "WHERE `id` = :id"; $statement = $this->db->prepare($query); - $statement->execute([':id' => $pollerID]); + $statement->bindValue(':remote_id', $remote->getId(), \PDO::PARAM_INT); + $statement->bindValue(':id', $pollerId, \PDO::PARAM_INT); + $statement->execute(); } - private function triggerExportForOldRemotes($pollerIDs) + /** + * Export to existing remote servers + * + * @param int[] $pollerIDs the poller ids to export + * @return void + */ + private function triggerExportForOldRemotes(array $pollerIDs): void { // Get from the database only the pollers that are linked to a remote $idBindString = str_repeat('?,', count($pollerIDs)); @@ -131,7 +241,7 @@ private function triggerExportForOldRemotes($pollerIDs) 'remote_ip' => $remoteDataResults[0]['ip'], 'centreon_path' => $remoteDataResults[0]['centreon_path'], ]; - $this->di['centreon.taskservice']->addTask(Task::TYPE_EXPORT, ['params' => $exportParams]); + $this->taskService->addTask(Task::TYPE_EXPORT, ['params' => $exportParams]); } } } diff --git a/src/CentreonRemote/Domain/Service/ConfigurationWizard/PollerConfigurationRequestBridge.php b/src/CentreonRemote/Domain/Service/ConfigurationWizard/PollerConfigurationRequestBridge.php index 28bba8b90a8..752fc13fd06 100644 --- a/src/CentreonRemote/Domain/Service/ConfigurationWizard/PollerConfigurationRequestBridge.php +++ b/src/CentreonRemote/Domain/Service/ConfigurationWizard/PollerConfigurationRequestBridge.php @@ -16,26 +16,15 @@ class PollerConfigurationRequestBridge /** @var PollerServer[] */ private $pollers = []; - /** @var PollerServer */ - private $remoteServer; - - private $serverID; - public function __construct(Container $di) { $this->dbAdapter = $di['centreon.db-manager']->getAdapter('configuration_db'); } - - public function setServerID($serverID) - { - $this->serverID = $serverID; - } - public function hasPollersForUpdating(): bool { - return !empty($this->pollers) && $this->remoteServer; + return !empty($this->pollers); } /** @@ -46,28 +35,31 @@ public function getLinkedPollersSelectedForUpdate(): array return $this->pollers; } - public function getRemoteServerForConfiguration(): ?PollerServer - { - return $this->remoteServer; - } - - public function collectDataFromRequest() + /** + * Set linked pollers regarding wizard type (poller/remote server) + */ + public function collectDataFromRequest(): void { - $isRemoteConnection = (new ServerWizardIdentity)->requestConfigurationIsRemote(); - - if ($isRemoteConnection) { - $pollers = $_POST['linked_pollers'] ?? ''; // Poller ids are coming form the request - $pollers = (array) $pollers; - $this->pollers = $this->getPollersToLink($pollers); - $this->remoteServer = $this->getRemoteForConfiguration($this->serverID); // The server id is of the new remote - } else { - $remoteID = $_POST['linked_remote'] ?? ''; // Remote id is coming from the request - $this->remoteServer = $this->getRemoteForConfiguration($remoteID); - $this->pollers = $this->getPollersToLink([$this->serverID]); // The server id is of the new poller + $isRemoteServerWizard = (new ServerWizardIdentity)->requestConfigurationIsRemote(); + + if ($isRemoteServerWizard) { // configure remote server + // pollers linked to the remote server + $linkedPollers = isset($_POST['linked_pollers']) ? (array) $_POST['linked_pollers'] : []; + } else { // configure poller + // if the poller is linked to a remote server + $linkedPollers = isset($_POST['linked_remote']) ? [$_POST['linked_remote']] : []; } + + $this->pollers = $this->getPollersToLink($linkedPollers); // set and instantiate linked pollers } - private function getPollersToLink(array $pollers) + /** + * Get pollers to link a set of poller information + * + * @param array $pollers the pollers to get list of poller objects + * @return PollerServer[] the pollers to link + */ + private function getPollersToLink(array $pollers): array { if (empty($pollers)) { return []; @@ -87,51 +79,45 @@ private function getPollersToLink(array $pollers) $idBindString = str_repeat('?,', count($pollerIDs)); $idBindString = rtrim($idBindString, ','); - $queryPollers = "SELECT id, ns_ip_address as ip FROM nagios_server WHERE id IN({$idBindString})"; - - try { - $this->dbAdapter->query($queryPollers, $pollerIDs); - $results = $this->dbAdapter->results(); - $data = []; + $queryPollers = "SELECT id, name, ns_ip_address as ip FROM nagios_server WHERE id IN ({$idBindString})"; - foreach ($results as $result) { - $poller = new PollerServer; - $poller->setId($result->id); - $poller->setIp($result->ip); + $this->dbAdapter->query($queryPollers, $pollerIDs); + $results = $this->dbAdapter->results(); + $data = []; - $data[] = $poller; - } + foreach ($results as $result) { + $poller = new PollerServer; + $poller->setId($result->id); + $poller->setName($result->name); + $poller->setIp($result->ip); - return $data; - } catch (\Exception $e) { - error_log($e->getMessage()); + $data[] = $poller; } - return []; + return $data; } - private function getRemoteForConfiguration($remoteID) + /** + * Get poller information from poller id + * + * @param int $pollerId the poller id to get + * @return null|PollerServer + */ + public function getPollerFromId(int $pollerId): ?PollerServer { - $queryPollers = 'SELECT id, ns_ip_address as ip FROM nagios_server WHERE id=?'; + $query = 'SELECT id, name, ns_ip_address as ip FROM nagios_server WHERE id = ?'; - if (empty($remoteID)) { - return null; - } + $this->dbAdapter->query($query, [$pollerId]); + $results = $this->dbAdapter->results(); - try { - $this->dbAdapter->query($queryPollers, [$remoteID]); - $results = $this->dbAdapter->results(); + if (count($results)) { + $remoteData = reset($results); + $remoteServer = new PollerServer; + $remoteServer->setId($remoteData->id); + $remoteServer->setName($remoteData->name); + $remoteServer->setIp($remoteData->ip); - if (count($results)) { - $remoteData = reset($results); - $remoteServer = new PollerServer; - $remoteServer->setId($remoteData->id); - $remoteServer->setIp($remoteData->ip); - - return $remoteServer; - } - } catch (\Exception $e) { - error_log($e->getMessage()); + return $remoteServer; } return null; diff --git a/src/CentreonRemote/Domain/Service/ConfigurationWizard/PollerConnectionConfigurationService.php b/src/CentreonRemote/Domain/Service/ConfigurationWizard/PollerConnectionConfigurationService.php index ab8c51a0d3c..2cd6bd77857 100644 --- a/src/CentreonRemote/Domain/Service/ConfigurationWizard/PollerConnectionConfigurationService.php +++ b/src/CentreonRemote/Domain/Service/ConfigurationWizard/PollerConnectionConfigurationService.php @@ -2,15 +2,57 @@ namespace CentreonRemote\Domain\Service\ConfigurationWizard; +use Centreon\Domain\Repository\Interfaces\CfgCentreonBrokerInterface; +use Centreon\Domain\Service\BrokerConfigurationService; + +use CentreonRemote\Domain\Resources\RemoteConfig\ { + CfgCentreonBroker, + CfgCentreonBrokerInfo, + InputFlowOnePeerRetention +}; + class PollerConnectionConfigurationService extends ServerConnectionConfigurationService { + /** + * @var CfgCentreonBrokerInterface + */ + private $brokerRepository; + + /** + * @var BrokerConfigurationService + */ + private $brokerConfigurationService; + + /** + * Set broker repository to manage general broker configuration + * + * @param CfgCentreonBrokerInterface $cfgCentreonBroker the centreon broker configuration repository + */ + public function setBrokerRepository(CfgCentreonBrokerInterface $cfgCentreonBroker) + { + $this->brokerRepository = $cfgCentreonBroker; + } - protected function insertConfigCentreonBroker($serverID) + /** + * Set broker configuration service to broker info configuration + * + * @param BrokerConfigurationService $brokerConfigurationService the service to manage broker confiration + */ + public function setBrokerConfigurationService(BrokerConfigurationService $brokerConfigurationService) { - $configCentreonBrokerData = $this->getResource('cfg_centreonbroker.php'); - $configCentreonBrokerData = $configCentreonBrokerData($serverID, $this->name); - $configCentreonBrokerInfoData = $this->getResource('cfg_centreonbroker_info.php'); - $configCentreonBrokerInfoData = $configCentreonBrokerInfoData($this->name, null, null); + $this->brokerConfigurationService = $brokerConfigurationService; + } + + /** + * Insert centreon broker configuration to a given poller + * this configuration i only for broker module (not cbd) + * + * @param int $serverID the poller id + */ + protected function insertConfigCentreonBroker(int $serverID): void + { + $configCentreonBrokerData = CfgCentreonBroker::getConfiguration($serverID, $this->name); + $configCentreonBrokerInfoData = CfgCentreonBrokerInfo::getConfiguration($this->name, null, null); $outputHost = $this->centralIp; $onePeerRetentionMode = 'no'; @@ -21,17 +63,25 @@ protected function insertConfigCentreonBroker($serverID) $this->insertWithAdapter('cfg_centreonbroker_info', $row); } - if ($this->isOpenBrokerFlow) { + // if one peer retention mode is enabled, + // we need to add an input in central broker configuration + if ($this->onePeerRetention) { + // update poller broker module parameters for one peer retention $outputHost = ''; $onePeerRetentionMode = 'yes'; - $openFlowInputConfig = $this->getResource('input_poller_open_flow.php'); - foreach ($openFlowInputConfig($this->serverIp) as $openFlowRow) { - $openFlowRow['config_id'] = $moduleID; - $this->insertWithAdapter('cfg_centreonbroker_info', $openFlowRow); + if ($this->isLinkedToCentralServer) { + // get central broker config id + // we need it to add an input to pull broker data from distant poller + $centralBrokerConfigId = $this->brokerRepository->findCentralBrokerConfigId(); + + // add broker input configuration on central to get data from poller + $brokerInfosEntities = InputFlowOnePeerRetention::getConfiguration($this->name, $this->serverIp); + $this->brokerConfigurationService->addFlow($centralBrokerConfigId, 'input', $brokerInfosEntities); } } + // add poller module output flow to send data to the central server foreach ($configCentreonBrokerInfoData['central-module']['output'] as $row) { if ($row['config_key'] == 'host') { $row['config_value'] = $outputHost; diff --git a/src/CentreonRemote/Domain/Service/ConfigurationWizard/RemoteConnectionConfigurationService.php b/src/CentreonRemote/Domain/Service/ConfigurationWizard/RemoteConnectionConfigurationService.php index 71b6aed901c..5a657dcf050 100644 --- a/src/CentreonRemote/Domain/Service/ConfigurationWizard/RemoteConnectionConfigurationService.php +++ b/src/CentreonRemote/Domain/Service/ConfigurationWizard/RemoteConnectionConfigurationService.php @@ -2,15 +2,22 @@ namespace CentreonRemote\Domain\Service\ConfigurationWizard; +use CentreonRemote\Domain\Resources\RemoteConfig\ { + CfgCentreonBroker, + CfgCentreonBrokerInfo +}; + class RemoteConnectionConfigurationService extends ServerConnectionConfigurationService { - protected function insertConfigCentreonBroker($serverID) + protected function insertConfigCentreonBroker(int $serverID): void { - $configCentreonBrokerData = $this->getResource('cfg_centreonbroker.php'); - $configCentreonBrokerData = $configCentreonBrokerData($serverID, $this->name); - $configCentreonBrokerInfoData = $this->getResource('cfg_centreonbroker_info.php'); - $configCentreonBrokerInfoData = $configCentreonBrokerInfoData($this->name, $this->dbUser, $this->dbPassword); + $configCentreonBrokerData = CfgCentreonBroker::getConfiguration($serverID, $this->name); + $configCentreonBrokerInfoData = CfgCentreonBrokerInfo::getConfiguration( + $this->name, + $this->dbUser, + $this->dbPassword + ); $this->brokerID = $this->insertWithAdapter('cfg_centreonbroker', $configCentreonBrokerData['broker']); $moduleID = $this->insertWithAdapter('cfg_centreonbroker', $configCentreonBrokerData['module']); diff --git a/src/CentreonRemote/Domain/Service/ConfigurationWizard/ServerConnectionConfigurationService.php b/src/CentreonRemote/Domain/Service/ConfigurationWizard/ServerConnectionConfigurationService.php index 5cf41c6794e..1c5e94363af 100644 --- a/src/CentreonRemote/Domain/Service/ConfigurationWizard/ServerConnectionConfigurationService.php +++ b/src/CentreonRemote/Domain/Service/ConfigurationWizard/ServerConnectionConfigurationService.php @@ -3,7 +3,13 @@ namespace CentreonRemote\Domain\Service\ConfigurationWizard; use Centreon\Infrastructure\CentreonLegacyDB\CentreonDBAdapter; -use Pimple\Container; + +use CentreonRemote\Domain\Resources\RemoteConfig\ { + NagiosServer, + CfgNagios, + CfgNagiosBrokerModule, + BamBrokerCfgInfo +}; abstract class ServerConnectionConfigurationService { @@ -21,21 +27,20 @@ abstract class ServerConnectionConfigurationService protected $name; - protected $isOpenBrokerFlow = false; + protected $onePeerRetention = false; protected $shouldInsertBamBrokers = false; - protected $brokerID = null; - - protected $resourcesPath = '/Domain/Resources/remote_config/'; + protected $isLinkedToCentralServer = false; + protected $brokerID = null; - public function __construct(Container $di) + public function __construct(CentreonDBAdapter $dbAdapter) { - $this->dbAdapter = $di['centreon.db-manager']->getAdapter('configuration_db'); + $this->dbAdapter = $dbAdapter; } - abstract protected function insertConfigCentreonBroker($serverID); + abstract protected function insertConfigCentreonBroker(int $serverID): void; public function setServerIp($ip) { @@ -62,9 +67,14 @@ public function setDbPassword($password) $this->dbPassword = $password; } - public function setOpenBrokerFlow($openBrokerFlow) + /** + * Set one peer retention mode + * + * @param bool $onePeerRetention if one peer retention mode is enabled + */ + public function setOnePeerRetention(bool $onePeerRetention): void { - $this->isOpenBrokerFlow = $openBrokerFlow; + $this->onePeerRetention = $onePeerRetention; } protected function getDbAdapter(): CentreonDBAdapter @@ -72,11 +82,6 @@ protected function getDbAdapter(): CentreonDBAdapter return $this->dbAdapter; } - protected function getResource($resourceName): callable - { - return require_once dirname(dirname(dirname(dirname(__FILE__)))) . "{$this->resourcesPath}{$resourceName}"; - } - /** * @return bool * @@ -98,7 +103,7 @@ public function insert() $this->insertConfigCentreonBroker($serverID); - if ($this->shouldInsertBamBrokers && $this->isRemote() === false) { + if ($this->shouldInsertBamBrokers && $this->isRemote()) { $this->insertBamBrokers(); } @@ -109,18 +114,14 @@ public function insert() protected function insertNagiosServer() { - $nagiosServerData = $this->getResource('nagios_server.php'); - - return $this->insertWithAdapter('nagios_server', $nagiosServerData($this->name, $this->serverIp)); + return $this->insertWithAdapter('nagios_server', NagiosServer::getConfiguration($this->name, $this->serverIp)); } protected function insertConfigNagios($serverID) { - $configNagiosData = $this->getResource('cfg_nagios.php'); - $configID = $this->insertWithAdapter('cfg_nagios', $configNagiosData($this->name, $serverID)); + $configID = $this->insertWithAdapter('cfg_nagios', CfgNagios::getConfiguration($this->name, $serverID)); - $configNagiosBrokerData = $this->getResource('cfg_nagios_broker_module.php'); - $configBroker = $configNagiosBrokerData($configID, $this->name); + $configBroker = CfgNagiosBrokerModule::getConfiguration($configID, $this->name); $this->insertWithAdapter('cfg_nagios_broker_module', $configBroker[0]); $this->insertWithAdapter('cfg_nagios_broker_module', $configBroker[1]); @@ -161,8 +162,7 @@ protected function insertBamBrokers() throw new \Exception('Broker ID was not inserted in order to add BAM broker configs to it.'); } - $bamBrokerInfoData = $this->getResource('bam_broker_cfg_info.php'); - $bamBrokerInfoData = $bamBrokerInfoData($conf_centreon['password']); + $bamBrokerInfoData = BamBrokerCfgInfo::getConfiguration($conf_centreon['password']); foreach ($bamBrokerInfoData['monitoring'] as $row) { $row['config_id'] = $this->brokerID; @@ -192,6 +192,11 @@ public function shouldInsertBamBrokers() $this->shouldInsertBamBrokers = true; } + public function isLinkedToCentralServer() + { + $this->isLinkedToCentralServer = true; + } + protected function isRemote(): bool { return false; diff --git a/src/CentreonRemote/Domain/Service/NotifyMasterService.php b/src/CentreonRemote/Domain/Service/NotifyMasterService.php index 5d8a64768d2..c286ed9bfa1 100644 --- a/src/CentreonRemote/Domain/Service/NotifyMasterService.php +++ b/src/CentreonRemote/Domain/Service/NotifyMasterService.php @@ -3,8 +3,8 @@ namespace CentreonRemote\Domain\Service; use Centreon\Domain\Repository\InformationsRepository; +use Centreon\Infrastructure\Service\CentreonDBManagerService; use Curl\Curl; -use Pimple\Container; class NotifyMasterService { @@ -26,16 +26,31 @@ class NotifyMasterService const FAIL = 'fail'; /** - * @var Container + * @var CentreonDBManagerService */ - private $di; + private $dbManager; + + /** + * @var Curl + */ + private $curl; + + /** + * @return Curl + */ + public function setCurl(Curl $curl): void + { + $this->curl = $curl; + } /** * NotifyMasterService constructor. + * + * @param CentreonDBManagerService $dbManager */ - public function __construct(Container $di) + public function __construct(CentreonDBManagerService $dbManager) { - $this->di = $di; + $this->dbManager = $dbManager; } /** @@ -54,7 +69,7 @@ public function pingMaster($ip) } $url = "{$ip}/centreon/api/external.php?object=centreon_remote_server&action=addToWaitList"; - $repository = $this->getDi()['centreon.db-manager']->getRepository(InformationsRepository::class); + $repository = $this->dbManager->getRepository(InformationsRepository::class); $applicationKey = $repository->getOneByKey('appKey'); $version = $repository->getOneByKey('version'); @@ -70,8 +85,7 @@ public function pingMaster($ip) 'app_key' => $applicationKey->getValue(), 'version' => $version->getValue(), ]; - $curl = new Curl(); - $curl->post($url, $curlData); + $this->curl->post($url, $curlData); if ($curl->error) { switch ($curl->error_code) { @@ -103,9 +117,4 @@ public function pingMaster($ip) return ['status' => self::SUCCESS]; } - - private function getDi(): Container - { - return $this->di; - } } \ No newline at end of file diff --git a/src/CentreonRemote/Domain/Service/PollerDefaultsOverwriteService.php b/src/CentreonRemote/Domain/Service/PollerDefaultsOverwriteService.php index 74fa491f19f..8416de32cc5 100644 --- a/src/CentreonRemote/Domain/Service/PollerDefaultsOverwriteService.php +++ b/src/CentreonRemote/Domain/Service/PollerDefaultsOverwriteService.php @@ -2,6 +2,11 @@ namespace CentreonRemote\Domain\Service; +use CentreonRemote\Domain\Resources\DefaultConfig\ { + CfgNagiosBrokerModule, + CfgCentreonBrokerInfo +}; + class PollerDefaultsOverwriteService { @@ -11,8 +16,6 @@ class PollerDefaultsOverwriteService private $nagiosConfigIDs = []; - private $resourcesPath = '/Domain/Resources/default_config/'; - /** * @param null $pollerID */ @@ -21,11 +24,6 @@ public function setPollerID($pollerID) $this->pollerID = $pollerID; } - private function getResource($resourceName): array - { - return require_once dirname(dirname(dirname(__FILE__))) . "{$this->resourcesPath}{$resourceName}"; - } - /** * @param array $data - the table data for all pollers * @param string $columnName - the name of the column which is FK to the poller @@ -41,7 +39,7 @@ private function findPollerAndSetResourceData(array $data, $columnName, $resourc }); // Get default data for the specified resource - $defaultData = $this->getResource($resourceName); + $defaultData = $resourceName::getConfiguration(); // Make the data multidimensional array if its not, so it can be merged $dataToMerge = is_array($defaultData[key($defaultData)]) ? $defaultData : [$defaultData]; @@ -54,56 +52,104 @@ private function findPollerAndSetResourceData(array $data, $columnName, $resourc return array_merge($data, $dataToMerge); } - public function setNagiosServer(array $data) + /** + * Get poller information + * + * @param array $data the poller data + * @return array the complete poller data + */ + public function getNagiosServer(array $data): array { - return $this->findPollerAndSetResourceData($data, 'id', 'nagios_server.php'); + return $this->findPollerAndSetResourceData( + $data, + 'id', + 'CentreonRemote\Domain\Resources\DefaultConfig\NagiosServer' + ); } - public function setCfgNagios(array $data) + /** + * Get engine information + * + * @param array $data the engine data + * @return array the complete engine data + */ + public function getCfgNagios(array $data): array { $configsOfRemote = array_filter($data, function ($pollerData) { return $pollerData['nagios_server_id'] == $this->pollerID; }); $this->nagiosConfigIDs = array_column($configsOfRemote, 'nagios_id'); - return $this->findPollerAndSetResourceData($data, 'nagios_server_id', 'cfg_nagios.php'); + return $this->findPollerAndSetResourceData( + $data, + 'nagios_server_id', + 'CentreonRemote\Domain\Resources\DefaultConfig\CfgNagios' + ); } - public function setCfgNagiosBroker(array $data) + /** + * Get engine broker module information + * + * @param array $data the engine broker module data + * @return array the complete engine broker module data + */ + public function getCfgNagiosBroker(array $data): array { // Remove nagios config info which is related to the broker module of the remote poller $data = array_filter($data, function ($pollerData) { return !in_array($pollerData['cfg_nagios_id'], $this->nagiosConfigIDs); }); - $defaultData = $this->getResource('cfg_nagios_broker_module.php'); + $defaultData = CfgNagiosBrokerModule::getConfiguration(); return array_merge($defaultData, $data); } - public function setCfgCentreonBroker(array $data) + /** + * Get broker information + * + * @param array $data the broker data + * @return array the complete broker data + */ + public function getCfgCentreonBroker(array $data): array { $configsOfRemote = array_filter($data, function ($pollerData) { return $pollerData['ns_nagios_server'] == $this->pollerID; }); $this->brokerConfigIDs = array_column($configsOfRemote, 'config_id'); - return $this->findPollerAndSetResourceData($data, 'ns_nagios_server', 'cfg_centreonbroker.php'); + return $this->findPollerAndSetResourceData( + $data, + 'ns_nagios_server', + 'CentreonRemote\Domain\Resources\DefaultConfig\CfgCentreonBroker' + ); } - public function setCfgCentreonBrokerInfo(array $data) + /** + * Get broker detailed information + * + * @param array $data the broker detailed data + * @return array the complete broker detailed data + */ + public function getCfgCentreonBrokerInfo(array $data): array { // Remove broker config info which is related to the broker module of the remote poller $data = array_filter($data, function ($pollerData) { return !in_array($pollerData['config_id'], $this->brokerConfigIDs); }); - $defaultData = $this->getResource('cfg_centreonbroker_info.php'); + $defaultData = CfgCentreonBrokerInfo::getConfiguration(); return array_merge($defaultData, $data); } - public function setCfgResource(array $data) + /** + * Get global macro information + * + * @param array $data the global macro data + * @return array the complete global macro data + */ + public function getCfgResource(array $data): array { // prepare _instance_id for method findPollerAndSetResourceData foreach ($data as $key => $val) { @@ -116,6 +162,10 @@ public function setCfgResource(array $data) } } - return $this->findPollerAndSetResourceData($data, '_instance_id', 'cfg_resource.php'); + return $this->findPollerAndSetResourceData( + $data, + '_instance_id', + 'CentreonRemote\Domain\Resources\DefaultConfig\CfgResource' + ); } } diff --git a/src/CentreonRemote/Domain/Service/TaskService.php b/src/CentreonRemote/Domain/Service/TaskService.php index fc12ac20049..454361bdacf 100644 --- a/src/CentreonRemote/Domain/Service/TaskService.php +++ b/src/CentreonRemote/Domain/Service/TaskService.php @@ -20,13 +20,18 @@ class TaskService /** * @var CentreonDBManagerService */ - private $dbman; + private $dbManager; /** * @var CentcoreCommandService */ private $cmdService; + /** + * @var \CentreonRestHttp + */ + private $centreonRestHttp; + /** * @return CentcoreCommandService */ @@ -54,26 +59,37 @@ public function getGen(): KeyGeneratorInterface /** * @return CentreonDBManagerService */ - public function getDbman(): CentreonDBManagerService + public function getDbManager(): CentreonDBManagerService + { + return $this->dbManager; + } + + /** + * @return \CentreonRestHttp + */ + public function setCentreonRestHttp(\CentreonRestHttp $centreonRestHttp): void { - return $this->dbman; + $this->centreonRestHttp = $centreonRestHttp; } /** * TaskService constructor * @param KeyGeneratorInterface $generator - * @param CentreonDBManagerService $dbman + * @param CentreonDBManagerService $dbManager */ - public function __construct(KeyGeneratorInterface $generator, CentreonDBManagerService $dbman, CentcoreCommandService $cmdService) - { + public function __construct( + KeyGeneratorInterface $generator, + CentreonDBManagerService $dbManager, + CentcoreCommandService $cmdService + ) { $this->gen = $generator; - $this->dbman = $dbman; + $this->dbManager = $dbManager; $this->cmdService = $cmdService; } /** * Adds a new task - * + * * @param string $type * @param array $params * @param int $parentId @@ -88,27 +104,14 @@ public function addTask(string $type, array $params, int $parentId = null) switch ($type) { case Task::TYPE_EXPORT: - $newTask->setType(Task::TYPE_EXPORT); - $result = $this->getDbman()->getAdapter('configuration_db') - ->insert('task', $newTask->toArray()) - ; - - $cmd = new Command(); - $cmd->setCommandLine(Command::COMMAND_START_IMPEX_WORKER); - $cmdWritten = $this->getCmdService()->sendCommand($cmd); - break; - case Task::TYPE_IMPORT: - $newTask->setType(Task::TYPE_IMPORT); - $result = $this->getDbman()->getAdapter('configuration_db') - ->insert('task', $newTask->toArray()) - ; + $newTask->setType($type); + $result = $this->getDbManager()->getAdapter('configuration_db')->insert('task', $newTask->toArray()); $cmd = new Command(); $cmd->setCommandLine(Command::COMMAND_START_IMPEX_WORKER); $cmdWritten = $this->getCmdService()->sendCommand($cmd); break; - default: return false; } @@ -123,18 +126,41 @@ public function addTask(string $type, array $params, int $parentId = null) */ public function getStatus(string $taskId) { - $task = $this->getDbman()->getAdapter('configuration_db')->getRepository(TaskRepository::class)->findOneById($taskId); + $task = $this->getDbManager()->getAdapter('configuration_db')->getRepository(TaskRepository::class) + ->findOneById($taskId); return $task ? $task->getStatus() : null; } /** - * Get Existing Task status by parent - * @param int $parentId + * Get remote existing task status by parent id + * + * @param int $parentId the parent task id on remote server + * @param string $serverIp the ip address of the remote server + * @param string $centreonFolder the folder of centreon on remote server + * @return null + */ + public function getRemoteStatusByParent(int $parentId, string $serverIp, string $centreonFolder) + { + $result = $this->centreonRestHttp->call( + 'http://' . $serverIp . '/' . $centreonFolder + . '/api/external.php?object=centreon_task_service&action=getTaskStatusByParent', + 'POST', + ['parent_id' => $parentId] + ); + + return isset($result['status']) ? $result['status'] : null; + } + + /** + * Get existing task status by parent id + * + * @param int $parentId the parent task id on remote server * @return null */ public function getStatusByParent(int $parentId) { - $task = $this->getDbman()->getAdapter('configuration_db')->getRepository(TaskRepository::class)->findOneByParentId($parentId); + $task = $this->getDbManager()->getAdapter('configuration_db')->getRepository(TaskRepository::class) + ->findOneByParentId($parentId); return $task ? $task->getStatus() : null; } @@ -148,13 +174,13 @@ public function getStatusByParent(int $parentId) */ public function updateStatus(string $taskId, string $status) { - $task = $this->getDbman()->getAdapter('configuration_db')->getRepository(TaskRepository::class)->findOneById($taskId); + $task = $this->getDbManager()->getAdapter('configuration_db')->getRepository(TaskRepository::class)->findOneById($taskId); if (!in_array($status,$task->getStatuses())) { return false; } - $result = $this->getDbman()->getAdapter('configuration_db')->getRepository(TaskRepository::class)->updateStatus($status, $taskId); + $result = $this->getDbManager()->getAdapter('configuration_db')->getRepository(TaskRepository::class)->updateStatus($status, $taskId); return $result; } } diff --git a/src/CentreonRemote/Domain/Value/PollerServer.php b/src/CentreonRemote/Domain/Value/PollerServer.php index 1fe0ab81d8a..45295840833 100644 --- a/src/CentreonRemote/Domain/Value/PollerServer.php +++ b/src/CentreonRemote/Domain/Value/PollerServer.php @@ -4,9 +4,19 @@ class PollerServer { - + /** + * @var int $id the poller id + */ private $id; + /** + * @var string $name the poller name + */ + private $name; + + /** + * @var string $ip the poller ip address + */ private $ip; @@ -20,6 +30,26 @@ public function setId($id) $this->id = $id; } + /** + * Get poller name + * + * @return string the poller name + */ + public function getName(): string + { + return $this->name; + } + + /** + * Set poller name + * + * @param string $name the poller name + */ + public function setName(string $name): void + { + $this->name = $name; + } + public function getIp() { return $this->ip; diff --git a/src/CentreonRemote/Domain/Value/ServerWizardIdentity.php b/src/CentreonRemote/Domain/Value/ServerWizardIdentity.php index 99c9776f965..41a97b4fdf0 100644 --- a/src/CentreonRemote/Domain/Value/ServerWizardIdentity.php +++ b/src/CentreonRemote/Domain/Value/ServerWizardIdentity.php @@ -4,20 +4,39 @@ use Curl\Curl; +/** + * Check wizard type + */ class ServerWizardIdentity { - - public function requestConfigurationIsRemote() + /** + * check wizard type (remote server / poller) + * + * @return bool true if it is remote server wizard + */ + public function requestConfigurationIsRemote(): bool { return isset($_POST['server_type']) && $_POST['server_type'] == 'remote'; } - public function requestConfigurationIsPoller() + /** + * check wizard type (remote server / poller) + * + * @return bool true if it is poller wizard + */ + public function requestConfigurationIsPoller(): bool { return !static::requestConfigurationIsRemote(); } - public function fetchIfServerInstalledBam($ip, $centreonPath) + /** + * check if bam is installed on remote server + * + * @param string $ip ip address of the remote server + * @param string $centreonPath centreon web path on remote server + * @return bool if bam is installed on remote server + */ + public function checkBamOnRemoteServer(string $ip, string $centreonPath): bool { $centreonPath = trim($centreonPath, '/'); $url = "{$ip}/{$centreonPath}/api/external.php?object=centreon_modules_webservice&action=getBamModuleInfo"; diff --git a/src/CentreonRemote/Infrastructure/Export/ExportCommitment.php b/src/CentreonRemote/Infrastructure/Export/ExportCommitment.php index 9f3733ab7aa..889d3604a87 100644 --- a/src/CentreonRemote/Infrastructure/Export/ExportCommitment.php +++ b/src/CentreonRemote/Infrastructure/Export/ExportCommitment.php @@ -34,7 +34,7 @@ final class ExportCommitment /** * Construct - * + * * @param int $remote * @param int[] $pollers * @param array $meta @@ -42,8 +42,14 @@ final class ExportCommitment * @param string $path * @param array $exporters */ - public function __construct(int $remote = null, array $pollers = null, array $meta = null, ExportParserInterface $parser = null, string $path = null, array $exporters = null) - { + public function __construct( + int $remote = null, + array $pollers = null, + array $meta = null, + ExportParserInterface $parser = null, + string $path = null, + array $exporters = null + ) { if ($remote && $pollers && !in_array($remote, $pollers)) { $pollers[] = $remote; } diff --git a/src/CentreonRemote/Infrastructure/Service/ExportService.php b/src/CentreonRemote/Infrastructure/Service/ExportService.php index aa4196d9fb5..2ae87f3b473 100644 --- a/src/CentreonRemote/Infrastructure/Service/ExportService.php +++ b/src/CentreonRemote/Infrastructure/Service/ExportService.php @@ -42,7 +42,7 @@ class ExportService /** * Construct - * + * * @param \Psr\Container\ContainerInterface $services */ public function __construct(ContainerInterface $services) @@ -94,9 +94,7 @@ public function export(ExportCommitment $commitment): void $exporter->setCache($this->cache); $exporter->export(); - $hasInterface = (new ReflectionClass($exporter)) - ->implementsInterface($interface) - ; + $hasInterface = (new ReflectionClass($exporter))->implementsInterface($interface); if ($hasInterface) { $partials[] = $exporter; @@ -117,7 +115,7 @@ public function export(ExportCommitment $commitment): void /** * Import - * + * * @throws \Exception * @param \CentreonRemote\Infrastructure\Export\ExportCommitment $commitment */ @@ -150,7 +148,7 @@ public function import(ExportCommitment $commitment = null): void // cleanup ACL removed data $this->_refreshAcl(); - // backup expot directory + // remove export directory system('rm -rf ' . escapeshellarg($exportPath)); } diff --git a/src/CentreonRemote/ServiceProvider.php b/src/CentreonRemote/ServiceProvider.php index 5903ce7546c..6b39227ca4a 100644 --- a/src/CentreonRemote/ServiceProvider.php +++ b/src/CentreonRemote/ServiceProvider.php @@ -16,6 +16,8 @@ use CentreonRemote\Domain\Service\InformationsService; use CentreonRemote\Domain\Service\NotifyMasterService; use CentreonRemote\Domain\Service\TaskService; +use CentreonRemote\Infrastructure\Service\PollerInteractionService; +use Curl\Curl; class ServiceProvider implements AutoloadServiceProviderInterface { @@ -38,7 +40,23 @@ public function register(Container $pimple): void $pimple['centreon.clapi']->add(Clapi\CentreonWorker::class); $pimple['centreon.notifymaster'] = function (Container $pimple): NotifyMasterService { - $service = new NotifyMasterService($pimple); + $service = new NotifyMasterService($pimple['centreon.db-manager']); + $service->setCurl(new Curl); + return $service; + }; + + $pimple['centreon.taskservice'] = function (Container $pimple): TaskService { + $service = new TaskService( + new AppKeyGeneratorService(), + $pimple['centreon.db-manager'], + new CentcoreCommandService() + ); + $service->setCentreonRestHttp($pimple['rest_http']); + return $service; + }; + + $pimple['centreon_remote.poller_interaction_service'] = function (Container $pimple): PollerInteractionService { + $service = new PollerInteractionService($pimple); return $service; }; @@ -48,17 +66,29 @@ public function register(Container $pimple): void }; $pimple['centreon_remote.remote_connection_service'] = function (Container $pimple): RemoteConnectionConfigurationService { - $service = new RemoteConnectionConfigurationService($pimple); + $service = new RemoteConnectionConfigurationService( + $pimple['centreon.db-manager']->getAdapter('configuration_db') + ); return $service; }; $pimple['centreon_remote.poller_connection_service'] = function (Container $pimple): PollerConnectionConfigurationService { - $service = new PollerConnectionConfigurationService($pimple); + $service = new PollerConnectionConfigurationService( + $pimple['centreon.db-manager']->getAdapter('configuration_db') + ); + $service->setBrokerRepository($pimple['centreon.broker_repository']); + $service->setBrokerConfigurationService($pimple['centreon.broker_configuration_service']); return $service; }; $pimple['centreon_remote.poller_config_service'] = function (Container $pimple): LinkedPollerConfigurationService { - $service = new LinkedPollerConfigurationService($pimple); + $service = new LinkedPollerConfigurationService( + $pimple['centreon.db-manager']->getAdapter('configuration_db') + ); + $service->setBrokerRepository($pimple['centreon.broker_repository']); + $service->setBrokerConfigurationService($pimple['centreon.broker_configuration_service']); + $service->setPollerInteractionService($pimple['centreon_remote.poller_interaction_service']); + $service->setTaskService($pimple['centreon.taskservice']); return $service; }; @@ -94,11 +124,6 @@ public function register(Container $pimple): void return $service; }; - $pimple['centreon.taskservice'] = function (Container $pimple): TaskService { - $service = new TaskService(new AppKeyGeneratorService(), $pimple['centreon.db-manager'], new CentcoreCommandService()); - return $service; - }; - //-----------// // Exporters //-----------// @@ -224,7 +249,7 @@ public function register(Container $pimple): void return $service; }); } - + public static function order() : int { return 20; } diff --git a/src/CentreonRemote/Tests/ServiceProviderTest.php b/src/CentreonRemote/Tests/ServiceProviderTest.php index 880061f0473..274d290d7aa 100644 --- a/src/CentreonRemote/Tests/ServiceProviderTest.php +++ b/src/CentreonRemote/Tests/ServiceProviderTest.php @@ -10,6 +10,7 @@ use CentreonRemote\Infrastructure\Service; use CentreonRemote\Domain\Exporter; use CentreonACL; +use CentreonRestHttp; /** * @group CentreonRemote @@ -27,24 +28,28 @@ protected function setUp() $this->container = new Container; $this->container['centreon.acl'] = $this->getMockBuilder(CentreonACL::class) ->disableOriginalConstructor() - ->getMock() - ; + ->getMock(); $this->container['realtime_db'] = $this->container['configuration_db'] = new Mock\CentreonDB; $this->container['configuration_db']->addResultSet("SELECT * FROM informations WHERE `key` = :key LIMIT 1", []); - - $locator = new ServiceLocator($this->container, [ - 'realtime_db', - 'configuration_db', - ]); + + $this->container['rest_http'] = $this->getMockBuilder(CentreonRestHttp::class) + ->disableOriginalConstructor() + ->getMock(); + + $locator = new ServiceLocator($this->container, ['realtime_db', 'configuration_db']); $this->container['centreon.db-manager'] = new \Centreon\Infrastructure\Service\CentreonDBManagerService($locator); $this->container['centreon.webservice'] = $this->container['centreon.clapi'] = new class { + public function add($class) + { - public function add($class) - { - - } - }; + } + }; + + $this->container['centreon.broker_repository'] = + new \Centreon\Domain\Repository\CfgCentreonBrokerRepository($this->container['configuration_db']); + $this->container['centreon.broker_configuration_service'] = + new \Centreon\Domain\Service\BrokerConfigurationService(); $this->provider->register($this->container); } @@ -73,9 +78,9 @@ public function testCheckServicesByList() // check list of services foreach ($checkList as $serviceName => $className) { $this->assertTrue($this->container->offsetExists($serviceName)); - + $service = $this->container->offsetGet($serviceName); - + $this->assertInstanceOf($className, $service); } } @@ -97,7 +102,7 @@ public function testCheckExportersByList() Exporter\TimePeriodExporter::class, Exporter\TrapExporter::class, ]; - + $exporter = $this->container['centreon_remote.exporter']; // check list of exporters @@ -106,10 +111,10 @@ public function testCheckExportersByList() $this->assertTrue($exporter->has($name)); $data = $exporter->get($className::getName()); - + $this->assertEquals($name, $data['name']); $this->assertEquals($className, $data['classname']); - + $object = $data['factory']($this->container); $this->assertInstanceOf($className, $object); diff --git a/tests/php/CentreonLegacy/Core/Widget/FactoryTest.php b/tests/php/CentreonLegacy/Core/Widget/FactoryTest.php index 8b5f06b7453..582cb6ba186 100644 --- a/tests/php/CentreonLegacy/Core/Widget/FactoryTest.php +++ b/tests/php/CentreonLegacy/Core/Widget/FactoryTest.php @@ -62,10 +62,6 @@ public function setUp() ->method('buildPath') ->willReturn('/'); - $this->utils->expects($this->any()) - ->method('xmlToArray') - ->willReturn($configuration); - $filesystem = $this->getMockBuilder('\Symfony\Component\Filesystem\Filesystem') ->disableOriginalConstructor() ->setMethods(array('exists')) diff --git a/tests/php/bootstrap.php b/tests/php/bootstrap.php index a528fb1d47a..426f9596f4e 100644 --- a/tests/php/bootstrap.php +++ b/tests/php/bootstrap.php @@ -15,8 +15,22 @@ * limitations under the License. */ -define('_CENTREON_PATH_', realpath(__DIR__.'/../../') . '/'); -define('_CENTREON_ETC_', realpath(__DIR__.'/../../') . '/'); +// mock path constants to redirect to base centreon directory +$mockedPathConstants = ['_CENTREON_PATH_', '_CENTREON_ETC_', '_CENTREON_LOG_']; +foreach ($mockedPathConstants as $mockedPathConstant) { + if (!defined($mockedPathConstant)) { + define($mockedPathConstant, realpath(__DIR__ . '/../../') . '/'); + } +} + +// mock variable constants to redirect to base centreon directory +$mockedVarConstants = ['hostCentreon', 'hostCentstorage', 'user', 'password', 'db', 'dbcstg', 'port']; +foreach ($mockedVarConstants as $mockedVarConstant) { + if (!defined($mockedVarConstant)) { + define($mockedVarConstant, ''); + } +} + // Disable warnings for PEAR. error_reporting(E_ALL & ~E_STRICT); diff --git a/www/class/centreonRestHttp.class.php b/www/class/centreonRestHttp.class.php index 3bc7a2e2c46..080b5b94445 100644 --- a/www/class/centreonRestHttp.class.php +++ b/www/class/centreonRestHttp.class.php @@ -15,7 +15,6 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . "/../../config/centreon.config.php"); require_once _CENTREON_PATH_ . "/www/class/centreonDB.class.php"; require_once _CENTREON_PATH_ . '/www/api/exceptions.php'; require_once _CENTREON_PATH_ . "/www/class/centreonLog.class.php"; @@ -133,6 +132,13 @@ public function call($url, $method = 'GET', $data = null, $headers = array(), $t $decodedContent = ''; if ($result) { $decodedContent = json_decode($result, true); + + // if it is not possible to parse json, then result is probably a string + if (!is_array($decodedContent) && is_string($result)) { + $decodedContent = [ + 'message' => $result + ]; + } } /* Manage HTTP status code */ @@ -182,7 +188,7 @@ public function call($url, $method = 'GET', $data = null, $headers = array(), $t /* Return the content */ return $decodedContent; } - + /** * * @param type $url diff --git a/www/front_src/src/axios/remote.js b/www/front_src/src/axios/remote.js deleted file mode 100755 index 469bb3b514c..00000000000 --- a/www/front_src/src/axios/remote.js +++ /dev/null @@ -1,7 +0,0 @@ -import axios from "axios"; - -export default url => { - return axios.create({ - baseURL: url - }); -}; diff --git a/www/front_src/src/components/wizardFormInstallingStatus/index.js b/www/front_src/src/components/wizardFormInstallingStatus/index.js index bfdc6470589..153b2514bd0 100755 --- a/www/front_src/src/components/wizardFormInstallingStatus/index.js +++ b/www/front_src/src/components/wizardFormInstallingStatus/index.js @@ -15,7 +15,9 @@ export default ({

{formTitle}

- + {!error && // display loader until tasks are finished or error is displayed + + }

{" "} axios("internal.php?object=centreon_task_service&action=getTaskStatus"); - getImportTask = () => { - const { pollerData } = this.props; + /** + * axios call to get task status on remote server + */ + getImportTask = () => axios("internal.php?object=centreon_task_service&action=getRemoteTaskStatusByParent"); - return axiosRemote( - "http://" + pollerData.server_ip + "/" + pollerData.centreon_folder + "/internal.php?object=centreon_task_service&action=getTaskStatusByParent" + componentDidMount = () => { + this.setGenerationTimeout(); + }; + + /** + * check export files generation step each second (30 tries) + */ + setGenerationTimeout = () => { + if (this.remainingGenerationTimeout > 0) { + this.remainingGenerationTimeout--; + this.generationTimeout = setTimeout( + this.refreshGeneration, + 1000 + ); + } else { + // display timeout error message + this.setState( + { + generateStatus: false, + error: 'Export generation timeout' + } ); + } }; - UNSAFE_componentWillMount = () => { - this._setGenerationInterval(); + /** + * check remote server processing step each second (30 tries) + */ + setProcessingTimeout = () => { + if (this.remainingProcessingTimeout > 0) { + this.remainingProcessingTimeout--; + this.processingTimeout = setTimeout( + this.refreshProcession, + 1000 + ); + } else { + // display timeout error message + this.setState( + { + processingStatus: false, + error: 'Remote server processing timeout' + } + ); + } }; - _setGenerationInterval = () => { - this.generationInterval = setInterval( - this.refreshGeneration, - 1000 - ) + /** + * check files generation on central server + */ + refreshGeneration = () => { + const { taskId } = this.props.pollerData; + + this.getExportTask() + .post("", {"task_id": taskId}) + .then(response => { + if (response.data.success !== true) { + this.setState( + { + generateStatus: false, + error: JSON.stringify(response.data) + } + ); + } else if (response.data.status === 'completed') { + // when export files is done, check remote server processing + this.setState( + { generateStatus: true }, + () => { this.setProcessingTimeout(); } + ); + } else { // retry if task is not yet completed + this.setGenerationTimeout() + } + }) + .catch(err => { + this.setState( + { + generateStatus: false, + error: JSON.stringify(err.response.data) + } + ); + }); }; - _setProcessingInterval = () => { - this.processingInterval = setInterval( - this.refreshProcession, - 1000 + /** + * check endpoint on remote server to get import status + */ + refreshProcession = () => { + const { history } = this.props; + const { server_ip, centreon_folder, taskId } = this.props.pollerData; + + this.getImportTask() + .post( + "", + { + "server_ip": server_ip, + "centreon_folder": centreon_folder, + "parent_id": taskId + } ) + .then(response => { + if (response.data.success !== true) { + this.setState( + { + generateStatus: false, + error: JSON.stringify(response.data) + } + ); + } else if (response.data.status === 'completed') { + // when remote server processing is done, redirect to poller list page with 2 seconds delay + this.setState( + { processingStatus: true }, + () => { + setTimeout( + () => { history.push(routeMap.pollerList) }, + 2000 + ) + } + ); + } else { // retry if task is not yet completed + this.setProcessingTimeout() + } + }) + .catch(err => { + this.setState( + { + processingStatus: false, + error: JSON.stringify(err.response.data) + } + ); + }); }; - refreshProcession = () => { - const {history, pollerData} = this.props; - - this.getImportTask - .post("", {"parent_id":pollerData.task_id}) - .then(response => { - if (response.data.finished === true){ - clearInterval(this.processingInterval); - this.setState({ - processingStatus:response.data.success - }, () => { - history.push(routeMap.pollerList) - }); - } - }) - .catch(err => { - this.setState({ processingStatus: false }); - }); - - }; - - refreshGeneration = () => { - const {pollerData} = this.props; - this.getExportTask - .post("", {"task_id":pollerData.taskId}) - .then(response => { - if (response.data.finished == true){ - clearInterval(this.generationInterval); - this._setProcessingInterval(); - this.setState({ - generateStatus:response.data.success - }); - } - }) - .catch(err => { - this.setState({ generateStatus: false }); - }); - }; - - render() { + render() { const { links } = this, { pollerData } = this.props, - { generateStatus, processingStatus } = this.state; + { generateStatus, processingStatus, error } = this.state; return (

@@ -110,6 +184,7 @@ class RemoteServerStepThreeRoute extends Component { statusGenerating={generateStatus} statusProcessing={processingStatus} formTitle={I18n.t("Finalizing Setup") + ":"} + error={error} />
); diff --git a/www/front_src/src/styles/partials/form/_form.scss b/www/front_src/src/styles/partials/form/_form.scss index 85b7a851e11..8b290a04285 100755 --- a/www/front_src/src/styles/partials/form/_form.scss +++ b/www/front_src/src/styles/partials/form/_form.scss @@ -46,6 +46,7 @@ } } &-error-message { + font-size: 12px; color: #d0021b; display: block; text-align: center; @@ -78,12 +79,12 @@ } &-title { font-size: 12px; - font-family: $primary-font-medium; + font-family: $primary-font-light; color: $lightblue-centreon-primary; } &-text { - font-size: 10px; - font-family: $primary-font-light; + font-size: 12px; + font-family: $primary-font-regular; color: #242f3a; margin: 20px 0; } diff --git a/www/install/step_upgrade/step5.php b/www/install/step_upgrade/step5.php index 0621b992a3d..7d1090611ec 100644 --- a/www/install/step_upgrade/step5.php +++ b/www/install/step_upgrade/step5.php @@ -110,7 +110,7 @@ function validation() { url: './step_upgrade/process/process_step5.php', data: jQuery('input[name="send_statistics"]').serialize() }).success(function () { - javascript:self.location = "../main.php" + javascript:self.location = "../index.php" }) } diff --git a/www/install/steps/templates/step9.tpl b/www/install/steps/templates/step9.tpl index 8ce543e11ad..2fbe26f284b 100644 --- a/www/install/steps/templates/step9.tpl +++ b/www/install/steps/templates/step9.tpl @@ -47,7 +47,7 @@ }).success(function (data) { var data = JSON.parse(data); if (data.result) { - javascript:self.location = "../main.php"; + javascript:self.location = "../index.php"; } }); }