Changeset 8d928dd in nscp
- Timestamp:
- 11/21/07 21:53:18 (6 years ago)
- Children:
- 81cf57a
- Parents:
- 31509a7
- Location:
- trunk
- Files:
-
- 8 edited
-
AutoBuild.h (modified) (1 diff)
-
NSClient++-2005.vcproj (modified) (1 diff)
-
NSClient++.cpp (modified) (7 diffs)
-
changelog (modified) (1 diff)
-
include/config.h (modified) (1 diff)
-
modules/CheckSystem/CheckSystem.cpp (modified) (1 diff)
-
modules/CheckSystem/PDHCollector.cpp (modified) (3 diffs)
-
modules/CheckWMI/CheckWMI.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/AutoBuild.h
r31509a7 r8d928dd 3 3 // change the FALSE to TRUE for autoincrement of build number 4 4 #define INCREMENT_VERSION TRUE 5 #define FILEVER 0,2,7,8 46 #define PRODUCTVER 0,2,7,18 27 #define STRFILEVER "0.2.7.8 4"8 #define STRPRODUCTVER "0.2.7.18 2"9 #define STRPRODUCTDATE "2007-11- 18"5 #define FILEVER 0,2,7,88 6 #define PRODUCTVER 0,2,7,186 7 #define STRFILEVER "0.2.7.88" 8 #define STRPRODUCTVER "0.2.7.186" 9 #define STRPRODUCTDATE "2007-11-20" 10 10 #endif // AUTOBUILD_H -
trunk/NSClient++-2005.vcproj
r31509a7 r8d928dd 634 634 <Tool 635 635 Name="VCCustomBuildTool" 636 CommandLine="echo Seting up scripts
cmd /c "mkdir $(InputDir)\Dist\scripts\"
cmd /c "xcopy /Q /Y $(InputDir)\scripts\*.bat $(InputDir)\Dist\scripts\"
echo Removing old archive
cmd /c "del "$(InputDir)\Dist\modules\*.pdb""
cmd /c "del "$(InputDir)\Dist\*.zip""
echo Making archive
7z.exe a -r -tzip -bd $(TargetDir)\$(InputName)-$(PlatformName).zip $(TargetDir)\*
echo Renaming archive
postbuild.pl "$(TargetDir)\$(InputName)-$(PlatformName).zip"
echo Sending to server
pscp.exe $(TargetDir)\*.zipmickem@ssl.nakednuns.org:/var/www/files/nightly/
"636 CommandLine="echo Seting up scripts
cmd /c "mkdir "$(InputDir)\Dist\scripts\""
cmd /c "xcopy /Q /Y "$(InputDir)\scripts\*.*" "$(InputDir)\Dist\scripts\""
echo Removing old archive
cmd /c "del "$(InputDir)\Dist\modules\*.pdb""
cmd /c "del "$(InputDir)\Dist\*.zip""
echo Making archive
7z.exe a -r -tzip -bd "$(TargetDir)\$(ProjectName)-$(PlatformName).zip" "$(TargetDir)\*"
echo Renaming archive
postbuild.pl "$(TargetDir)\$(ProjectName)-$(PlatformName).zip"
echo Sending to server
pscp.exe "$(TargetDir)\*.zip" mickem@ssl.nakednuns.org:/var/www/files/nightly/
" 637 637 Outputs="$(InputDir)\Dist\$(ProjectName).zip" 638 638 /> -
trunk/NSClient++.cpp
r31509a7 r8d928dd 106 106 } else if ( _stricmp( "noboot", argv[1]+1 ) == 0 ) { 107 107 g_bConsoleLog = true; 108 mainClient.enableDebug(true); 108 109 int nRetCode = -1; 109 110 if (argc>=4) … … 181 182 try { 182 183 Settings::getInstance()->setFile(getBasePath(), "NSC.ini"); 184 if (debug_) { 185 Settings::getInstance()->setInt("log", "debug", 1); 186 } 183 187 } catch (SettingsException e) { 184 188 LOG_ERROR_STD("Could not find settings: " + e.getMessage()); … … 187 191 LOG_ERROR_STD("Unknown exception reading settings..."); 188 192 return false; 189 }190 if (debug_) {191 Settings::getInstance()->setInt("log", "debug", 1);192 193 } 193 194 … … 201 202 return false; 202 203 } 203 204 SettingsT::sectionList list = Settings::getInstance()->getSection("modules"); 205 for (SettingsT::sectionList::iterator it = list.begin(); it != list.end(); it++) { 206 try { 207 loadPlugin(getBasePath() + "modules\\" + (*it)); 208 } catch(const NSPluginException& e) { 209 LOG_ERROR_STD("Exception raised: " + e.error_ + " in module: " + e.file_); 210 return false; 211 } catch (...) { 212 LOG_ERROR_STD("Unknown exception loading plugin: " + (*it)); 213 return false; 214 } 204 try { 205 SettingsT::sectionList list = Settings::getInstance()->getSection("modules"); 206 for (SettingsT::sectionList::iterator it = list.begin(); it != list.end(); it++) { 207 try { 208 loadPlugin(getBasePath() + "modules\\" + (*it)); 209 } catch(const NSPluginException& e) { 210 LOG_ERROR_STD("Exception raised: " + e.error_ + " in module: " + e.file_); 211 return false; 212 } catch (...) { 213 LOG_ERROR_STD("Unknown exception loading plugin: " + (*it)); 214 return false; 215 } 216 } 217 } catch (SettingsException e) { 218 NSC_LOG_ERROR_STD("Failed to set settings file" + e.getMessage()); 215 219 } 216 220 try { … … 472 476 static status d = unknown; 473 477 if (d == unknown) { 474 if (Settings::getInstance()->getInt("log", "debug", 0) == 1) 478 try { 479 if (Settings::getInstance()->getInt("log", "debug", 0) == 1) 480 d = debug; 481 else 482 d = nodebug; 483 } catch (SettingsException e) { 475 484 d = debug; 476 else 477 d = nodebug; 485 } 478 486 } 479 487 return (d == debug); … … 554 562 basePath = path.substr(0, pos) + "\\"; 555 563 delete [] buffer; 556 Settings::getInstance()->setFile(basePath, "NSC.ini"); 564 try { 565 Settings::getInstance()->setFile(basePath, "NSC.ini"); 566 } catch (SettingsException e) { 567 NSC_LOG_ERROR_STD("Failed to set settings file" + e.getMessage()); 568 } 557 569 return basePath; 558 570 } … … 563 575 } 564 576 int NSAPIGetSettingsInt(const char* section, const char* key, int defaultValue) { 565 return Settings::getInstance()->getInt(section, key, defaultValue); 577 try { 578 return Settings::getInstance()->getInt(section, key, defaultValue); 579 } catch (SettingsException e) { 580 NSC_LOG_ERROR_STD("Failed to set settings file" + e.getMessage()); 581 } 566 582 } 567 583 NSCAPI::errorReturn NSAPIGetBasePath(char*buffer, unsigned int bufLen) { -
trunk/changelog
r31509a7 r8d928dd 5 5 * Add module for relaying events 6 6 * Add API for rehashing the daemon (or implement it the API is there but does nothing) 7 8 2007-11-21 MickeM 9 * Fixed process counter so checkProcState now return the *correct* number (previously it was correct-1) 10 * Fixed som missing exceptions that were not caught 11 + Added "AliasCol" option to CheckWMIValue to allow a column to be used as "alias" for a result set: 12 CheckWMIValue -a "Query=select Caption, ThreadCount from Win32_Process" MaxWarn=50 MaxCrit=100 Check:threads=ThreadCount AliasCol=Caption 13 will give you: "System threads: 98 > warning, svchost.exe threads: 87 > warning" 14 15 2007-11-20 MickeM 16 + Added new option to CheckSystem to override detected language (force_language=0x0014) 7 17 8 18 2007-11-19 MickeM -
trunk/include/config.h
rbab5a54 r8d928dd 108 108 #define C_SYSTEM_AUTODETECT_PDH "auto_detect_pdh" 109 109 #define C_SYSTEM_AUTODETECT_PDH_DEFAULT 1 110 #define C_SYSTEM_FORCE_LANGUAGE "force_language" 111 #define C_SYSTEM_FORCE_LANGUAGE_DEFAULT "" 110 112 111 113 #define C_SYSTEM_MEM_PAGE_LIMIT "MemoryCommitLimit" -
trunk/modules/CheckSystem/CheckSystem.cpp
rbab5a54 r8d928dd 725 725 for (BOOL OK = enumeration.GetProcessFirst(&entry); OK; OK = enumeration.GetProcessNext(&entry) ) { 726 726 NSPROCLST::iterator it = ret.find(entry.sFilename); 727 if (it == ret.end()) 727 if (it == ret.end()) { 728 728 ret[entry.sFilename].entry = entry; 729 else 729 ret[entry.sFilename].count = 1; 730 } else 730 731 (*it).second.count++; 731 732 } -
trunk/modules/CheckSystem/PDHCollector.cpp
rc1e3930 r8d928dd 64 64 SettingsT settings; 65 65 std::string prefix; 66 std::string section;67 66 settings.setFile(NSCModuleHelper::getBasePath(), "counters.defs", true); 68 69 NSC_LOG_ERROR_STD("Getting counter info..."); 67 std::string section = NSCModuleHelper::getSettingsString(C_SYSTEM_SECTION_TITLE, C_SYSTEM_FORCE_LANGUAGE, C_SYSTEM_FORCE_LANGUAGE_DEFAULT); 70 68 71 69 try { … … 92 90 } 93 91 94 section = "0000" + strEx::ihextos(langId); 95 section = "0x" + section.substr(section.length()-4); 92 if (!section.empty()) { 93 NSC_DEBUG_MSG_STD("Overriding language with: " + section); 94 } else { 95 section = "0000" + strEx::ihextos(langId); 96 section = "0x" + section.substr(section.length()-4); 97 } 96 98 if (settings.getString(section, "Description", "_NOT_FOUND") == "_NOT_FOUND") { 97 99 NSC_LOG_ERROR_STD("Detected language: " + section + " but it could not be found in: counters.defs"); … … 101 103 NSC_DEBUG_MSG_STD("Detected language: " + settings.getString(section, "Description", "Not found") + " (" + section + ")"); 102 104 } catch (const systemInfo::SystemInfoException &e) { 103 //NSC_LOG_ERROR_STD("System detection failed, PDH will be disabled: " + e.getError());104 105 NSC_LOG_ERROR_STD("To manual set performance counters you need to first set " C_SYSTEM_AUTODETECT_PDH "=0 in the config file, and then you also need to configure the various counter."); 105 106 return -1; -
trunk/modules/CheckWMI/CheckWMI.cpp
r22dec86 r8d928dd 155 155 unsigned int truncate = 0; 156 156 std::string query; 157 std::string aliasCol; 157 158 158 159 // Query=Select ... MaxWarn=5 MaxCrit=12 Check=Col1 --(later)-- Match==test Check=Col2 … … 163 164 MAP_OPTIONS_NUMERIC_ALL(tmpObject, "") 164 165 MAP_OPTIONS_STR("Alias", tmpObject.data) 166 MAP_OPTIONS_STR("AliasCol", aliasCol) 165 167 MAP_OPTIONS_STR("Query", query) 166 168 MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) … … 199 201 } 200 202 } 201 } else { 202 for (WMIQuery::result_type::const_iterator citRow = rows.begin(); citRow != rows.end(); ++citRow) { 203 bool found = false; 204 for (WMIQuery::wmi_row::list_type::const_iterator citCol = (*citRow).results.begin(); citCol != (*citRow).results.end(); ++citCol) { 205 if ((*citCol).first == itm.data) { 206 found = true; 207 long long value = (*citCol).second.numeric; 208 itm.runCheck(value, returnCode, message, perf); 209 } 210 } 211 if (!found) { 212 NSC_LOG_ERROR_STD("Column: " + itm.data + " was not found!"); 203 } 204 } 205 for (WMIQuery::result_type::const_iterator citRow = rows.begin(); citRow != rows.end(); ++citRow) { 206 bool found = false; 207 std::string alias; 208 if (!aliasCol.empty()) { 209 alias = (*citRow).get(aliasCol).string; 210 } 211 for (WMIQuery::wmi_row::list_type::const_iterator citCol = (*citRow).results.begin(); citCol != (*citRow).results.end(); ++citCol) { 212 for (std::list<WMIConatiner>::const_iterator it = list.begin(); it != list.end(); ++it) { 213 WMIConatiner itm = (*it); 214 if (itm.data == "*") { 215 found = true; 216 } else if ((*citCol).first == itm.data) { 217 std::string oldAlias = itm.alias; 218 if (!alias.empty()) 219 itm.alias = alias + " " + itm.getAlias(); 220 found = true; 221 long long value = (*citCol).second.numeric; 222 itm.runCheck(value, returnCode, message, perf); 223 itm.alias = oldAlias; 213 224 } 214 225 } 226 } 227 if (!found) { 228 NSC_LOG_ERROR_STD("A column was not found!"); 215 229 } 216 230 }
Note: See TracChangeset
for help on using the changeset viewer.








