/** * Generate modules configuration files * @param array $filesList * @param int $pollerId * @param string $path * @param object $event * @return value */ public function generate(&$filesList, $pollerId, $path, $event) { $di = Di::getDefault(); /* Get Database Connexion */ $dbconn = $di->get('db_centreon'); $modules = array(); /* Retrieve broker modules */ $events = Di::getDefault()->get('events'); $moduleEvent = new BrokerModuleEvent($pollerId); $events->emit('centreon-configuration.broker.module', array($moduleEvent)); $brokerModules = $moduleEvent->getModules(); foreach ($brokerModules as $brokerModule) { $modules[]['broker_module'] = $brokerModule; } /* External command module */ $moduleDir = Engine::getParameters($pollerId, 'module_dir'); $modules[]['broker_module'] = rtrim($moduleDir['module_dir'], '/') . '/externalcmd.so'; /* Write modules configuration files */ foreach ($modules as $module) { $filename = preg_match('/\\/?(\\w+)\\.so/', $module['broker_module'], $matches); if (!empty($matches[1])) { WriteConfigFile::writeParamsFile($module, $path . $pollerId . "/conf.d/" . $matches[1] . '.cfg', $filesList, $user = "******"); } } }
/** * @param Core\Events\LoadFormDatas $event */ public static function execute(LoadFormDatasEvent $event) { $route = $event->getRoute(); $objectId = $event->getObjectId(); $parameters = $event->getParameters(); if ($route === '/centreon-configuration/poller/update') { try { $engineParameters = Engine::getParameters($objectId, "*"); $engineCompleteParameters = array(); foreach ($engineParameters as $key => $value) { $engineCompleteParameters['centreon-engine__' . $key] = $value; } $event->addParameters($engineCompleteParameters); } catch (\Exception $e) { } } }