Changeset 7da80b5 in nscp for trunk/modules/CheckSystem


Ignore:
Timestamp:
05/23/05 21:24:32 (8 years ago)
Author:
Michael Medin <michael@…>
Children:
e93e741
Parents:
3b8eb61
Message:

2005-05-23 MickeM

+ Added obfuscated password support
+ Added some more debug info on commands (returncode, and input args)
+ Added some more comments ot the NSC.ini
+ Added central password "override"
+ Added central "host override"
+ Fixed bug with external commands always getting WARNING state

2005-05-22 MickeM

+ Added debug outout for command
+ Added timestamps for log-to-file (date_mask to configure format)
+ Added support for "no password" with check_nt
+ Added log of bad password on NSClient requests.

  • Some threading issues fixed (I hate threading :)
Location:
trunk/modules/CheckSystem
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/CheckSystem/CheckSystem.cpp

    r3b8eb61 r7da80b5  
    297297  NSCAPI::nagiosReturn ret = NSCAPI::returnOK; 
    298298  bool bShowAll = false; 
     299  bool bNSClient = false; 
    299300 
    300301  for (arrayBuffer::arrayList::const_iterator it = stl_args.begin(); it != stl_args.end(); ++it) { 
     
    302303    if (t.first == SHOW_ALL) 
    303304      bShowAll = true; 
     305    else if (t.first == NSCLIENT) 
     306      bNSClient = true; 
    304307    else if (t.first == SHOW_FAIL)  { 
    305308      bShowAll = false; 
     
    339342  } 
    340343  if (msg.empty()) 
    341     msg ="All services ok."; 
     344    msg ="All services are running."; 
     345  else if (!bNSClient) 
     346    msg = NSCHelper::translateReturn(ret) + ": " + msg; 
    342347  return ret; 
    343348} 
     
    345350 
    346351/** 
    347  * Check availible memory and return various check results 
     352 * Check available memory and return various check results 
    348353 * Example: checkMem showAll maxWarn=50 maxCrit=75 
    349354 * 
     
    468473  NSCAPI::nagiosReturn ret = NSCAPI::returnOK; 
    469474  bool bShowAll = false; 
     475  bool bNSClient = false; 
    470476 
    471477  for (arrayBuffer::arrayList::const_iterator it = stl_args.begin(); it != stl_args.end(); ++it) { 
     
    473479    if (t.first == SHOW_ALL) 
    474480      bShowAll = true; 
     481    else if (t.first == NSCLIENT) 
     482      bNSClient = true; 
    475483    else if (t.first == SHOW_FAIL)  { 
    476484      bShowAll = false; 
     
    518526  if (msg.empty()) 
    519527    msg ="All processes ok."; 
     528  else if (!bNSClient) 
     529    msg = NSCHelper::translateReturn(ret) + ": " + msg; 
    520530  return ret; 
    521531} 
     
    583593    try { 
    584594      PDH::PDHQuery pdh; 
    585       PDHCollectors::StaticPDHCounterListener counter; 
     595      PDHCollectors::StaticPDHCounterListenerInt counter; 
    586596      std::string name = (*it).first; 
    587597      if (name.empty()) 
     
    591601      pdh.collect(); 
    592602      if (bNSCLientCompatible) { 
     603//        std::cout << counter.getValue() << std::endl; 
    593604        msg += strEx::itos(counter.getValue()); 
    594605      } else { 
  • trunk/modules/CheckSystem/PDHCollector.cpp

    r3b8eb61 r7da80b5  
    3636 
    3737/** 
    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  */ 
     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*/ 
    5151DWORD PDHCollector::threadProc(LPVOID lpParameter) { 
    5252  PDH::PDHQuery pdh; 
     
    103103 
    104104/** 
    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*/ 
    107107void PDHCollector::exitThread(void) { 
    108108  MutexLock mutex(mutexHandler); 
     
    116116    if (!SetEvent(hStopEvent_)) { 
    117117      NSC_LOG_ERROR_STD("SetStopEvent failed"); 
    118   } 
     118    } 
    119119} 
    120120/** 
    121  * Get the average CPU usage for "time" 
    122  * @param time Time to check  
    123  * @return average CPU usage 
    124  */ 
     121* Get the average CPU usage for "time" 
     122* @param time Time to check  
     123* @return average CPU usage 
     124*/ 
    125125int PDHCollector::getCPUAvrage(std::string time) { 
    126126  unsigned int mseconds = strEx::stoui_as_time(time, checkIntervall_*100); 
     
    133133} 
    134134/** 
    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  */ 
     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*/ 
    140140long long PDHCollector::getUptime() { 
    141141  MutexLock mutex(mutexHandler); 
     
    147147} 
    148148/** 
    149  * Memory commit limit (your guess is as good as mine to what this is :) 
    150  * @return Some form of memory check 
    151  */ 
     149* Memory commit limit (your guess is as good as mine to what this is :) 
     150* @return Some form of memory check 
     151*/ 
    152152long long PDHCollector::getMemCommitLimit() { 
    153153  MutexLock mutex(mutexHandler); 
     
    159159} 
    160160/** 
    161  * 
    162  * Memory committed bytes (your guess is as good as mine to what this is :) 
    163  * @return Some form of memory check 
    164  */ 
     161* 
     162* Memory committed bytes (your guess is as good as mine to what this is :) 
     163* @return Some form of memory check 
     164*/ 
    165165long long PDHCollector::getMemCommit() { 
    166166  MutexLock mutex(mutexHandler); 
  • trunk/modules/CheckSystem/PDHCollector.h

    r3b8eb61 r7da80b5  
    3030  int checkIntervall_; 
    3131 
    32   PDHCollectors::StaticPDHCounterListener memCmtLim; 
    33   PDHCollectors::StaticPDHCounterListener memCmt; 
    34   PDHCollectors::StaticPDHCounterListener upTime; 
     32  PDHCollectors::StaticPDHCounterListenerInt memCmtLim; 
     33  PDHCollectors::StaticPDHCounterListenerInt memCmt; 
     34  PDHCollectors::StaticPDHCounterListenerInt upTime; 
    3535  PDHCollectors::RoundINTPDHBufferListener cpu; 
    3636 
Note: See TracChangeset for help on using the changeset viewer.