Changeset 580392ac in nscp
- Timestamp:
- 11/18/06 14:14:22 (7 years ago)
- Children:
- 858709e
- Parents:
- edbbfbb
- Location:
- trunk
- Files:
-
- 11 edited
-
changelog (modified) (4 diffs)
-
counters.defs (modified) (1 diff)
-
include/Socket.h (modified) (1 diff)
-
include/config.h (modified) (2 diffs)
-
include/thread.h (modified) (10 diffs)
-
modules/CheckDisk/CheckDisk.cpp (modified) (3 diffs)
-
modules/CheckSystem/CheckSystem.cpp (modified) (3 diffs)
-
modules/CheckSystem/PDHCollector.cpp (modified) (3 diffs)
-
modules/NRPEListener/NRPEListener.cpp (modified) (1 diff)
-
modules/NSClientListener/NSClientListener.cpp (modified) (1 diff)
-
modules/SysTray/SysTray.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/changelog
r8fcc179 r580392ac 11 11 * Add option to recheck DNS in real time 12 12 13 2006-11-18 MickeM 14 + Added support for empty NRPE checking (i.e.. chec_nrpe without a -c argument) 15 * Added error message when detected language is missing from counters.defs 16 + Added Swedish locale to counters.defs (yes, I switched to Swedish XP on my computer :) 17 * Fixed : (and possibly other problems) in counters when checking from check_nt (via NSCLient protocol) 18 + Added CheckAllExcept to CheckDrive to check all except the specified drives. 19 13 20 2006-10-05 MickeM 14 21 * Yayyy!!! (first fix in a looong while :) … … 20 27 NOTICE this is "slow" since all hosts in the list are "looked up" each time you get a NRPE/NSClient 21 28 request it will be "slow" but I think it is not that much of a problem really. 22 NOTICE I don t have the posibility to test this so feel free to report if it works and if it doesn't.29 NOTICE I don't have the possibility to test this so feel free to report if it works and if it doesn't. 23 30 Set cache_allowed_hosts=0 to disable host cache 24 31 … … 100 107 CheckWMI MaxWarn=10 MaxCrit=15 "Query:load=Select LoadPercentage from win32_Processor" 101 108 The Max* are as every other check and sets limits. 102 The Query works similarly to other check commands i e. Query:<name>=<WMI query>109 The Query works similarly to other check commands i.e.. Query:<name>=<WMI query> 103 110 So any other WMI query should work (notice this is experimental and not stable and has virtually 104 111 no error handling so it is likely to crash nsclient if you ask anything "non working".) … … 252 259 253 260 2005-03-19 MickeM 254 * Re factored out NSCLient Listener as a separate module261 * Re factored out NSCLient Listener as a separate module 255 262 + Added initial NRPE listener module (not yet implemented only a shell) 256 263 * Changed Module API (Inject function has new syntax) -
trunk/counters.defs
redbbfbb r580392ac 67 67 NT4_MemoryCommitByte = "\Memória\Bytes confirmados" 68 68 69 70 [0x041d] 71 Description = "Swedish SE" 72 73 W2K_SystemTotalProcessorTime = "\Processor(_Total)\% processortid" 74 W2K_SystemSystemUpTime = "\System\Tid sedan systemstart" 75 W2K_MemoryCommitLimit = "\Minne\Dedikationsgräns" 76 W2K_MemoryCommitByte = "\Minne\Dedicerade byte" -
trunk/include/Socket.h
rde0bdb0 r580392ac 247 247 248 248 public: 249 Listener() : pHandler_(NULL), bindPort_(0), bindAddres_(INADDR_ANY), listenQue_(0) {};249 Listener() : pHandler_(NULL), bindPort_(0), bindAddres_(INADDR_ANY), listenQue_(0), threadManager_("listenThreadManager") {}; 250 250 virtual ~Listener() { 251 251 if (responderList_.size() > 0) { -
trunk/include/config.h
r8fcc179 r580392ac 5 5 6 6 // Version 7 #define SZVERSION "0.2. 5h 2006-03-01"7 #define SZVERSION "0.2.6 2006-11-18" 8 8 9 9 // internal name of the service … … 32 32 #define NSCLIENT "nsclient" 33 33 #define CHECK_ALL "CheckAll" 34 #define CHECK_ALL_OTHERS "CheckAllOthers" 34 35 35 36 // NSClient Setting headlines -
trunk/include/thread.h
r237da21 r580392ac 8 8 std::string e_; 9 9 ThreadException(std::string e) : e_(e) { 10 std::c out<< e << std::endl;10 std::cerr << e << std::endl; 11 11 } 12 12 }; … … 38 38 class Thread { 39 39 private: 40 std::string threadid_; 40 41 HANDLE hThread_; // Thread handle 41 42 T* pObject_; // Wrapped object … … 60 61 * Sets up default values 61 62 */ 62 Thread( ) :hThread_(NULL), pObject_(NULL), uThreadID(-1), bThreadHasTerminated(false), bThreadHasBeenClosed(false) {63 Thread(std::string threadid) : threadid_(threadid), hThread_(NULL), pObject_(NULL), uThreadID(-1), bThreadHasTerminated(false), bThreadHasBeenClosed(false) { 63 64 hMutex_ = CreateMutex(NULL, FALSE, NULL); 64 65 assert(hMutex_ != NULL); … … 74 75 ; 75 76 else if (bThreadHasBeenClosed||bThreadHasTerminated) 76 std::cout << "Thread has not terminated correctly ..." << std::endl;77 std::cout << "Thread has not terminated correctly: " << threadid_ << "..." << std::endl; 77 78 /* 78 79 MutexLock mutex(hMutex_, 5000L); … … 132 133 MutexLock mutex(hMutex_, 5000L); 133 134 if (!mutex.hasMutex()) { 134 throw ThreadException("Could not retrieve mutex, thread not started...");135 throw ThreadException("Could not retrieve mutex, thread (" + threadid_ + ") not started..."); 135 136 } 136 137 if (pObject_) { 137 throw ThreadException("Thread already started, thread not started...");138 throw ThreadException("Thread already started, thread (" + threadid_ + ") not started..."); 138 139 } 139 140 // assert(hStopEvent_ == NULL); … … 158 159 MutexLock mutex(hMutex_, delay); 159 160 if (!mutex.hasMutex()) { 160 throw ThreadException("Could not retrieve mutex, thread not stopped...");161 throw ThreadException("Could not retrieve mutex, thread (" + threadid_ + ") not stopped..."); 161 162 } 162 163 if (!pObject_) … … 172 173 return true; 173 174 } 174 std::c out << "Failed to terminate thread..." << std::endl;175 std::cerr << "Failed to terminate thread: " << threadid_ << "..." << std::endl; 175 176 assert(false); 176 177 return false; … … 179 180 MutexLock mutex(hMutex_, 5000L); 180 181 if (!mutex.hasMutex()) { 181 throw ThreadException("Could not retrieve mutex, thread not stopped...");182 throw ThreadException("Could not retrieve mutex, thread (" + threadid_ + ") not stopped..."); 182 183 } 183 184 return pObject_ != NULL; … … 186 187 MutexLock mutex(hMutex_, 5000L); 187 188 if (!mutex.hasMutex()) { 188 throw ThreadException("Could not retrieve mutex, thread not stopped...");189 throw ThreadException("Could not retrieve mutex, thread (" + threadid_ + ") not stopped..."); 189 190 } 190 191 return pObject_; … … 193 194 MutexLock mutex(hMutex_, 5000L); 194 195 if (!mutex.hasMutex()) { 195 throw ThreadException("Could not retrieve mutex, thread not stopped...");196 throw ThreadException("Could not retrieve mutex, thread (" + threadid_ + ") not stopped..."); 196 197 } 197 198 return pObject_; -
trunk/modules/CheckDisk/CheckDisk.cpp
r99bb030 r580392ac 100 100 bool bFilterCDROM = false; 101 101 bool bCheckAll = false; 102 bool bCheckAllOthers = false; 102 103 bool bNSClient = false; 103 104 std::list<DriveConatiner> drives; … … 113 114 MAP_OPTIONS_BOOL_TRUE(NSCLIENT, bNSClient) 114 115 MAP_OPTIONS_BOOL_TRUE(CHECK_ALL, bCheckAll) 116 MAP_OPTIONS_BOOL_TRUE(CHECK_ALL_OTHERS, bCheckAllOthers) 115 117 MAP_OPTIONS_SECONDARY_BEGIN(":", p2) 116 118 else if (p2.first == "Drive") { … … 143 145 dwDrives >>= 1; 144 146 } 147 } 148 if (bCheckAllOthers) { 149 std::list<DriveConatiner> checkdrives; 150 DWORD dwDrives = GetLogicalDrives(); 151 int idx = 0; 152 while (dwDrives != 0) { 153 if (dwDrives & 0x1) { 154 std::string drv; 155 drv += static_cast<char>('A' + idx); drv += ":\\"; 156 UINT drvType = GetDriveType(drv.c_str()); 157 if ( ((!bFilter)&&(drvType == DRIVE_FIXED)) || 158 ((bFilter)&&(bFilterFixed)&&(drvType==DRIVE_FIXED)) || 159 ((bFilter)&&(bFilterCDROM)&&(drvType==DRIVE_CDROM)) || 160 ((bFilter)&&(bFilterRemote)&&(drvType==DRIVE_REMOTE)) || 161 ((bFilter)&&(bFilterRemovable)&&(drvType==DRIVE_REMOVABLE)) ) 162 { 163 bool bFound = false; 164 for (std::list<DriveConatiner>::const_iterator pit = drives.begin();pit!=drives.end();++pit) { 165 DriveConatiner drive = (*pit); 166 if (drive.data == drv) 167 bFound = true; 168 } 169 if (!bFound) 170 checkdrives.push_back(DriveConatiner(drv, tmpObject.warn, tmpObject.crit)); 171 } 172 } 173 idx++; 174 dwDrives >>= 1; 175 } 176 drives = checkdrives; 145 177 } 146 178 -
trunk/modules/CheckSystem/CheckSystem.cpp
r8fcc179 r580392ac 31 31 * @return 32 32 */ 33 CheckSystem::CheckSystem() : processMethod_(0) {}33 CheckSystem::CheckSystem() : processMethod_(0), pdhThread("pdhThread") {} 34 34 /** 35 35 * Default d-tor … … 796 796 if (!PDH::Enumerations::validate(counter.data, tstr)) { 797 797 msg = tstr; 798 msg += " (" + counter.getAlias() + "|" + counter.data + ")"; 798 799 return NSCAPI::returnUNKNOWN; 799 800 } … … 817 818 } 818 819 } catch (const PDH::PDHException e) { 819 NSC_LOG_ERROR_STD("ERROR: " + e.getError() + " (" + counter.getAlias() + " )");820 msg = static_cast<std::string>("ERROR: ") + e.getError() ;820 NSC_LOG_ERROR_STD("ERROR: " + e.getError() + " (" + counter.getAlias() + "|" + counter.data + ")"); 821 msg = static_cast<std::string>("ERROR: ") + e.getError()+ " (" + counter.getAlias() + "|" + counter.data + ")"; 821 822 return NSCAPI::returnUNKNOWN; 822 823 } -
trunk/modules/CheckSystem/PDHCollector.cpp
r8fcc179 r580392ac 67 67 settings.setFile(NSCModuleHelper::getBasePath() + "\\counters.defs", true); 68 68 69 NSC_LOG_ERROR_STD("Getting counter info..."); 69 70 70 71 try { … … 93 94 section = "0000" + strEx::ihextos(langId); 94 95 section = "0x" + section.substr(section.length()-4); 96 if (settings.getString(section, "Description", "_NOT_FOUND") == "_NOT_FOUND") { 97 NSC_LOG_ERROR_STD("Detected language: " + section + " but it could not be found in: counters.defs"); 98 NSC_LOG_ERROR_STD("You need to manually configure performance counters!"); 99 return 0; 100 } 95 101 NSC_DEBUG_MSG_STD("Detected language: " + settings.getString(section, "Description", "Not found") + " (" + section + ")"); 96 102 } catch (systemInfo::SystemInfoException e) { … … 111 117 } 112 118 119 NSC_LOG_ERROR_STD("Attempting to open counter..."); 113 120 try { 114 121 pdh.open(); 122 NSC_LOG_ERROR_STD("Counters opend..."); 115 123 } catch (const PDH::PDHException &e) { 116 124 NSC_LOG_ERROR_STD("Failed to open performance counters: " + e.getError()); -
trunk/modules/NRPEListener/NRPEListener.cpp
rde0bdb0 r580392ac 325 325 } 326 326 strEx::token cmd = strEx::getToken(p.getPayload(), '!'); 327 if (cmd.first == "_NRPE_CHECK") { 328 return NRPEPacket(NRPEPacket::responsePacket, NRPEPacket::version2, NSCAPI::returnOK, "I ("SZVERSION") seem to be doing fine..."); 329 } 327 330 std::string msg, perf; 328 331 -
trunk/modules/NSClientListener/NSClientListener.cpp
rde0bdb0 r580392ac 160 160 case REQ_COUNTER: 161 161 cmd.first = "checkCounter"; 162 cmd.second +="&nsclient";162 cmd.second = "Counter=" + cmd.second + "&nsclient"; 163 163 break; 164 164 case REQ_FILEAGE: -
trunk/modules/SysTray/SysTray.cpp
r99bb030 r580392ac 16 16 } 17 17 18 SysTray::SysTray() {}18 SysTray::SysTray() : icon("SysTray") {} 19 19 SysTray::~SysTray() {} 20 20 bool SysTray::loadModule() {
Note: See TracChangeset
for help on using the changeset viewer.








