Changeset b39c1f3 in nscp
- Timestamp:
- 05/17/09 21:49:38 (4 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- dcd5462
- Parents:
- b1ac2fa
- Files:
-
- 18 edited
-
AutoBuild.h (modified) (1 diff)
-
Jamroot (modified) (6 diffs)
-
NSClient++.cpp (modified) (1 diff)
-
changelog (modified) (1 diff)
-
helpers/installer/Product.wxs (modified) (2 diffs)
-
include/EnumProcess.cpp (modified) (6 diffs)
-
include/EnumProcess.h (modified) (2 diffs)
-
include/INISettings.h (modified) (10 diffs)
-
include/REGSettings.h (modified) (2 diffs)
-
include/Settings.h (modified) (5 diffs)
-
include/TSettings.h (modified) (2 diffs)
-
include/strEx.h (modified) (1 diff)
-
modules/CheckEventLog/Jamfile (modified) (1 diff)
-
modules/CheckSystem/CheckSystem.cpp (modified) (1 diff)
-
modules/CheckSystem/PDHCollector.cpp (modified) (1 diff)
-
modules/LUAScript/script_wrapper.hpp (modified) (2 diffs)
-
modules/NRPEListener/NRPEListener.cpp (modified) (1 diff)
-
scripts/test.lua (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
AutoBuild.h
rb1ac2fa rb39c1f3 3 3 // change the FALSE to TRUE for autoincrement of build number 4 4 #define INCREMENT_VERSION TRUE 5 #define FILEVER 0,3,6,6 136 #define PRODUCTVER 0,3,6,6 137 #define STRFILEVER _T("0.3.6.6 13")8 #define STRPRODUCTVER _T("0.3.6.6 13")9 #define STRPRODUCTDATE _T("2009-05- 03")5 #define FILEVER 0,3,6,660 6 #define PRODUCTVER 0,3,6,660 7 #define STRFILEVER _T("0.3.6.660") 8 #define STRPRODUCTVER _T("0.3.6.660") 9 #define STRPRODUCTDATE _T("2009-05-14") 10 10 #endif // AUTOBUILD_H -
Jamroot
rb1ac2fa rb39c1f3 108 108 109 109 make $(target).exe.manifest : NSClient++.manifest : common.copy ; 110 explicit $(target). manifest ;110 explicit $(target).exe.manifest ; 111 111 112 112 … … 161 161 162 162 all-scripts = 163 [ MATCH .*scripts/(. *)/.*: [ glob scripts/* ] ]163 [ MATCH .*scripts/(.+\\..*) : [ glob scripts/* ] ] 164 164 ; 165 165 local all-scripts-lst ; 166 166 if $(toolset) = "msvc" { 167 167 if ! ( [ bjam/lua.isEnabled ] = true ) { … … 194 194 for local l in $(all-scripts) 195 195 { 196 make scripts-$l : scripts/$l : common.copy ; 197 explicit script-$(l) ; 196 #make scripts-$(l) : scripts/$(l) : common.copy ; 197 #explicit scripts/$(l) ; 198 199 #alias scripts-$(l) : scripts/$(l) ; 200 #explicit scripts-$(l) ; 201 202 all-scripts-lst = $(all-scripts-lst) scripts/$(l) ; 203 198 204 echo "Adding script: $(l)" ; 199 205 } 206 echo ">>>Done with: $(all-scripts-lst)" ; 207 echo $(all-scripts-lst) ; 208 echo "<<<Done with: $(all-scripts-lst)" ; 200 209 } 201 210 … … 227 236 explicit all-helpers-targets ; 228 237 238 alias all-scripts-targets : $(all-scripts-lst) ; 239 explicit all-scripts-targets ; 240 229 241 alias all-root-targets : $(target) $(target-config) $(target-readme) $(target-license) $(target-changelog) $(target-counters) helpers/systray_helper ; 230 242 explicit all-root-targets ; 243 231 244 alias all-modules-targets : $(all-modules) ; 232 245 explicit all-modules-targets ; … … 255 268 return <location>$(BOOST_STAGE_LOCATE)/$(tag)/helpers ; 256 269 } 270 rule generate-scripts-location ( properties * ) 271 { 272 local tag = [ get-root-prefix $(properties) ] ; 273 return <location>$(BOOST_STAGE_LOCATE)/$(tag)/binaries/scripts ; 274 } 257 275 rule generate-module-location ( properties * ) 258 276 { … … 270 288 explicit dist-helpers ; 271 289 272 alias build-binaries : dist dist-modules dist-helpers ; 290 install dist-scripts : all-scripts-targets : <conditional>@generate-scripts-location ; 291 explicit dist-scripts ; 292 293 294 295 alias build-binaries : dist dist-modules dist-helpers dist-scripts ; 273 296 explicit build-binaries ; 274 297 -
NSClient++.cpp
rb1ac2fa rb39c1f3 570 570 if (boot) { 571 571 try { 572 SettingsT::sectionList list = Settings::getInstance()->getSection(_T("modules"));573 for ( SettingsT::sectionList::iterator it = list.begin(); it != list.end(); it++) {572 settings_base::sectionList list = Settings::getInstance()->getSection(_T("modules")); 573 for (settings_base::sectionList::iterator it = list.begin(); it != list.end(); it++) { 574 574 try { 575 575 loadPlugin(getBasePath() + _T("modules\\") + (*it)); -
changelog
rb1ac2fa rb39c1f3 4 4 * Add API for rehashing the daemon (or implement it the API is there but does nothing) 5 5 * Improved socket performance (would be nice if we could be used as a "hub") 6 * Fixa dependonservice LanManWorkStation (old win) 7 * Fix RtlStringFromGUID problem on NT4 8 9 10 2009-05-17 MickeM 11 * Changed default buffer size for process enumeration (64K now instead of 1K should I hope work better on 64bit OS:es) 12 13 2009-05-10 MickeM 14 + Added write support for modules to installer 6 15 7 16 2009-05-03 MickeM -
helpers/installer/Product.wxs
rb1ac2fa rb39c1f3 133 133 </Component> 134 134 </Directory> 135 <Directory Id="INSTALLLOCATION_SCRIPTS" Name="scripts"> 136 <Component Id="Scripts" Guid="9B490E67-5472-4267-96DC-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 137 <File Id="scriptargs.bat" Name="args.bat" LongName="args.bat" DiskId="1" Source="$(var.Source)/scripts/args.bat" Vital="no" /> 138 <File Id="scriptcheck_vb.vbs" Name="check_vb.vbs" LongName="check_vb.vbs" DiskId="1" Source="$(var.Source)/scripts/check_vb.vbs" Vital="no" /> 139 <File Id="scriptcritical.bat" Name="critical.bat" LongName="critical.bat" DiskId="1" Source="$(var.Source)/scripts/critical.bat" Vital="no" /> 140 <File Id="scriptmulti_line.bat" Name="mline.bat" LongName="multi_line.bat" DiskId="1" Source="$(var.Source)/scripts/multi_line.bat" Vital="no" /> 141 <File Id="scriptok.bat" Name="ok.bat" LongName="ok.bat" DiskId="1" Source="$(var.Source)/scripts/ok.bat" Vital="no" /> 142 <File Id="scriptpowershell.ps1" Name="pwrshell.ps1" LongName="powershell.ps1" DiskId="1" Source="$(var.Source)/scripts/powershell.ps1" Vital="no" /> 143 <File Id="scripttest.lua" Name="test.lua" LongName="test.lua" DiskId="1" Source="$(var.Source)/scripts/test.lua" Vital="no" /> 144 </Component> 145 </Directory> 146 </Directory> 147 </Directory> 148 <Directory Id="ProgramMenuFolder" Name="PMenu" LongName="Programs"> 149 <Directory Id="ProgramMenuDir" Name='NSClient' LongName="$(var.App.StartMenuPath)" /> 135 150 </Directory> 136 151 </Directory> 137 <Directory Id="ProgramMenuFolder" Name="PMenu" LongName="Programs"> 138 <Directory Id="ProgramMenuDir" Name='NSClient' LongName="$(var.App.StartMenuPath)" /> 139 </Directory> 140 </Directory> 141 <Feature Id="ProductFeature" Title="NSClient++ $(var.PlatForm)" Description="Binaries for $(var.PlatForm)" 142 Display="expand" Level="1" ConfigurableDirectory="INSTALLLOCATION" Absent="disallow"> 143 <Feature Id="MainProgram" Title="Program" Description="Main Service" Level="1" Absent="disallow"> 144 <ComponentRef Id="MainClient" /> 152 <Feature Id="ProductFeature" Title="NSClient++ $(var.PlatForm)" Description="Binaries for $(var.PlatForm)" 153 Display="expand" Level="1" ConfigurableDirectory="INSTALLLOCATION" Absent="disallow"> 154 <Feature Id="MainProgram" Title="Program" Description="Main Service" Level="1" Absent="disallow"> 155 <ComponentRef Id="MainClient" /> 145 156 </Feature> 146 157 <Feature Id="Plugins" Title="Plugins" Description="Plugins" Level="1" Absent="disallow"> … … 156 167 <Feature Id="NSCAPlugin" Title="NSCA plugin" Description="Plugin to submit passive results to an NSCA server" Level="1" Absent="disallow"> 157 168 <ComponentRef Id="NSCA" /> 169 </Feature> 170 <Feature Id="SampleScripts" Title="Sample Scripts" Description="Some sample client-side scripts to use with NRPE" Level="1" Absent="disallow"> 171 <ComponentRef Id="Scripts" /> 158 172 </Feature> 159 173 </Feature> -
include/EnumProcess.cpp
rb1ac2fa rb39c1f3 85 85 TOKEN_PRIVILEGES token_privileges; 86 86 DWORD dwSize; 87 ZeroMemory (&token_privileges, sizeof (token_privileges));87 ZeroMemory (&token_privileges, sizeof(token_privileges)); 88 88 token_privileges.PrivilegeCount = 1; 89 89 if ( !OpenProcessToken (GetCurrentProcess(), TOKEN_ALL_ACCESS, &hToken)) … … 123 123 124 124 CEnumProcess::process_list CEnumProcess::enumerate_processes(bool expand_command_line, bool find_16bit, CEnumProcess::error_reporter *error_interface, unsigned int buffer_size) { 125 125 if (error_interface!=NULL) 126 error_interface->report_debug_enter(_T("enumerate_processes")); 126 127 try { 128 if (error_interface!=NULL) 129 error_interface->report_debug_enter(_T("enable_token_privilege")); 127 130 enable_token_privilege(SE_DEBUG_NAME); 131 if (error_interface!=NULL) 132 error_interface->report_debug_exit(_T("enable_token_privilege")); 128 133 } catch (process_enumeration_exception &e) { 129 134 if (error_interface!=NULL) … … 134 139 DWORD *dwPIDs = new DWORD[buffer_size+1]; 135 140 DWORD cbNeeded = 0; 141 if (error_interface!=NULL) 142 error_interface->report_debug_enter(_T("FEnumProcesses")); 136 143 BOOL OK = FEnumProcesses(dwPIDs, buffer_size*sizeof(DWORD), &cbNeeded); 144 if (error_interface!=NULL) 145 error_interface->report_debug_exit(_T("FEnumProcesses")); 137 146 if (cbNeeded >= DEFAULT_BUFFER_SIZE*sizeof(DWORD)) { 138 147 delete [] dwPIDs; 148 if (error_interface!=NULL) 149 error_interface->report_debug(_T("Need larger buffer: ") + strEx::itos(buffer_size)); 139 150 return enumerate_processes(expand_command_line, find_16bit, error_interface, buffer_size * 10); 140 151 } … … 149 160 CProcessEntry entry; 150 161 try { 162 if (error_interface!=NULL) 163 error_interface->report_debug_enter(_T("describe_pid")); 151 164 try { 152 165 entry = describe_pid(dwPIDs[i], expand_command_line); … … 156 169 entry = describe_pid(dwPIDs[i], false); 157 170 } 171 if (error_interface!=NULL) 172 error_interface->report_debug_exit(_T("describe_pid")); 158 173 if (VDMDBG!=NULL&&find_16bit) { 174 if (error_interface!=NULL) 175 error_interface->report_debug(_T("Looking for 16bit apps")); 159 176 if( _wcsicmp(entry.filename.substr(0,9).c_str(), _T("NTVDM.EXE")) == 0) { 160 177 find_16bit_container container; … … 174 191 } 175 192 delete [] dwPIDs; 193 if (error_interface!=NULL) 194 error_interface->report_debug_exit(_T("enumerate_processes")); 176 195 return ret; 177 196 } -
include/EnumProcess.h
rb1ac2fa rb39c1f3 51 51 #endif 52 52 53 #define DEFAULT_BUFFER_SIZE 102453 #define DEFAULT_BUFFER_SIZE 64*1024 54 54 55 55 class CEnumProcess … … 61 61 virtual void report_error(std::wstring error) = 0; 62 62 virtual void report_warning(std::wstring error) = 0; 63 virtual void report_debug(std::wstring error) = 0; 64 virtual void report_debug_enter(std::wstring error) = 0; 65 virtual void report_debug_exit(std::wstring error) = 0; 63 66 }; 64 67 class process_enumeration_exception { -
include/INISettings.h
r99e4d8f rb39c1f3 16 16 std::wstring file_; 17 17 public: 18 typedef std::list<std::wstring> sectionList;18 //typedef std::list<std::wstring> sectionList; 19 19 20 20 public: … … 31 31 * @param unsigned int bufferLength 32 32 */ 33 se ctionList getSections(unsigned int bufferLength = BUFF_LEN) {34 se ctionList ret;33 settings_base::sectionList getSections(unsigned int bufferLength = BUFF_LEN) { 34 settings_base::sectionList ret; 35 35 TCHAR* buffer = new TCHAR[bufferLength+1]; 36 36 unsigned int count = ::GetPrivateProfileSectionNames(buffer, BUFF_LEN, file_.c_str()); … … 56 56 * @return A list with all keys from the section 57 57 */ 58 se ctionList getSection(std::wstring section, unsigned int bufferLength = BUFF_LEN) {59 se ctionList ret;58 settings_base::sectionList getSection(std::wstring section, unsigned int bufferLength = BUFF_LEN) { 59 settings_base::sectionList ret; 60 60 TCHAR* buffer = new TCHAR[bufferLength+1]; 61 61 unsigned int count = GetPrivateProfileSection(section.c_str(), buffer, bufferLength, file_.c_str()); … … 80 80 } 81 81 /** 82 * Get all keys from a section as a list<string> 83 * @param section The section to return all keys from 84 * @return A list with all keys from the section 85 */ 86 //void settings_base::setSection(std::wstring,settings_base::sectionList) 87 void setSection(std::wstring section, settings_base::sectionList data) { 88 unsigned int length = 0; 89 for (settings_base::sectionList::const_iterator cit = data.begin(); cit!=data.end();++cit) { 90 length += (*cit).size() + 10; 91 } 92 TCHAR* buffer = new TCHAR[length+1]; 93 unsigned int index = 0; 94 for (settings_base::sectionList::const_iterator cit = data.begin(); cit!=data.end();++cit) { 95 wcsncpy_s(&buffer[index], length-index-1,(*cit).c_str(), (*cit).length()+1); 96 index+=(*cit).length(); 97 buffer[index]=0; 98 index++; 99 } 100 buffer[index]=0; 101 buffer[index+1]=0; 102 WritePrivateProfileSection(section.c_str(), buffer, file_.c_str()); 103 delete [] buffer; 104 } 105 /** 82 106 * Get a string from the settings file 83 107 * @param section Section to read from … … 132 156 coreFile_ = tmp; 133 157 files_.push_front(tmp); 134 INIFile::sectionList lst = tmp->getSection(_T("includes"));135 for( INIFile::sectionList::const_iterator cit = lst.begin(); cit != lst.end(); ++cit) {158 settings_base::sectionList lst = tmp->getSection(_T("includes")); 159 for(settings_base::sectionList::const_iterator cit = lst.begin(); cit != lst.end(); ++cit) { 136 160 if (!hasFile(*cit)) 137 161 importFile(basepath, *cit); … … 154 178 * @param unsigned int bufferLength 155 179 */ 156 INIFile::sectionList getSections(unsigned int bufferLength = BUFF_LEN) {157 INIFile::sectionList ret;158 for (std::list<INIFile*>::const_iterator cit = files_.begin(); cit != files_.end(); ++cit) { 159 INIFile::sectionList tmp = (*cit)->getSections(bufferLength);180 settings_base::sectionList getSections(unsigned int bufferLength = BUFF_LEN) { 181 settings_base::sectionList ret; 182 for (std::list<INIFile*>::const_iterator cit = files_.begin(); cit != files_.end(); ++cit) { 183 settings_base::sectionList tmp = (*cit)->getSections(bufferLength); 160 184 ret.insert(ret.begin(), tmp.begin(), tmp.end()); 161 185 } … … 168 192 * @return A list with all keys from the section 169 193 */ 170 INIFile::sectionList getSection(std::wstring section, unsigned int bufferLength = BUFF_LEN) {171 INIFile::sectionList ret;172 for (std::list<INIFile*>::const_iterator cit = files_.begin(); cit != files_.end(); ++cit) { 173 INIFile::sectionList tmp = (*cit)->getSection(section, bufferLength);194 settings_base::sectionList getSection(std::wstring section, unsigned int bufferLength = BUFF_LEN) { 195 settings_base::sectionList ret; 196 for (std::list<INIFile*>::const_iterator cit = files_.begin(); cit != files_.end(); ++cit) { 197 settings_base::sectionList tmp = (*cit)->getSection(section, bufferLength); 174 198 ret.insert(ret.begin(), tmp.begin(), tmp.end()); 175 199 } … … 192 216 } 193 217 218 void setSection(std::wstring section, settings_base::sectionList data) { 219 if (coreFile_ != NULL) 220 coreFile_->setSection(section, data); 221 } 222 194 223 void setString(std::wstring section, std::wstring key, std::wstring value) { 195 224 if (coreFile_ != NULL) … … 218 247 }; 219 248 220 class INISettings : public TSettings249 class INISettings : public settings_base 221 250 { 222 251 private: … … 251 280 return settingsBundle.getSections(bufferLength); 252 281 } 282 void setSection(std::wstring section, settings_base::sectionList data) { 283 return settingsBundle.setSection(section, data); 284 } 253 285 254 286 /** -
include/REGSettings.h
r1d53fe0 rb39c1f3 10 10 11 11 #include <iostream> 12 class REGSettings : public TSettings12 class REGSettings : public settings_base 13 13 { 14 14 public: … … 216 216 return ret; 217 217 } 218 void setSection(std::wstring section, sectionList data) { 219 std::wcout << _T("Unsupported function call") << std::endl; 220 } 218 221 }; -
include/Settings.h
rfebff5f rb39c1f3 39 39 }; 40 40 41 class SettingsT41 class settings_core 42 42 { 43 43 private: … … 54 54 std::wstring basepath_; 55 55 bool bHasInternalData; 56 TSettings*settingsManager;56 settings_base *settingsManager; 57 57 58 58 public: 59 59 typedef std::list<std::wstring> sectionList; 60 SettingsT(void) : bHasInternalData(false), settingsManager(NULL)60 settings_core(void) : bHasInternalData(false), settingsManager(NULL) 61 61 { 62 62 } 63 63 64 virtual ~ SettingsT(void)64 virtual ~settings_core(void) 65 65 { 66 66 if (settingsManager) … … 103 103 void read(int type = -1) { 104 104 bool bNew = false; 105 TSettings*sM = settingsManager;105 settings_base *sM = settingsManager; 106 106 if (settingsManager == NULL) 107 107 throw SettingsException(_T("No settings method specified, cannot start")); … … 160 160 } 161 161 } 162 void writeSection(std::wstring section, sectionList data) { 163 if (settingsManager == NULL) 164 throw SettingsException(_T("No settings method specified, cannot start")); 165 if (settingsManager->getActiveTypeID() == INISettings::getType()) 166 settingsManager->setSection(section, data); 167 else 168 throw SettingsException(_T("Writing modules to non-INI file is not supported")); 169 } 162 170 void write(int type = -1) { 163 171 bool bNew = false; 164 TSettings*sM = settingsManager;172 settings_base *sM = settingsManager; 165 173 if (settingsManager == NULL) 166 174 throw SettingsException(_T("No settings method specified, cannot start")); … … 294 302 }; 295 303 296 typedef Singleton< SettingsT> Settings; // Implement the settings manager as a singleton304 typedef Singleton<settings_core> Settings; // Implement the settings manager as a singleton -
include/TSettings.h
r7e33d82 rb39c1f3 5 5 #define BUFF_LEN 4096 6 6 7 class TSettings7 class settings_base 8 8 { 9 9 public: 10 10 typedef std::list<std::wstring> sectionList; 11 TSettings(void)11 settings_base(void) 12 12 { 13 13 } 14 14 15 virtual ~ TSettings(void)15 virtual ~settings_base(void) 16 16 { 17 17 } … … 24 24 virtual void setInt(std::wstring section, std::wstring key, int value) = 0; 25 25 virtual int getActiveTypeID() = 0; 26 virtual void setSection(std::wstring section, sectionList data) = 0; 27 26 28 }; -
include/strEx.h
r3692371 rb39c1f3 214 214 while (pos != std::wstring::npos) { 215 215 string = string.substr(0,pos)+with+string.substr(pos+len); 216 pos = string.find(replace, pos+1); 216 if (with.find(replace) != std::wstring::npos) // If the replace containes the key look after the replace! 217 pos = string.find(replace, pos+with.length()); 218 else 219 pos = string.find(replace, pos+1); 217 220 } 218 221 } -
modules/CheckEventLog/Jamfile
r1d53fe0 rb39c1f3 13 13 #<user-interface>gui 14 14 <runtime-link>static 15 <source>/boost//regexp 15 16 16 17 : # default build -
modules/CheckSystem/CheckSystem.cpp
rb1ac2fa rb39c1f3 803 803 NSC_LOG_MESSAGE(error); 804 804 } 805 void report_debug(std::wstring error) { 806 NSC_DEBUG_MSG_STD(_T("PROC::: ") + error); 807 } 808 void report_debug_enter(std::wstring error) { 809 NSC_DEBUG_MSG_STD(_T("PROC>>> ") + error); 810 } 811 void report_debug_exit(std::wstring error) { 812 NSC_DEBUG_MSG_STD(_T("PROC<<<") + error); 813 } 805 814 }; 806 815 -
modules/CheckSystem/PDHCollector.cpp
ra34b229 rb39c1f3 107 107 memCb = _T("\\") + pdh.lookupIndex(4) + _T("\\") + pdh.lookupIndex(26); 108 108 } else { 109 SettingsTsettings;109 settings_core settings; 110 110 settings.setFile(NSCModuleHelper::getBasePath(), _T("counters.defs"), true); 111 111 NSC_DEBUG_MSG_STD(_T("Detected language: ") + settings.getString(section, _T("Description"), _T("Not found")) + _T(" (") + section + _T(")")); -
modules/LUAScript/script_wrapper.hpp
rbc97cd8 rb39c1f3 120 120 void push_string(lua_State *L, std::wstring s) { 121 121 lua_pushstring(L, strEx::wstring_to_string(s).c_str()); 122 } 123 void push_array(lua_State *L, std::list<std::wstring> &arr) { 124 lua_createtable(L, 0, arr.size()); 125 int i=0; 126 for (std::list<std::wstring>::const_iterator cit=arr.begin(); cit != arr.end(); ++cit) { 127 lua_pushnumber(L,i++); 128 lua_pushstring(L,strEx::wstring_to_string(*cit).c_str()); 129 lua_settable(L,-3); 130 } 122 131 } 123 132 … … 237 246 } 238 247 static int getSection (lua_State *L) { 239 NSC_DEBUG_MSG_STD(_T("LUA::setSettings")); 240 return 0; 248 int nargs = lua_gettop( L ); 249 if (nargs > 1) 250 return luaL_error(L, "Incorrect syntax: nscp.getSection([<section>]);"); 251 std::wstring v; 252 if (nargs > 0) 253 v = pop_string(L); 254 try { 255 std::list<std::wstring> list = NSCModuleHelper::getSettingsSection(v); 256 push_array(L, list); 257 } catch (...) { 258 return luaL_error(L, "Unknown exception getting section"); 259 } 260 return 1; 241 261 } 242 262 static int info (lua_State *L) { -
modules/NRPEListener/NRPEListener.cpp
rb1ac2fa rb39c1f3 324 324 } catch (NRPEPacket::NRPEPacketException e) { 325 325 NSC_LOG_ERROR_STD(_T("NRPESocketException: ") + e.getMessage()); 326 client->close(); 327 return; 326 NRPEPacket err(NRPEPacket::responsePacket, NRPEPacket::version2, NSCAPI::returnUNKNOWN, _T("Could not construct return paket in NRPE handler check clientside (nsclient.log) logs..."), buffer_length_); 327 try { 328 block.copyFrom(out.getBuffer(), out.getBufferLength()); 329 } catch (NRPEPacket::NRPEPacketException e) { 330 NSC_LOG_ERROR_STD(_T("NRPESocketException (again): ") + e.getMessage()); 331 client->close(); 332 return; 333 } 328 334 } 329 335 int maxWait = socketTimeout_*10; -
scripts/test.lua
rbc97cd8 rb39c1f3 10 10 nscp.register('lua_debug', 'debug') 11 11 nscp.register('foo', 'something') 12 nscp.register('lua_alias', 'execute_all_alias') 12 13 13 14 function something (command) … … 20 21 end 21 22 23 function execute_all_alias() 24 commands = nscp.getSection('External Alias') 25 ok = 0 26 err = 0 27 for i,key in pairs(commands) do 28 args = nscp.getSetting('External Alias', key) 29 code, msg, perf = nscp.execute(key,args) 30 if code == 'ok' then 31 ok = ok + 1 32 else 33 err = err + 1 34 print('[' .. i .. '] ' .. key .. ': ' .. code .. ' <' .. msg ..'>') 35 end 36 end 37 if err == 0 then 38 return 'ok', 'All ' .. ok .. ' commands were ok' 39 else 40 return 'error', 'Only ' .. ok .. ' commands of the ' .. (ok+err) .. ' were successfull' 41 end 42 end 22 43 23 44 function debug (command, args)
Note: See TracChangeset
for help on using the changeset viewer.








