Changeset 7da80b5 in nscp for trunk/modules/CheckSystem
- Timestamp:
- 05/23/05 21:24:32 (8 years ago)
- Children:
- e93e741
- Parents:
- 3b8eb61
- Location:
- trunk/modules/CheckSystem
- Files:
-
- 3 edited
-
CheckSystem.cpp (modified) (9 diffs)
-
PDHCollector.cpp (modified) (6 diffs)
-
PDHCollector.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/CheckSystem/CheckSystem.cpp
r3b8eb61 r7da80b5 297 297 NSCAPI::nagiosReturn ret = NSCAPI::returnOK; 298 298 bool bShowAll = false; 299 bool bNSClient = false; 299 300 300 301 for (arrayBuffer::arrayList::const_iterator it = stl_args.begin(); it != stl_args.end(); ++it) { … … 302 303 if (t.first == SHOW_ALL) 303 304 bShowAll = true; 305 else if (t.first == NSCLIENT) 306 bNSClient = true; 304 307 else if (t.first == SHOW_FAIL) { 305 308 bShowAll = false; … … 339 342 } 340 343 if (msg.empty()) 341 msg ="All services ok."; 344 msg ="All services are running."; 345 else if (!bNSClient) 346 msg = NSCHelper::translateReturn(ret) + ": " + msg; 342 347 return ret; 343 348 } … … 345 350 346 351 /** 347 * Check avail ible memory and return various check results352 * Check available memory and return various check results 348 353 * Example: checkMem showAll maxWarn=50 maxCrit=75 349 354 * … … 468 473 NSCAPI::nagiosReturn ret = NSCAPI::returnOK; 469 474 bool bShowAll = false; 475 bool bNSClient = false; 470 476 471 477 for (arrayBuffer::arrayList::const_iterator it = stl_args.begin(); it != stl_args.end(); ++it) { … … 473 479 if (t.first == SHOW_ALL) 474 480 bShowAll = true; 481 else if (t.first == NSCLIENT) 482 bNSClient = true; 475 483 else if (t.first == SHOW_FAIL) { 476 484 bShowAll = false; … … 518 526 if (msg.empty()) 519 527 msg ="All processes ok."; 528 else if (!bNSClient) 529 msg = NSCHelper::translateReturn(ret) + ": " + msg; 520 530 return ret; 521 531 } … … 583 593 try { 584 594 PDH::PDHQuery pdh; 585 PDHCollectors::StaticPDHCounterListener counter;595 PDHCollectors::StaticPDHCounterListenerInt counter; 586 596 std::string name = (*it).first; 587 597 if (name.empty()) … … 591 601 pdh.collect(); 592 602 if (bNSCLientCompatible) { 603 // std::cout << counter.getValue() << std::endl; 593 604 msg += strEx::itos(counter.getValue()); 594 605 } else { -
trunk/modules/CheckSystem/PDHCollector.cpp
r3b8eb61 r7da80b5 36 36 37 37 /** 38 * Thread that collects the data every "CHECK_INTERVAL" seconds.39 *40 * @param lpParameter Not used41 * @return thread exit status42 *43 * @author mickem44 *45 * @date 03-13-200446 *47 * @bug If we have "custom named" counters ?48 * @bug This whole concept needs work I think.49 *50 */38 * Thread that collects the data every "CHECK_INTERVAL" seconds. 39 * 40 * @param lpParameter Not used 41 * @return thread exit status 42 * 43 * @author mickem 44 * 45 * @date 03-13-2004 46 * 47 * @bug If we have "custom named" counters ? 48 * @bug This whole concept needs work I think. 49 * 50 */ 51 51 DWORD PDHCollector::threadProc(LPVOID lpParameter) { 52 52 PDH::PDHQuery pdh; … … 103 103 104 104 /** 105 * Request termination of the thread (waiting for thread termination is not handled)106 */105 * Request termination of the thread (waiting for thread termination is not handled) 106 */ 107 107 void PDHCollector::exitThread(void) { 108 108 MutexLock mutex(mutexHandler); … … 116 116 if (!SetEvent(hStopEvent_)) { 117 117 NSC_LOG_ERROR_STD("SetStopEvent failed"); 118 }118 } 119 119 } 120 120 /** 121 * Get the average CPU usage for "time"122 * @param time Time to check123 * @return average CPU usage124 */121 * Get the average CPU usage for "time" 122 * @param time Time to check 123 * @return average CPU usage 124 */ 125 125 int PDHCollector::getCPUAvrage(std::string time) { 126 126 unsigned int mseconds = strEx::stoui_as_time(time, checkIntervall_*100); … … 133 133 } 134 134 /** 135 * Get uptime from counter136 * @bug Do we need to collect this all the time ? (perhaps we can collect this in real time ?)137 * @return uptime for the system138 * @bug Are we overflow protected here ? (seem to recall some issues with overflow before ?)139 */135 * Get uptime from counter 136 * @bug Do we need to collect this all the time ? (perhaps we can collect this in real time ?) 137 * @return uptime for the system 138 * @bug Are we overflow protected here ? (seem to recall some issues with overflow before ?) 139 */ 140 140 long long PDHCollector::getUptime() { 141 141 MutexLock mutex(mutexHandler); … … 147 147 } 148 148 /** 149 * Memory commit limit (your guess is as good as mine to what this is :)150 * @return Some form of memory check151 */149 * Memory commit limit (your guess is as good as mine to what this is :) 150 * @return Some form of memory check 151 */ 152 152 long long PDHCollector::getMemCommitLimit() { 153 153 MutexLock mutex(mutexHandler); … … 159 159 } 160 160 /** 161 *162 * Memory committed bytes (your guess is as good as mine to what this is :)163 * @return Some form of memory check164 */161 * 162 * Memory committed bytes (your guess is as good as mine to what this is :) 163 * @return Some form of memory check 164 */ 165 165 long long PDHCollector::getMemCommit() { 166 166 MutexLock mutex(mutexHandler); -
trunk/modules/CheckSystem/PDHCollector.h
r3b8eb61 r7da80b5 30 30 int checkIntervall_; 31 31 32 PDHCollectors::StaticPDHCounterListener memCmtLim;33 PDHCollectors::StaticPDHCounterListener memCmt;34 PDHCollectors::StaticPDHCounterListener upTime;32 PDHCollectors::StaticPDHCounterListenerInt memCmtLim; 33 PDHCollectors::StaticPDHCounterListenerInt memCmt; 34 PDHCollectors::StaticPDHCounterListenerInt upTime; 35 35 PDHCollectors::RoundINTPDHBufferListener cpu; 36 36
Note: See TracChangeset
for help on using the changeset viewer.








