Changeset f7a074d in nscp
- Timestamp:
- 11/06/11 22:04:48 (19 months ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2
- Children:
- 0d9eed6
- Parents:
- 58f0e80
- Files:
-
- 1 added
- 34 edited
-
files/old-settings.map (modified) (1 diff)
-
helpers/installers/installer/Product.wxs (modified) (5 diffs)
-
include/NSCAPI.h (modified) (1 diff)
-
include/client/command_line_parser.cpp (modified) (1 diff)
-
include/nrpe/packet.hpp (modified) (1 diff)
-
include/nrpe/server/connection.cpp (modified) (1 diff)
-
include/nsca/nsca_packet.hpp (modified) (2 diffs)
-
include/nsca/nsca_socket.hpp (modified) (1 diff)
-
include/nscapi/functions.hpp (modified) (5 diffs)
-
include/nscapi/nscapi_core_wrapper.cpp (modified) (2 diffs)
-
include/nscapi/nscapi_core_wrapper.hpp (modified) (3 diffs)
-
include/nscapi/settings_proxy.hpp (modified) (1 diff)
-
include/settings/client/settings_client.cpp (modified) (1 diff)
-
include/settings/client/settings_client.hpp (modified) (4 diffs)
-
include/settings/settings_old.hpp (modified) (2 diffs)
-
modules/CheckSystem/CheckSystem.cpp (modified) (4 diffs)
-
modules/NRPEClient/NRPEClient.cpp (modified) (1 diff)
-
modules/NRPEServer/handler_impl.hpp (modified) (1 diff)
-
modules/NSCAClient/NSCAClient.cpp (modified) (8 diffs)
-
modules/NSCAClient/NSCAClient.h (modified) (3 diffs)
-
modules/PythonScript/PythonScript.cpp (modified) (3 diffs)
-
modules/PythonScript/script_wrapper.cpp (modified) (2 diffs)
-
modules/PythonScript/script_wrapper.hpp (modified) (3 diffs)
-
modules/Scheduler/Scheduler.cpp (modified) (2 diffs)
-
scripts/python/lib/test_helper.py (modified) (2 diffs)
-
scripts/python/test_eventlog.py (modified) (3 diffs)
-
scripts/python/test_nsca.py (modified) (11 diffs)
-
scripts/python/test_sample.py (added)
-
service/NSCPlugin.h (modified) (1 diff)
-
service/NSClient++.cpp (modified) (4 diffs)
-
service/core_api.cpp (modified) (2 diffs)
-
service/core_api.h (modified) (1 diff)
-
service/logger.hpp (modified) (1 diff)
-
version.hpp (modified) (1 diff)
-
version.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
files/old-settings.map
rfb7e36a rf7a074d 12 12 modules/CheckNSCP.dll=/modules/CheckNSCP 13 13 modules/CheckExternalScripts.dll=/modules/CheckExternalScripts 14 modules/NSCAAgent.dll=/modules/NSCA Agent14 modules/NSCAAgent.dll=/modules/NSCAClient 15 15 modules/NSCAAgent.dll=/modules/Scheduler 16 16 modules/LUAScript.dll=/modules/LUAScript -
helpers/installers/installer/Product.wxs
ra78a985 rf7a074d 118 118 </Component> 119 119 <Component Id="NSCA" Guid="8820A304-C596-4393-A72F-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 120 <File Id="NSCAAgentDLL" Name="NSCAAgent.dll" DiskId="1" Source="$(var.Source)/modules/NSCAAgent.dll" Vital="no" /> 120 <File Id="NSCAClientDLL" Name="NSCAClient.dll" DiskId="1" Source="$(var.Source)/modules/NSCAClient.dll" Vital="no" /> 121 <File Id="NSCAServerDLL" Name="NSCAServer.dll" DiskId="1" Source="$(var.Source)/modules/NSCAServer.dll" Vital="no" /> 121 122 <File Id="SchedulerDLL" Name="Scheduler.dll" DiskId="1" Source="$(var.Source)/modules/Scheduler.dll" Vital="no" /> 123 </Component> 124 <Component Id="NSCP" Guid="B185B8F1-3718-4e8e-ADA4-38049A0721EA" Win64="$(var.Win64)"> 125 <File Id="NSCPClientDLL" Name="NSCPClient.dll" DiskId="1" Source="$(var.Source)/modules/NSCPClient.dll" Vital="no" /> 126 <File Id="NSCPServerDLL" Name="NSCPServer.dll" DiskId="1" Source="$(var.Source)/modules/NSCPServer.dll" Vital="no" /> 122 127 </Component> 123 128 <Component Id="PythonScript" Guid="8820A304-C696-4393-A72F-$(var.Postfix.GUID)" Win64="$(var.Win64)"> … … 125 130 </Component> 126 131 <Component Id="Plugins" Guid="9B490E67-5472-4266-96DC-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 127 <!-- NOT PORTED MODULES !128 <File Id="ModRemoteConfiguration.dll" Name="RmtCfg.dll" LongName="RemoteConfiguration.dll" DiskId="1" Source="$(var.Source)/modules/RemoteConfiguration.dll" Vital="no" />129 <File Id="ModSysTray.dll" Name="SysTray.dll" LongName="SysTray.dll" DiskId="1" Source="$(var.Source)/modules/SysTray.dll" Vital="no" />130 <File Id="A_DebugLogMetrics.dll" Name="ADebug.dll" LongName="A_DebugLogMetrics.dll" DiskId="1" Source="$(var.Source)/modules/A_DebugLogMetrics.dll" Vital="no" />131 -->132 132 <File Id="ModCheckEventLog.dll" Name="CheckEventLog.dll" DiskId="1" Source="$(var.Source)/modules/CheckEventLog.dll" Vital="no" /> 133 133 <File Id="ModCheckExternalScripts.dll" Name="CheckExternalScripts.dll" DiskId="1" Source="$(var.Source)/modules/CheckExternalScripts.dll" Vital="no" /> … … 147 147 <File Id="script001" Name="check_60s.bat" DiskId="1" Source="$(var.Source)/scripts/check_60s.bat" Vital="no" /> 148 148 <File Id="script002" Name="check_battery.vbs" DiskId="1" Source="$(var.Source)/scripts/check_battery.vbs" Vital="no" /> 149 <File Id="script003" Name="check_ no_rdp.bat" DiskId="1" Source="$(var.Source)/scripts/check_no_rdp.bat" Vital="no" />150 <File Id="script004" Name="check_ printer.vbs" DiskId="1" Source="$(var.Source)/scripts/check_printer.vbs" Vital="no" />151 <File Id="script005" Name="check_ ok.bat" DiskId="1" Source="$(var.Source)/scripts/check_ok.bat" Vital="no" />152 <File Id="script006" Name="check_ files.vbs" DiskId="1" Source="$(var.Source)/scripts/check_files.vbs" Vital="no" />149 <File Id="script003" Name="check_files.vbs" DiskId="1" Source="$(var.Source)/scripts/check_files.vbs" Vital="no" /> 150 <File Id="script004" Name="check_no_rdp.bat" DiskId="1" Source="$(var.Source)/scripts/check_no_rdp.bat" Vital="no" /> 151 <File Id="script005" Name="check_printer.vbs" DiskId="1" Source="$(var.Source)/scripts/check_printer.vbs" Vital="no" /> 152 <File Id="script006" Name="check_ok.bat" DiskId="1" Source="$(var.Source)/scripts/check_ok.bat" Vital="no" /> 153 153 <File Id="script007" Name="check_ping.bat" DiskId="1" Source="$(var.Source)/scripts/check_ping.bat" Vital="no" /> 154 154 <File Id="script008" Name="check_updates.vbs" DiskId="1" Source="$(var.Source)/scripts/check_updates.vbs" Vital="no" /> 155 <File Id="sample00 2" Name="check_test.ps1" DiskId="1" Source="$(var.Source)/scripts/check_test.ps1" Vital="no" />156 <File Id="sample00 3" Name="check_test.vbs" DiskId="1" Source="$(var.Source)/scripts/check_test.vbs" Vital="no" />155 <File Id="sample001" Name="check_test.ps1" DiskId="1" Source="$(var.Source)/scripts/check_test.ps1" Vital="no" /> 156 <File Id="sample002" Name="check_test.vbs" DiskId="1" Source="$(var.Source)/scripts/check_test.vbs" Vital="no" /> 157 157 <!-- 158 158 Scripts missing 159 <File Id="sample003" Name="check_test.bat" DiskId="1" Source="$(var.Source)/scripts/check_test.bat" Vital="no" /> 159 160 <File Id="lua001" Name="test.lua" LongName="test.lua" DiskId="1" Source="$(var.Source)/scripts/test.lua" Vital="no" /> 160 161 --> … … 168 169 <Directory Id="INSTALLLOCATION_SCRIPTS_PYTHON" Name="python"> 169 170 <Component Id="PythonScripts" Guid="8820A304-C697-4393-A72F-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 170 <File Id="P_script_001" Name="test.py" DiskId="1" Source="$(var.Source)/scripts/python/test.py" Vital="no" /> 171 <File Id="P_script_002" Name="test_pb.py" DiskId="1" Source="$(var.Source)/scripts/python/test_pb.py" Vital="no" /> 171 <File Id="P_script_001" Name="test_eventlog.py" DiskId="1" Source="$(var.Source)/scripts/python/test_eventlog.py" Vital="no" /> 172 <File Id="P_script_002" Name="test_nsca.py" DiskId="1" Source="$(var.Source)/scripts/python/test_nsca.py" Vital="no" /> 173 <File Id="P_script_003" Name="test_pb.py" DiskId="1" Source="$(var.Source)/scripts/python/test_pb.py" Vital="no" /> 174 <File Id="P_script_004" Name="test_sample.py" DiskId="1" Source="$(var.Source)/scripts/python/test_sample.py" Vital="no" /> 172 175 </Component> 173 176 </Directory> … … 253 256 <ComponentRef Id="NSCA" /> 254 257 </Feature> 258 <Feature Id="NSCPPlugin" Title="NSCP plugin (experimental)" Description="Plugin to submit passive results to an NSCP server" Level="1" Absent="disallow"> 259 <ComponentRef Id="NSCP" /> 260 </Feature> 255 261 <Feature Id="PythonScript" Title="Python Scripting" Description="Python scripting requires python to be installed)" Level="1" Absent="disallow"> 256 262 <ComponentRef Id="PythonScript" /> -
include/NSCAPI.h
r98113da rf7a074d 144 144 typedef NSCAPI::errorReturn (*lpNSAPIGetSettingsBool)(const wchar_t*, const wchar_t*, int); 145 145 typedef NSCAPI::errorReturn (*lpNSAPIGetSettingsSection)(const wchar_t*, wchar_t***, unsigned int *); 146 typedef NSCAPI::errorReturn (*lpNSAPIGetSettingsSections)(const wchar_t*, wchar_t***, unsigned int *); 146 147 typedef NSCAPI::errorReturn (*lpNSAPIReleaseSettingsSectionBuffer)(wchar_t***, unsigned int *); 147 148 typedef void (*lpNSAPIMessage)(const char*, unsigned int); -
include/client/command_line_parser.cpp
r98113da rf7a074d 246 246 nscapi::functions::destination_container myself = config.data->host_self; 247 247 if (!header->has_recipient_id()) { 248 if (recipient.id.empty()) 249 recipient.id = "TODO missing id"; 248 250 nscapi::functions::add_host(header, recipient); 249 251 header->set_recipient_id(recipient.id); -
include/nrpe/packet.hpp
r294b37b rf7a074d 73 73 }; 74 74 75 class nrpe_exception { 76 std::wstring error_; 77 public: 78 nrpe_exception(std::wstring error) : error_(error) {} 79 std::wstring getMessage() { 80 return error_; 75 class nrpe_exception : public std::exception { 76 std::string error_; 77 public: 78 nrpe_exception(std::wstring error) : error_(utf8::cvt<std::string>(error)) {} 79 nrpe_exception(std::string error) : error_(utf8::cvt<std::string>(error)) {} 80 ~nrpe_exception() throw() {} 81 const char* what() const throw() { 82 return error_.c_str(); 83 } 84 const std::wstring wwhat() const throw() { 85 return utf8::cvt<std::wstring>(error_); 81 86 } 82 87 }; -
include/nrpe/server/connection.cpp
rc391984 rf7a074d 75 75 nrpe::packet request = parser_.parse(); 76 76 response = handler_->handle(request); 77 } catch (nrpe::nrpe_packet_exception &e) { 78 response = handler_->create_error(e.getMessage()); 77 } catch (const nrpe::nrpe_packet_exception &e) { 78 response = handler_->create_error(e.wwhat()); 79 } catch (const nrpe::nrpe_exception &e) { 80 response = handler_->create_error(e.wwhat()); 81 } catch (const std::exception &e) { 82 response = handler_->create_error(_T("Error handling NRPE packet: ") + utf8::cvt<std::wstring>(e.what())); 79 83 } catch (...) { 80 response = handler_->create_error(_T("Unknown error handling packet"));84 response = handler_->create_error(_T("Unknown error handling NRPE packet")); 81 85 } 82 86 -
include/nsca/nsca_packet.hpp
ra629015 rf7a074d 140 140 141 141 void parse_data(const char* buffer, unsigned int buffer_len) { 142 const nsca::data::data_packet *data = reinterpret_cast<const nsca::data::data_packet*>(buffer); 142 char *tmp = new char[buffer_len]; 143 memcpy(tmp, buffer, buffer_len); 144 nsca::data::data_packet *data = reinterpret_cast<nsca::data::data_packet*>(tmp); 143 145 //packet_version=swap_bytes::ntoh<int16_t>(data->packet_version); 144 146 time=swap_bytes::ntoh<u_int32_t>(data->timestamp); … … 150 152 result= data->get_result_ptr(nsca::length::host_length, nsca::length::desc_length); 151 153 154 unsigned int crc32 = swap_bytes::ntoh<u_int32_t>(data->crc32_value); 155 data->crc32_value = 0; 156 unsigned int calculated_crc32=calculate_crc32(tmp, buffer_len); 157 delete [] tmp; 158 if (crc32 != calculated_crc32) 159 throw nsca::nsca_exception(_T("Invalid crc: ") + strEx::itos(crc32) + _T(" != ") + strEx::itos(calculated_crc32)); 152 160 } 153 161 -
include/nsca/nsca_socket.hpp
r9b9be81 rf7a074d 74 74 std::vector<char> buf(len); 75 75 if (!read_with_timeout(buf, timeout)) { 76 NSC_LOG_ERROR_STD(_T("Failed to read IV from server ."));76 NSC_LOG_ERROR_STD(_T("Failed to read IV from server (using ") + strEx::itos(encryption_method) + _T(", ") + strEx::itos(len) + _T(").")); 77 77 return false; 78 78 } -
include/nscapi/functions.hpp
r98113da rf7a074d 180 180 if (!dst.host.empty()) 181 181 host->set_host(dst.host); 182 if (!dst.address.empty()) 183 host->set_address(dst.address); 182 184 if (!dst.protocol.empty()) 183 185 host->set_protocol(dst.protocol); … … 199 201 if (host.id() == tag) { 200 202 data.id = tag; 201 data.host = host.host(); 202 data.address = host.address(); 203 data.protocol = host.protocol(); 204 data.comment = host.comment(); 203 if (!host.host().empty()) 204 data.host = host.host(); 205 if (!host.address().empty()) 206 data.address = host.address(); 207 if (!host.protocol().empty()) 208 data.protocol = host.protocol(); 209 if (!host.comment().empty()) 210 data.comment = host.comment(); 205 211 if (expand_meta) { 206 212 for(int j=0;j<host.tags_size(); ++j) { … … 219 225 ////////////////////////////////////////////////////////////////////////// 220 226 227 static void make_submit_from_query(std::string &message, const std::wstring channel, const std::wstring alias = _T("")) { 228 Plugin::QueryResponseMessage response; 229 response.ParseFromString(message); 230 Plugin::SubmitRequestMessage request; 231 request.mutable_header()->CopyFrom(response.header()); 232 request.set_channel(to_string(channel)); 233 for (int i=0;i<response.payload_size();++i) { 234 request.add_payload()->CopyFrom(response.payload(i)); 235 if (!alias.empty()) 236 request.mutable_payload(i)->set_alias(to_string(alias)); 237 } 238 message = request.SerializeAsString(); 239 } 240 221 241 static void create_simple_query_request(std::wstring command, std::vector<std::wstring> arguments, std::string &buffer) { 222 242 Plugin::QueryRequestMessage message; … … 271 291 return gbp_to_nagios_status(payload.result()); 272 292 } 273 static NSCAPI::errorReturn parse_simple_submit_request_payload(const Plugin::QueryResponseMessage::Response &payload, std::wstring &command, std::wstring &msg, std::wstring &perf) { 293 static NSCAPI::errorReturn parse_simple_submit_request_payload(const Plugin::QueryResponseMessage::Response &payload, std::wstring &alias, std::wstring &command, std::wstring &msg, std::wstring &perf) { 294 alias = utf8::cvt<std::wstring>(payload.alias()); 274 295 command = utf8::cvt<std::wstring>(payload.command()); 275 296 msg = utf8::cvt<std::wstring>(payload.message()); … … 361 382 } 362 383 363 static int parse_simple_query_response( std::string &response, std::wstring &msg, std::wstring &perf) {384 static int parse_simple_query_response(const std::string &response, std::wstring &msg, std::wstring &perf) { 364 385 Plugin::QueryResponseMessage message; 365 386 message.ParseFromString(response); -
include/nscapi/nscapi_core_wrapper.cpp
r98113da rf7a074d 370 370 return ret; 371 371 } 372 std::list<std::wstring> nscapi::core_wrapper::getSettingsSections(std::wstring section) { 373 if (!fNSAPIGetSettingsSections) 374 throw nscapi::nscapi_exception(_T("NSCore has not been initiated...")); 375 array_buffer::arrayBuffer aBuffer = NULL; 376 unsigned int argLen = 0; 377 if (fNSAPIGetSettingsSections(section.c_str(), &aBuffer, &argLen) != NSCAPI::isSuccess) { 378 throw nscapi::nscapi_exception(_T("Settings could not be retrieved.")); 379 } 380 std::list<std::wstring> ret = array_buffer::arrayBuffer2list(argLen, aBuffer); 381 if (fNSAPIReleaseSettingsSectionBuffer(&aBuffer, &argLen) != NSCAPI::isSuccess) { 382 throw nscapi::nscapi_exception(_T("Settings could not be destroyed.")); 383 } 384 if (aBuffer != NULL) 385 throw nscapi::nscapi_exception(_T("buffer is not null?.")); 386 return ret; 387 } 372 388 /** 373 389 * Retrieve an int from the settings subsystem (INI-file) … … 639 655 fNSAPIGetSettingsString = (nscapi::core_api::lpNSAPIGetSettingsString)f(_T("NSAPIGetSettingsString")); 640 656 fNSAPIGetSettingsSection = (nscapi::core_api::lpNSAPIGetSettingsSection)f(_T("NSAPIGetSettingsSection")); 657 fNSAPIGetSettingsSections = (nscapi::core_api::lpNSAPIGetSettingsSections)f(_T("NSAPIGetSettingsSections")); 641 658 fNSAPIReleaseSettingsSectionBuffer = (nscapi::core_api::lpNSAPIReleaseSettingsSectionBuffer)f(_T("NSAPIReleaseSettingsSectionBuffer")); 642 659 fNSAPIMessage = (nscapi::core_api::lpNSAPIMessage)f(_T("NSAPIMessage")); -
include/nscapi/nscapi_core_wrapper.hpp
r98113da rf7a074d 40 40 nscapi::core_api::lpNSAPIGetApplicationVersionStr fNSAPIGetApplicationVersionStr; 41 41 nscapi::core_api::lpNSAPIGetSettingsSection fNSAPIGetSettingsSection; 42 nscapi::core_api::lpNSAPIGetSettingsSections fNSAPIGetSettingsSections; 42 43 nscapi::core_api::lpNSAPIReleaseSettingsSectionBuffer fNSAPIReleaseSettingsSectionBuffer; 43 44 nscapi::core_api::lpNSAPIGetSettingsString fNSAPIGetSettingsString; … … 88 89 , fNSAPIGetApplicationVersionStr(NULL) 89 90 , fNSAPIGetSettingsSection(NULL) 91 , fNSAPIGetSettingsSections(NULL) 90 92 , fNSAPIReleaseSettingsSectionBuffer(NULL) 91 93 , fNSAPIGetSettingsString(NULL) … … 122 124 std::wstring getApplicationVersionString(void); 123 125 std::list<std::wstring> getSettingsSection(std::wstring section); 126 std::list<std::wstring> getSettingsSections(std::wstring section); 124 127 std::wstring getSettingsString(std::wstring section, std::wstring key, std::wstring defaultValue); 125 128 std::wstring expand_path(std::wstring value); -
include/nscapi/settings_proxy.hpp
rd66ccee rf7a074d 42 42 43 43 virtual string_list get_sections(std::wstring path) { 44 return core_->getSettingsSection (path);44 return core_->getSettingsSections(path); 45 45 } 46 46 virtual string_list get_keys(std::wstring path) { -
include/settings/client/settings_client.cpp
r3bdaf18 rf7a074d 4 4 namespace nscapi { 5 5 namespace settings_helper { 6 7 6 /* 7 template<typename T> 8 typed_key_entry_in_vector<std::wstring, T, typed_string_value<std::wstring> >* wstring_vector_key(T *val, typename T::key_type key, std::wstring def) { 9 typed_key_entry_in_vector<std::wstring, T, typed_string_value<std::wstring> >* r = new typed_key_entry_in_vector<std::wstring, T, typed_string_value<std::wstring> >(val, key, def); 10 return r; 11 } 12 */ 8 13 wstring_key_type* wstring_key(std::wstring *val, std::wstring def) { 9 14 wstring_key_type* r = new wstring_key_type(val, def); -
include/settings/client/settings_client.hpp
r9b9be81 rf7a074d 140 140 }; 141 141 142 template<class T, class V, class TBase> 143 class typed_key_entry_in_vector : public TBase { 144 public: 145 typed_key_entry_in_vector(V* store_to, typename V::key_type key, const T& v) : TBase(v), store_to_(store_to), key_(key) {} 146 147 virtual void update_target(T *value) const { 148 if (store_to_) 149 (*store_to_)[key_] = *value; 150 } 151 protected: 152 V* store_to_; 153 typename V::key_type key_; 154 }; 155 142 156 template<class T, class TBase> 143 157 class typed_key_fun : public TBase { … … 152 166 }; 153 167 168 template<typename T> 169 typed_key_entry_in_vector<std::wstring, T, typed_string_value<std::wstring> >* wstring_vector_key(T *val, typename T::key_type key, std::wstring def) { 170 typed_key_entry_in_vector<std::wstring, T, typed_string_value<std::wstring> >* r = new typed_key_entry_in_vector<std::wstring, T, typed_string_value<std::wstring> >(val, key, def); 171 return r; 172 } 154 173 155 174 typedef typed_key_value<std::wstring, typed_string_value<std::wstring> > wstring_key_type; … … 160 179 typedef typed_key_value<bool, typed_bool_value<bool> > bool_key_type; 161 180 181 /* 182 template<typename T> 183 typed_key_entry_in_vector<std::wstring, T, typed_string_value<std::wstring> >* wstring_vector_key(T *val, typename T::key_type key, std::wstring def); 184 */ 162 185 wstring_key_type* wstring_key(std::wstring *val, std::wstring def = _T("")); 163 186 string_key_type* string_key(std::string *val, std::string def = ""); … … 232 255 std::wstring val = core_->get_string(path, key, _T("")); 233 256 callback_(key, val); 257 } 258 list = core_->get_sections(path); 259 BOOST_FOREACH(std::wstring key, list) { 260 callback_(key, _T("")); 234 261 } 235 262 } -
include/settings/settings_old.hpp
r65a2940 rf7a074d 386 386 } 387 387 // @todo: this will NOT work for "nodes in paths" 388 std::set<std::wstring> ignore_list; 388 389 BOOST_FOREACH(settings_map::keys_key_type key, map.keys_) { 389 390 if (key.first.first == path) { 390 391 if (has_key_int(key.second.first, key.second.second)) { 391 392 list.push_back(key.first.second); 393 ignore_list.insert(key.second.first + _T("/") + key.second.second); 392 394 } 393 395 } … … 402 404 it = section_cache_.find(path); 403 405 } 404 list.insert(list.end(), (*it).second.begin(), (*it).second.end()); 406 BOOST_FOREACH(std::wstring k, (*it).second) { 407 std::set<std::wstring>::const_iterator cit = ignore_list.find(key.second + _T("/") + k); 408 if (cit == ignore_list.end()) 409 list.push_back(k); 410 } 411 //list.insert(list.end(), (*it).second.begin(), (*it).second.end()); 405 412 } 406 413 } -
modules/CheckSystem/CheckSystem.cpp
ra78a985 rf7a074d 74 74 try { 75 75 typedef std::map<std::wstring,std::wstring> counter_map_type; 76 std::map<std::wstring,std::wstring> service_mappings;77 76 std::map<std::wstring,std::wstring> counters; 78 77 bool default_counters = true; … … 84 83 (_T("WINDOWS CHECK SYSTEM"), _T("Section for system checks and system settings")) 85 84 86 (_T("service mapping"), sh::wstring_map_path(&service_mappings) 87 , _T("SERVICE MAPPING SECTION"), _T("")) 85 (_T("service mapping"), _T("SERVICE MAPPING SECTION"), _T("Confiure which services has to be in which state")) 88 86 89 87 (_T("pdh"), _T("PDH COUNTER INFORMATION"), _T("")) … … 91 89 (_T("pdh/counters"), sh::wstring_map_path(&counters) 92 90 , _T("PDH COUNTERS"), _T("")) 91 93 92 94 93 ; … … 116 115 ; 117 116 117 //std::map<DWORD,std::wstring>::key_type 118 119 settings.alias().add_key_to_settings() 120 121 (_T("BOOT_START"), sh::wstring_vector_key(&lookups_, SERVICE_BOOT_START, _T("ignored")), 122 _T("SERVICE_BOOT_START"), _T("TODO")) 123 124 (_T("SYSTEM_START"), sh::wstring_vector_key(&lookups_, SERVICE_SYSTEM_START, _T("ignored")), 125 _T("SERVICE_SYSTEM_START"), _T("TODO")) 126 127 (_T("AUTO_START"), sh::wstring_vector_key(&lookups_, SERVICE_AUTO_START, _T("started")), 128 _T("SERVICE_AUTO_START"), _T("TODO")) 129 130 (_T("DEMAND_START"), sh::wstring_vector_key(&lookups_, SERVICE_DEMAND_START, _T("ignored")), 131 _T("SERVICE_DEMAND_START"), _T("TODO")) 132 133 (_T("DISABLED"), sh::wstring_vector_key(&lookups_, SERVICE_DISABLED, _T("stopped")), 134 _T("SERVICE_DISABLED"), _T("TODO")) 135 136 (_T("DELAYED"), sh::wstring_vector_key(&lookups_, NSCP_SERVICE_DELAYED, _T("ignored")), 137 _T("SERVICE_DELAYED"), _T("TODO")) 138 139 ; 118 140 119 141 settings.register_all(); 120 142 settings.notify(); 121 122 lookups_[SERVICE_BOOT_START] = service_mappings[_T("BOOT_START")];123 lookups_[SERVICE_SYSTEM_START] = service_mappings[_T("SYSTEM_START")];124 lookups_[SERVICE_AUTO_START] = service_mappings[_T("AUTO_START")];125 lookups_[SERVICE_DEMAND_START] = service_mappings[_T("DEMAND_START")];126 lookups_[SERVICE_DISABLED] = service_mappings[_T("DISABLED")];127 lookups_[NSCP_SERVICE_DELAYED] = service_mappings[_T("DELAYED")];128 143 129 144 typedef PDHCollector::system_counter_data::counter cnt; -
modules/NRPEClient/NRPEClient.cpp
ra78a985 rf7a074d 284 284 return nrpe_result_data(packet.getResult(), packet.getPayload()); 285 285 } catch (nrpe::nrpe_packet_exception &e) { 286 return nrpe_result_data(NSCAPI::returnUNKNOWN, _T("NRPE Packet errro: ") + e. getMessage());286 return nrpe_result_data(NSCAPI::returnUNKNOWN, _T("NRPE Packet errro: ") + e.wwhat()); 287 287 } catch (std::runtime_error &e) { 288 288 NSC_LOG_ERROR_STD(_T("Socket error: ") + utf8::cvt<std::wstring>(e.what())); -
modules/NRPEServer/handler_impl.hpp
rc391984 rf7a074d 23 23 24 24 nrpe::packet create_error(std::wstring msg) { 25 return nrpe::packet::create_response( 4, msg, payload_length_);25 return nrpe::packet::create_response(3, msg, payload_length_); 26 26 } 27 27 -
modules/NSCAClient/NSCAClient.cpp
r58f0e80 rf7a074d 67 67 sh::settings_registry settings(get_settings_proxy()); 68 68 settings.set_alias(_T("NSCA"), alias, _T("client")); 69 target_path = settings.alias().get_settings_path(_T("targets")); 69 70 70 71 settings.alias().add_path_to_settings() 71 72 (_T("NSCA AGENT SECTION"), _T("Section for NSCA passive check module.")) 73 74 (_T("targets"), sh::fun_values_path(boost::bind(&NSCAAgent::add_target, this, _1, _2)), 75 _T("REMOTE TARGET DEFINITIONS"), _T("")) 76 72 77 ; 73 78 … … 95 100 96 101 settings.alias().add_key_to_settings(_T("server")) 102 /* 97 103 (_T("host"), sh::wstring_key(&nscahost_), 98 104 _T("NSCA HOST"), _T("The NSCA server to report results to.")) … … 101 107 _T("NSCA PORT"), _T("The NSCA server port")) 102 108 103 (_T("encryption method"), sh:: int_key(&encryption_method_),109 (_T("encryption method"), sh::string_key(&encryption_method_), 104 110 _T("ENCRYPTION METHOD"), _T("Number corresponding to the various encryption algorithms (see the wiki). Has to be the same as the server or it wont work at all.")) 105 111 106 112 (_T("password"), sh::string_key(&password_), 107 113 _T("PASSWORD"), _T("The password to use. Again has to be the same as the server or it wont work at all.")) 114 */ 108 115 109 116 (_T("timeout"), sh::uint_key(&timeout_, 30), … … 158 165 } 159 166 167 void NSCAAgent::add_target(std::wstring key, std::wstring arg) { 168 try { 169 targets.add(get_settings_proxy(), target_path , key, arg); 170 } catch (...) { 171 NSC_LOG_ERROR_STD(_T("Failed to add target: ") + key); 172 } 173 } 160 174 void NSCAAgent::add_local_options(po::options_description &desc, nscp_connection_data &command_data) { 161 175 desc.add_options() … … 203 217 NSCAPI::nagiosReturn NSCAAgent::handleRAWNotification(const wchar_t* channel, std::string request, std::string &response) { 204 218 try { 219 205 220 client::configuration config; 221 net::wurl url; 222 url.protocol = _T("nsca"); 223 224 nscapi::target_handler::optarget target = targets.find_target(_T("default")); 225 if (target) { 226 url.host = target->host; 227 url.port = strEx::stoi(target->options[_T("port")]); 228 config.data->recipient.data["encryption"] = utf8::cvt<std::string>(target->options[_T("encryption")]); 229 config.data->recipient.data["password"] = utf8::cvt<std::string>(target->options[_T("password")]); 230 } 231 config.data->recipient.id = "default"; 232 config.data->recipient.address = utf8::cvt<std::string>(url.to_string()); 233 config.data->host_self.id = "self"; 234 config.data->host_self.host = hostname_; 235 206 236 setup(config, _T("")); 207 237 if (!client::command_line_parser::relay_submit(config, request, response)) { … … 230 260 return NSCAPI::hasFailed; 231 261 } 232 NSC_ LOG_ERROR_STD(_T("Got IV sending data: ") + strEx::itos(packets.size()));262 NSC_DEBUG_MSG_STD(_T("Got IV sending data: ") + strEx::itos(packets.size())); 233 263 BOOST_FOREACH(const nsca::packet &packet, packets) { 234 264 socket.send_nsca(packet, boost::posix_time::seconds(data.timeout)); … … 256 286 int NSCAAgent::clp_handler_impl::submit(client::configuration::data_type data, ::Plugin::Common_Header* header, const std::string &request, std::string &response) { 257 287 try { 288 258 289 Plugin::SubmitRequestMessage message; 259 290 message.ParseFromString(request); 260 291 std::list<nsca::packet> list; 261 262 std::wstring command, msg, perf; 292 int iii = message.payload_size(); 293 294 std::wstring alias, command, msg, perf; 263 295 nscapi::functions::destination_container recipient; // = data->host_default_recipient; 264 296 nscapi::functions::parse_destination(*header, header->recipient_id(), recipient, true); … … 268 300 for (int i=0;i < message.payload_size(); ++i) { 269 301 nsca::packet packet(source.host, local_data.payload_length, local_data.time_delta); 270 packet.code = nscapi::functions::parse_simple_submit_request_payload(message.payload(i), command, msg, perf); 271 packet.service = utf8::cvt<std::string>(command); 302 packet.code = nscapi::functions::parse_simple_submit_request_payload(message.payload(i), alias, command, msg, perf); 303 if (alias != _T("host_check")) 304 packet.service = utf8::cvt<std::string>(alias); 305 packet.host = source.host; 272 306 packet.result = utf8::cvt<std::string>(msg) + "|" + utf8::cvt<std::string>(perf); 273 307 list.push_back(packet); -
modules/NSCAClient/NSCAClient.h
r58f0e80 rf7a074d 26 26 27 27 #include <nsca/nsca_packet.hpp> 28 #include <nscapi/targets.hpp> 28 29 29 30 NSC_WRAPPERS_MAIN(); … … 34 35 35 36 std::string hostname_; 36 std::wstring nscahost_;37 unsigned int nscaport_;38 37 unsigned int payload_length_; 39 38 bool cacheNscaHost_; 40 std::string password_;41 int encryption_method_;42 39 unsigned int timeout_; 43 40 std::wstring channel_; 44 41 int time_delta_; 42 nscapi::target_handler targets; 43 std::wstring target_path; 45 44 46 45 … … 146 145 std::wstring setup(client::configuration &config, const std::wstring &command); 147 146 void add_local_options(boost::program_options::options_description &desc, nscp_connection_data &command_data); 147 void add_target(std::wstring key, std::wstring args); 148 148 149 149 void set_delay(std::wstring key) { -
modules/PythonScript/PythonScript.cpp
r58f0e80 rf7a074d 114 114 } 115 115 python_script::~python_script(){ 116 script_wrapper::thread_locker locker;117 116 callFunction("shutdown"); 118 117 } … … 194 193 if (!has_init) { 195 194 has_init = true; 195 PyEval_InitThreads(); 196 196 Py_Initialize(); 197 PyEval_InitThreads();198 197 do_init = true; 199 198 } … … 390 389 std::wstring src, cmd, msg, perf; 391 390 int code = nscapi::functions::parse_simple_submit_request(request, src, cmd, msg, perf); 391 NSC_LOG_ERROR_STD(_T(" --- command: ") + cmd); 392 392 int ret = inst->handle_simple_message(chnl, to_string(src), to_string(cmd), code, msg, perf); 393 393 nscapi::functions::create_simple_submit_response(channel, cmd, ret, _T(""), response); -
modules/PythonScript/script_wrapper.cpp
r58f0e80 rf7a074d 129 129 } 130 130 void script_wrapper::sleep(unsigned int seconds) { 131 thread_unlocker unlocker; 132 boost::this_thread::sleep(boost::posix_time::milliseconds(seconds*1000)); 131 { 132 thread_unlocker unlocker; 133 { 134 boost::this_thread::sleep(boost::posix_time::milliseconds(1000)); 135 136 } 137 } 133 138 } 134 139 /* … … 252 257 return NSCAPI::returnIgnored; 253 258 } 254 255 py::list l;256 BOOST_FOREACH(std::wstring a, arguments) {257 l.append(utf8::cvt<std::string>(a));258 }259 259 { 260 260 thread_locker locker; 261 261 262 try { 263 py::list l; 264 BOOST_FOREACH(std::wstring a, arguments) { 265 l.append(utf8::cvt<std::string>(a)); 266 } 262 267 tuple ret = boost::python::call<tuple>(boost::python::object(it->second).ptr(), l); 263 268 if (ret.ptr() == Py_None) { -
modules/PythonScript/script_wrapper.hpp
r58f0e80 rf7a074d 2 2 3 3 #include <boost/python.hpp> 4 #include <boost/thread.hpp> 4 5 5 6 namespace script_wrapper { … … 9 10 namespace thread_support { 10 11 static bool enabled = true; 12 static boost::shared_mutex mutex; 13 14 struct log_lock { 15 boost::unique_lock<boost::shared_mutex> lock; 16 log_lock() : lock(thread_support::mutex, boost::get_system_time() + boost::posix_time::seconds(2)) { 17 if (!lock.owns_lock()) 18 NSC_LOG_ERROR(_T("Failed to get mutex: thread_locker")); 19 } 20 }; 21 11 22 } 12 23 … … 28 39 PyThreadState *state; 29 40 thread_unlocker() { 30 state = PyEval_SaveThread(); 41 if (thread_support::enabled) 42 state = PyEval_SaveThread(); 31 43 } 32 44 ~thread_unlocker() { 33 PyEval_RestoreThread(state); 34 } 35 36 45 if (thread_support::enabled) 46 PyEval_RestoreThread(state); 47 } 37 48 }; 38 49 -
modules/Scheduler/Scheduler.cpp
ra629015 rf7a074d 153 153 NSC_LOG_ERROR_STD(error); 154 154 } 155 155 #include <nscapi/functions.hpp> 156 156 void Scheduler::handle_schedule(scheduler::target item) { 157 157 try { … … 161 161 // @todo: allow renaming of commands here item.alias, 162 162 // @todo this is broken, fix this (uses the wrong message) 163 nscapi::functions::make_submit_from_query(response, item.channel, item.alias); 163 164 std::string result; 164 165 GET_CORE()->submit_message(item.channel, response, result); -
scripts/python/lib/test_helper.py
r58f0e80 rf7a074d 1 1 from NSCP import Settings, Registry, Core, log, log_error, status 2 import os 3 import inspect 2 4 3 5 test_manager = None 6 7 def install_testcases(tests): 8 test_manager = create_test_manager() 9 test_manager.add(tests) 10 test_manager.install() 11 12 def init_testcases(plugin_id, plugin_alias, script_alias, tests): 13 test_manager = create_test_manager(plugin_id, plugin_alias, script_alias) 14 test_manager.add(tests) 15 test_manager.init() 16 17 def shutdown_testcases(): 18 get_test_manager().shutdown() 4 19 5 20 def get_test_manager(): … … 40 55 def display_help(arguments = []): 41 56 return (status.OK, 'TODO') 42 57 43 58 class Callable: 44 59 def __init__(self, anycallable): 45 60 self.__call__ = anycallable 46 61 62 class SingletonHelper: 63 klass = None 64 def __init__(self, klass): 65 self.klass = klass 66 def __call__(self, *args, **kw): 67 if not self.klass._instance: 68 self.klass._instance = self.klass() 69 return self.klass._instance 70 71 def setup_singleton(klass, src = None): 72 klass.getInstance = SingletonHelper(klass) 73 log('Setting path: %s'%src) 74 if not src: 75 cf = inspect.currentframe() 76 if cf: 77 bf = cf.f_back 78 if bf: 79 src = bf.f_code.co_filename 80 klass.__source__ = src 81 log('==>%s'%src) 82 83 class BasicTest(object): 84 85 _instance = None 86 getInstance = None 87 __source__ = '' 88 89 def desc(self): 90 return 'TODO: Describe: %s'%self.title() 91 92 def title(self): 93 return self._instance.__class__.__name__ 94 95 def setup(self, plugin_id, prefix): 96 None 97 98 def teardown(self): 99 None 100 101 def run_test(self): 102 result = TestResult() 103 result.add_message(False, 'TODO add implementation') 104 return result 105 106 def install(self, arguments): 107 conf = Settings.get() 108 conf.set_string('/modules', 'pytest', 'PythonScript') 109 log('==> %s'%self.__source__) 110 fn = os.path.basename(self.__source__) 111 (sn, ext) = os.path.splitext(fn) 112 conf.register_key('/settings/pytest/scripts', sn, 'string', 'UNIT TEST SCRIPT: %s'%self.title(), 'A script for running unittests for: %s'%self.desc(), fn) 113 conf.set_string('/settings/pytest/scripts', sn, fn) 114 115 conf.save() 116 117 def uninstall(self): 118 None 119 120 def help(self): 121 None 122 123 def init(self, plugin_id): 124 None 125 126 def shutdown(self): 127 None 128 129 47 130 class TestResult: 48 131 class Entry: -
scripts/python/test_eventlog.py
r58f0e80 rf7a074d 1 1 from NSCP import Settings, Registry, Core, log, status, sleep 2 from test_helper import Callable, TestResult, get_test_manager, create_test_manager2 from test_helper import BasicTest, TestResult, Callable, setup_singleton, install_testcases, init_testcases, shutdown_testcases 3 3 import plugin_pb2 4 4 from types import * … … 6 6 import unicodedata 7 7 8 class EventLogTest :8 class EventLogTest(BasicTest): 9 9 instance = None 10 10 key = '' … … 107 107 None 108 108 109 setup_singleton(EventLogTest) 110 109 111 all_tests = [EventLogTest] 110 112 111 113 def __main__(): 112 test_manager = create_test_manager() 113 test_manager.add(all_tests) 114 test_manager.install() 114 install_testcases(all_tests) 115 115 116 116 def init(plugin_id, plugin_alias, script_alias): 117 test_manager = create_test_manager(plugin_id, plugin_alias, script_alias) 118 test_manager.add(all_tests) 119 120 test_manager.init() 117 init_testcases(plugin_id, plugin_alias, script_alias, all_tests) 121 118 122 119 def shutdown(): 123 test_manager = get_test_manager() 124 test_manager.shutdown() 120 shutdown_testcases() -
scripts/python/test_nsca.py
r58f0e80 rf7a074d 1 1 from NSCP import Settings, Registry, Core, log, status, log_error, sleep 2 from test_helper import Callable, TestResult, get_test_manager, create_test_manager2 from test_helper import BasicTest, TestResult, Callable, setup_singleton, install_testcases, init_testcases, shutdown_testcases 3 3 import plugin_pb2 4 4 from types import * … … 6 6 import uuid 7 7 import unicodedata 8 #import _thread 9 #sync = _thread.allocate_lock() 10 11 import threading 12 sync = threading.RLock() 8 13 9 14 core = Core.get() 10 11 prefix = 'py_'12 plugin_id = 013 14 def get_help(arguments):15 return (status.OK, 'help: Get help')16 17 15 18 16 def isOpen(ip, port): … … 35 33 36 34 def __init__(self, command): 37 try: 38 self.uuid = command.decode('ascii') 39 except UnicodeDecodeError: 35 if type(command) == 'unicode': 36 try: 37 self.uuid = command.decode('ascii', 'replace') 38 except UnicodeDecodeError: 39 self.uuid = command 40 else: 40 41 self.uuid = command 41 42 #self.uuid = unicodedata.normalize('NFKD', command).encode('ascii','ignore') … … 44 45 return 'Message: %s (%s, %s, %s)'%(self.uuid, self.source, self.command, self.status) 45 46 46 class NSCAServerTest :47 class NSCAServerTest(BasicTest): 47 48 instance = None 48 49 key = '' 49 50 reg = None 50 responses = {} 51 52 class SingletonHelper: 53 def __call__( self, *args, **kw ) : 54 if NSCAServerTest.instance is None : 55 object = NSCAServerTest() 56 NSCAServerTest.instance = object 57 return NSCAServerTest.instance 58 59 getInstance = SingletonHelper() 60 51 _responses = {} 52 53 def has_response(self, id): 54 with sync: 55 return id in self._responses 56 57 def get_response(self, id): 58 with sync: 59 if id in self._responses: 60 return self._responses[id] 61 msg = NSCAMessage(id) 62 self._responses[id] = msg 63 return msg 64 65 def set_response(self, msg): 66 with sync: 67 self._responses[msg.uuid] = msg 68 69 def del_response(self, id): 70 with sync: 71 del self._responses[id] 72 73 61 74 def desc(self): 62 75 return 'Testcase for NSCA protocol' … … 82 95 83 96 def simple_inbox_handler_wrapped(self, channel, source, command, status, message, perf): 84 log('Got simple message %s on %s'%(command, channel)) 85 msg = NSCAMessage(command) 86 if msg.uuid in self.responses: 87 msg = self.responses[msg.uuid] 97 log('Got simple message %s'%command) 98 msg = self.get_response(command) 88 99 msg.source = source 89 100 msg.status = status … … 91 102 msg.perfdata = perf 92 103 msg.got_simple_response = True 93 self. responses[msg.uuid] = msg104 self.set_response(msg) 94 105 return True 95 106 … … 100 111 message.ParseFromString(request) 101 112 command = message.payload[0].command 102 log('Got simple message %s on %s'%(command, channel)) 103 104 msg = NSCAMessage(command) 105 if msg.uuid in self.responses: 106 msg = self.responses[msg.uuid] 113 #log('Got message %s on %s'%(command, channel)) 114 115 msg = self.get_response(command) 107 116 msg.got_response = True 108 self. responses[msg.uuid] = msg117 self.set_response(msg) 109 118 return (False, '') 110 119 … … 139 148 found = False 140 149 for i in range(0,10): 141 if uid in self.responses:142 rmsg = self. responses[uid]150 if self.has_response(uid): 151 rmsg = self.get_response(uid) 143 152 result.add_message(rmsg.got_response, 'Testing to recieve message using %s'%encryption) 144 153 result.add_message(rmsg.got_simple_response, 'Testing to recieve simple message using %s'%encryption) … … 148 157 result.assert_contains(rmsg.message, msg, 'Verify that message is sent through') 149 158 result.assert_equals(rmsg.perfdata, perf, 'Verify that performance data is sent through') 150 del self.responses[uid]159 self.del_response(uid) 151 160 found = True 152 161 break 153 162 else: 154 log('Waiting for %s (%s)'%(uid, self.responses.keys()))163 log('Waiting for %s'%uid) 155 164 sleep(1) 156 165 if not found: … … 178 187 # Currently broken: "xor" 179 188 cryptos = ["des", "3des", "cast128", "xtea", "blowfish", "twofish", "rc2", "aes", "serpent", "gost", "none", "3way"] 189 #cryptos = ["none"] 180 190 for c in cryptos: 181 191 result.add_message(True, 'Testing crypto: %s'%c) … … 213 223 None 214 224 225 setup_singleton(NSCAServerTest) 226 215 227 all_tests = [NSCAServerTest] 216 228 217 229 def __main__(): 218 test_manager = create_test_manager() 219 test_manager.add(all_tests) 220 test_manager.install() 230 install_testcases(all_tests) 221 231 222 232 def init(plugin_id, plugin_alias, script_alias): 223 test_manager = create_test_manager(plugin_id, plugin_alias, script_alias) 224 test_manager.add(all_tests) 225 226 test_manager.init() 233 init_testcases(plugin_id, plugin_alias, script_alias, all_tests) 227 234 228 235 def shutdown(): 229 test_manager = get_test_manager() 230 test_manager.shutdown() 236 shutdown_testcases() -
service/NSCPlugin.h
r9b9be81 rf7a074d 157 157 bool route_message(const wchar_t *channel, const char* buffer, unsigned int buffer_len, wchar_t **new_channel_buffer, char **new_buffer, unsigned int *new_buffer_len); 158 158 159 std::wstring get_description() { 160 if (alias_.empty()) 161 return getName(); 162 return getName() + _T(" (") + alias_ + _T(")"); 163 } 159 164 std::wstring get_alias() { 160 165 return alias_; -
service/NSClient++.cpp
r98113da rf7a074d 371 371 BOOST_FOREACH(std::wstring plugin, list) { 372 372 std::wstring alias = settings_manager::get_settings()->get_string(MAIN_MODULES_SECTION, plugin); 373 if (plugin == _T("enabled") ) {373 if (plugin == _T("enabled") || plugin == _T("1")) { 374 374 plugin = alias; 375 375 alias = _T(""); 376 } else if (alias == _T("enabled") || alias == _T("1")) { 377 alias = _T(""); 376 378 } else if ((active && plugin == _T("disabled")) || (active && alias == _T("disabled"))) 377 379 continue; … … 387 389 alias = tmp; 388 390 } 389 LOG_DEBUG_CORE_STD(_T("Found: ") + plugin + _T(" as ") + alias); 391 if (alias.empty()) { 392 LOG_DEBUG_CORE_STD(_T("Found: ") + plugin); 393 } else { 394 LOG_DEBUG_CORE_STD(_T("Found: ") + plugin + _T(" as ") + alias); 395 } 390 396 if (plugin.length() > 4 && plugin.substr(plugin.length()-4) == _T(".dll")) 391 397 plugin = plugin.substr(0, plugin.length()-4); … … 687 693 std::wstring file = NSCPlugin::get_plugin_file(v.second); 688 694 std::wstring alias = v.first; 689 LOG_DEBUG_CORE_STD(_T("Processing plugin: ") + file + _T(" as ") + alias); 695 if (!alias.empty()) { 696 LOG_DEBUG_CORE_STD(_T("Processing plugin: ") + file + _T(" as ") + alias); 697 } else { 698 LOG_DEBUG_CORE_STD(_T("Processing plugin: ") + file); 699 } 690 700 try { 691 701 addPlugin(pluginPath / boost::filesystem::wpath(file), alias); … … 921 931 } 922 932 for (pluginList::iterator it=plugins_.begin(); it != plugins_.end();) { 923 LOG_DEBUG_CORE_STD(_T("Loading plugin: ") + (*it)->get Name() + _T(" as ") + (*it)->get_alias());933 LOG_DEBUG_CORE_STD(_T("Loading plugin: ") + (*it)->get_description()); 924 934 try { 925 935 if (!(*it)->load_plugin(mode)) { -
service/core_api.cpp
r98113da rf7a074d 148 148 return NSCAPI::hasFailed; 149 149 } 150 NSCAPI::errorReturn NSAPIGetSettingsSections(const wchar_t* section, wchar_t*** aBuffer, unsigned int * bufLen) { 151 try { 152 unsigned int len = 0; 153 *aBuffer = array_buffer::list2arrayBuffer(settings_manager::get_settings()->get_sections(section), len); 154 *bufLen = len; 155 return NSCAPI::isSuccess; 156 } catch (settings::settings_exception e) { 157 LOG_ERROR_STD(_T("Failed to get section: ") + e.getMessage()); 158 } catch (...) { 159 LOG_ERROR_STD(_T("Failed to getSection: ") + section); 160 } 161 return NSCAPI::hasFailed; 162 } 150 163 NSCAPI::errorReturn NSAPIReleaseSettingsSectionBuffer(wchar_t*** aBuffer, unsigned int * bufLen) { 151 164 array_buffer::destroyArrayBuffer(*aBuffer, *bufLen); … … 436 449 if (wcscasecmp(buffer, _T("NSAPIGetSettingsSection")) == 0) 437 450 return reinterpret_cast<LPVOID>(&NSAPIGetSettingsSection); 451 if (wcscasecmp(buffer, _T("NSAPIGetSettingsSections")) == 0) 452 return reinterpret_cast<LPVOID>(&NSAPIGetSettingsSections); 438 453 if (wcscasecmp(buffer, _T("NSAPIReleaseSettingsSectionBuffer")) == 0) 439 454 return reinterpret_cast<LPVOID>(&NSAPIReleaseSettingsSectionBuffer); -
service/core_api.h
r98113da rf7a074d 41 41 NSCAPI::nagiosReturn NSAPIExecCommand(const wchar_t* target, const wchar_t* command, const char *request_buffer, const unsigned int request_buffer_len, char **response_buffer, unsigned int *response_buffer_len); 42 42 NSCAPI::errorReturn NSAPIGetSettingsSection(const wchar_t*, wchar_t***, unsigned int *); 43 NSCAPI::errorReturn NSAPIGetSettingsSections(const wchar_t*, wchar_t***, unsigned int *); 43 44 NSCAPI::errorReturn NSAPIReleaseSettingsSectionBuffer(wchar_t*** aBuffer, unsigned int * bufLen); 44 45 NSCAPI::boolReturn NSAPICheckLogMessages(int messageType); -
service/logger.hpp
ra14aa07 rf7a074d 66 66 67 67 namespace ip = boost::interprocess; 68 const int max_message_size = 4096 ;68 const int max_message_size = 40960; 69 69 const std::string queue_name = "logging_queue"; 70 70 -
version.hpp
r98113da rf7a074d 1 1 #ifndef VERSION_HPP 2 2 #define VERSION_HPP 3 #define PRODUCTVER 0,4,0, 984 #define STRPRODUCTVER "0,4,0, 98"5 #define STRPRODUCTDATE "2011- 09-06"3 #define PRODUCTVER 0,4,0,107 4 #define STRPRODUCTVER "0,4,0,107" 5 #define STRPRODUCTDATE "2011-11-06" 6 6 #endif // VERSION_HPP -
version.txt
r7515d00 rf7a074d 1 1 version=0.4.0 2 build= 983 date=2011- 09-062 build=107 3 date=2011-11-06
Note: See TracChangeset
for help on using the changeset viewer.








