本文整理汇总了C++中Collector::readConfig方法的典型用法代码示例。如果您正苦于以下问题:C++ Collector::readConfig方法的具体用法?C++ Collector::readConfig怎么用?C++ Collector::readConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collector
的用法示例。
在下文中一共展示了Collector::readConfig方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run_collector
/**
* Function that inits and runs the collector
* @param config_file Destination of the collectors configuration file
*/
int run_collector(const std::string& configFile)
{
Collector collector;
/* read the configuration */
try {
collector.readConfig(configFile);
}catch (exceptions::ConfigError e) {
msg(MSG_FATAL, "Couldn't configure collector: %s", e.what());
return error_states::CONFIG_ERROR;
}
/* start the detection modules */
try {
collector.startModules();
}catch (exceptions::DetectionModuleError e) {
msg(MSG_FATAL, "Couldn't start detection modules: %s", e.what());
return error_states::DETECTION_MODULE_ERROR;
}
/* wait for detection modules to do their initialisation work */
msg(MSG_INFO, "Waiting for detection modules to init their stuff....");
sleep(2);
msg(MSG_INFO, "Starting up collector...");
try {
collector.run();
} catch (std::exception e) {
msg(MSG_FATAL, "Error while running the collector: %s", e.what());
return error_states::RUN_ERROR;
}
msg(MSG_DEBUG, "Leaving run_collector()");
return 0;
}