Changeset 0687108 in nscp for modules


Ignore:
Timestamp:
11/18/06 14:14:22 (7 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
d48c31a
Parents:
1a22e52
Message:

+ Added support for empty NRPE checking (i.e.. chec_nrpe without a -c argument)

  • Added error message when detected language is missing from counters.defs + Added Swedish locale to counters.defs (yes, I switched to Swedish XP on my computer :)
  • Fixed : (and possibly other problems) in counters when checking from check_nt (via NSCLient protocol) + Added CheckAllExcept? to CheckDrive? to check all except the specified drives.
Location:
modules
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • modules/CheckDisk/CheckDisk.cpp

    rf42280d r0687108  
    100100  bool bFilterCDROM = false; 
    101101  bool bCheckAll = false; 
     102  bool bCheckAllOthers = false; 
    102103  bool bNSClient = false; 
    103104  std::list<DriveConatiner> drives; 
     
    113114    MAP_OPTIONS_BOOL_TRUE(NSCLIENT, bNSClient) 
    114115    MAP_OPTIONS_BOOL_TRUE(CHECK_ALL, bCheckAll) 
     116    MAP_OPTIONS_BOOL_TRUE(CHECK_ALL_OTHERS, bCheckAllOthers) 
    115117    MAP_OPTIONS_SECONDARY_BEGIN(":", p2) 
    116118      else if (p2.first == "Drive") { 
     
    143145      dwDrives >>= 1; 
    144146    } 
     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; 
    145177  } 
    146178 
  • modules/CheckSystem/CheckSystem.cpp

    r76aafc4 r0687108  
    3131 * @return  
    3232 */ 
    33 CheckSystem::CheckSystem() : processMethod_(0) {} 
     33CheckSystem::CheckSystem() : processMethod_(0), pdhThread("pdhThread") {} 
    3434/** 
    3535 * Default d-tor 
     
    796796      if (!PDH::Enumerations::validate(counter.data, tstr)) { 
    797797        msg = tstr; 
     798        msg += " (" + counter.getAlias() + "|" + counter.data + ")"; 
    798799        return NSCAPI::returnUNKNOWN; 
    799800      } 
     
    817818      } 
    818819    } 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 + ")"; 
    821822      return NSCAPI::returnUNKNOWN; 
    822823    } 
  • modules/CheckSystem/PDHCollector.cpp

    r76aafc4 r0687108  
    6767    settings.setFile(NSCModuleHelper::getBasePath() + "\\counters.defs", true); 
    6868 
     69    NSC_LOG_ERROR_STD("Getting counter info..."); 
    6970 
    7071    try { 
     
    9394      section = "0000" + strEx::ihextos(langId); 
    9495      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      } 
    95101      NSC_DEBUG_MSG_STD("Detected language: " + settings.getString(section, "Description", "Not found") + " (" + section + ")"); 
    96102    } catch (systemInfo::SystemInfoException e) { 
     
    111117  } 
    112118 
     119  NSC_LOG_ERROR_STD("Attempting to open counter..."); 
    113120  try { 
    114121    pdh.open(); 
     122    NSC_LOG_ERROR_STD("Counters opend..."); 
    115123  } catch (const PDH::PDHException &e) { 
    116124    NSC_LOG_ERROR_STD("Failed to open performance counters: " + e.getError()); 
  • modules/NRPEListener/NRPEListener.cpp

    r9ce8b01 r0687108  
    325325  } 
    326326  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  } 
    327330  std::string msg, perf; 
    328331 
  • modules/NSClientListener/NSClientListener.cpp

    r9ce8b01 r0687108  
    160160    case REQ_COUNTER: 
    161161      cmd.first = "checkCounter"; 
    162       cmd.second += "&nsclient"; 
     162      cmd.second = "Counter=" + cmd.second + "&nsclient"; 
    163163      break; 
    164164    case REQ_FILEAGE: 
  • modules/SysTray/SysTray.cpp

    rf42280d r0687108  
    1616} 
    1717 
    18 SysTray::SysTray() {} 
     18SysTray::SysTray() : icon("SysTray") {} 
    1919SysTray::~SysTray() {} 
    2020bool SysTray::loadModule() { 
Note: See TracChangeset for help on using the changeset viewer.