Changeset f896cfb in nscp


Ignore:
Timestamp:
05/16/05 18:32:31 (8 years ago)
Author:
Michael Medin <michael@…>
Children:
3b8eb61
Parents:
7b04f88
Message:

2005-05-15 MickeM

+ Added NRPE support for checkCounter
+ Updated documentation

  • Make check commands ignore case + Added CheckHelpers module to alter the result of various check and similar things

2005-05-14 MickeM

+ Added support for Volumes (CheckDisk)
+ Added support for checking all drives of a certain kind
+ Added support for altering filter (makes it posible to check removale drives)
+ Created webpage and better documentation

Location:
trunk
Files:
12 added
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/Doxyfile

    re0705d4 rf896cfb  
    5252HIDE_IN_BODY_DOCS      = NO 
    5353INTERNAL_DOCS          = NO 
    54 CASE_SENSE_NAMES       = YES 
     54CASE_SENSE_NAMES       = NO 
    5555HIDE_SCOPE_NAMES       = NO 
    5656SHOW_INCLUDE_FILES     = YES 
     
    7171# configuration options related to warning and progress messages 
    7272#--------------------------------------------------------------------------- 
    73 QUIET                  = NO 
     73QUIET                  = YES 
    7474WARNINGS               = YES 
    7575WARN_IF_UNDOCUMENTED   = YES 
    7676WARN_IF_DOC_ERROR      = YES 
    7777WARN_NO_PARAMDOC       = YES 
    78 WARN_FORMAT            = "$file($line) $text" 
     78WARN_FORMAT            = "$file($line) : $text" 
    7979WARN_LOGFILE           =  
    8080#--------------------------------------------------------------------------- 
    8181# configuration options related to the input files 
    8282#--------------------------------------------------------------------------- 
    83 INPUT                  = C:\Source\NSClient++ 
     83INPUT                  = C:\Source\nscplus 
    8484FILE_PATTERNS          = *.cpp \ 
    8585                         *.h \ 
  • trunk/NSCPlugin.cpp

    r5d8e0b5 rf896cfb  
    127127 * Plug ins may refuse to handle the plug in (if not applicable) by returning an empty string. 
    128128 * 
    129  * @param *command The command name (is a string encoded number for legacy commands) 
     129 * @param command The command name (is a string encoded number for legacy commands) 
    130130 * @param argLen The length of the argument buffer. 
    131131 * @param **arguments The arguments for this command 
    132  * @param returnBuffer Return buffer for plug in to store the result of the executed command. 
    133  * @param returnBufferLen Size of the return buffer. 
     132 * @param returnMessageBuffer Return buffer for plug in to store the result of the executed command. 
     133 * @param returnMessageBufferLen Size of returnMessageBuffer 
     134 * @param returnPerfBuffer Return buffer for performance data 
     135 * @param returnPerfBufferLen Sixe of returnPerfBuffer 
    134136 * @return Status of execution. Could be error codes, buffer length messages etc. 
    135137 * @throws NSPluginException if the module is not loaded. 
    136  * 
    137  * @todo Implement return status as an enum to make it simpler for clients to see potential return stats? 
    138  */ 
    139 NSCAPI::nagiosReturn NSCPlugin::handleCommand(const char *command, const unsigned int argLen, char **arguments, char* returnMessageBuffer, unsigned int returnMessageBufferLen, char* returnPerfBuffer, unsigned int returnPerfBufferLen) { 
     138 */ 
     139NSCAPI::nagiosReturn NSCPlugin::handleCommand(const char* command, const unsigned int argLen, char **arguments, char* returnMessageBuffer, unsigned int returnMessageBufferLen, char* returnPerfBuffer, unsigned int returnPerfBufferLen) { 
    140140  if (!isLoaded()) 
    141141    throw NSPluginException(file_, "Library is not loaded"); 
     
    150150 * @param line The line in the file that generated the message generally __LINE__ 
    151151 * @throws NSPluginException if the module is not loaded. 
    152  * @throws  
    153152 */ 
    154153void NSCPlugin::handleMessage(int msgType, const char* file, const int line, const char *message) { 
  • trunk/NSCPlugin.h

    r5d8e0b5 rf896cfb  
    4242   * 
    4343   * @param file DLL filename (for which the exception is thrown) 
    44    * @param error An error message (human readable format) 
     44   * @param sError An error message (human readable format) 
    4545   * @param nError Error code to be appended at the end of the string 
    4646   * @todo Change this to be some form of standard error code and merge with above. 
  • trunk/NSClient++.cpp

    rf22f5a9 rf896cfb  
    261261 * Inject a command into the plug-in stack. 
    262262 * 
    263  * @param buffer A command string to inject. This should be a unparsed command string such as command&arg1&arg2&arg... 
    264  * @return The result, empty string if no result 
     263 * @param command Command to inject 
     264 * @param argLen Length of argument buffer 
     265 * @param **argument Argument buffer 
     266 * @param *returnMessageBuffer Message buffer 
     267 * @param returnMessageBufferLen Length of returnMessageBuffer 
     268 * @param *returnPerfBuffer Performance data buffer 
     269 * @param returnPerfBufferLen Length of returnPerfBuffer 
     270 * @return The command status 
    265271 */ 
    266272NSCAPI::nagiosReturn NSClientT::injectRAW(const char* command, const unsigned int argLen, char **argument, char *returnMessageBuffer, unsigned int returnMessageBufferLen, char *returnPerfBuffer, unsigned int returnPerfBufferLen) { 
  • trunk/NSClient++.sln

    r5d8e0b5 rf896cfb  
    3535EndProject 
    3636Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CheckSystem", "modules\CheckSystem\CheckSystem.vcproj", "{2FCAF54B-AAD3-4F59-895A-8F9CEAFDC65D}" 
     37  ProjectSection(ProjectDependencies) = postProject 
     38  EndProjectSection 
     39EndProject 
     40Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CheckHelpers", "modules\CheckHelpers\CheckHelpers.vcproj", "{E6E588AB-EFEF-481C-9AF7-DCDCB95CFF45}" 
    3741  ProjectSection(ProjectDependencies) = postProject 
    3842  EndProjectSection 
     
    96100    {2FCAF54B-AAD3-4F59-895A-8F9CEAFDC65D}.Release.ActiveCfg = Release|Win32 
    97101    {2FCAF54B-AAD3-4F59-895A-8F9CEAFDC65D}.Release.Build.0 = Release|Win32 
     102    {E6E588AB-EFEF-481C-9AF7-DCDCB95CFF45}.Debug.ActiveCfg = Debug|Win32 
     103    {E6E588AB-EFEF-481C-9AF7-DCDCB95CFF45}.Debug.Build.0 = Debug|Win32 
     104    {E6E588AB-EFEF-481C-9AF7-DCDCB95CFF45}.Distribution.ActiveCfg = Distribution|Win32 
     105    {E6E588AB-EFEF-481C-9AF7-DCDCB95CFF45}.Distribution.Build.0 = Distribution|Win32 
     106    {E6E588AB-EFEF-481C-9AF7-DCDCB95CFF45}.Release.ActiveCfg = Release|Win32 
     107    {E6E588AB-EFEF-481C-9AF7-DCDCB95CFF45}.Release.Build.0 = Release|Win32 
    98108  EndGlobalSection 
    99109  GlobalSection(ExtensibilityGlobals) = postSolution 
  • trunk/NSClient++.vcproj

    r5d8e0b5 rf896cfb  
    359359        </FileConfiguration> 
    360360        <FileConfiguration 
    361           Name="Distribution|Win32" 
    362           ExcludedFromBuild="TRUE"> 
     361          Name="Distribution|Win32"> 
    363362          <Tool 
    364363            Name="VCCustomBuildTool" 
     
    402401            Outputs="$(InputDir)\Dist\$(InputFileName)"/> 
    403402        </FileConfiguration> 
     403      </File> 
     404      <File 
     405        RelativePath=".\readme.html"> 
    404406      </File> 
    405407      <File 
  • trunk/changelog

    rae192e3 rf896cfb  
    1 2004-04-20 MickeM 
     12005-05-15 MickeM 
     2 + Added NRPE support for checkCounter 
     3 + Updated documentation 
     4 * Make check commands ignore case 
     5 + Added CheckHelpers module to alter the result of various check and similar things  
     6 
     72005-05-14 MickeM 
     8 + Added support for Volumes (CheckDisk) 
     9 + Added support for checking all drives of a certain kind 
     10 + Added support for altering filter (makes it posible to check removale drives) 
     11 + Created webpage and better documentation 
     12 
     132005-04-20 MickeM 
    214 + Added multitasking to socket listsner (it can now handle multiple connections) 
    315 * Fixed bug in NSClientListener now "seqv" in check_nt shouldn't happen. 
    416 + Added COUNTER support to NSClient and CheckSystem 
    517 
    6 2004-04-19 MickeM 
     182005-04-19 MickeM 
    719 + Added SSL support 
    820 + Added alot of new options 
  • trunk/include/Mutex.h

    rf22f5a9 rf896cfb  
    9898   * Waits for the mutex object. 
    9999   * @param hMutex The mutex to use 
     100   * @timeout The timeout before abandoning wait 
    100101   */ 
    101102  MutexLock(HANDLE hMutex, DWORD timeout = 5000L) : bHasMutex(false), hMutex_(hMutex) { 
  • trunk/include/NSCHelper.cpp

    rf22f5a9 rf896cfb  
    66 
    77 
     8#ifdef DEBUG 
    89/** 
    910* Wrap a return string. 
     
    1516* @return NSCAPI::success unless the buffer is to short then it will be NSCAPI::invalidBufferLen 
    1617*/ 
    17 #ifdef DEBUG 
    1818NSCAPI::nagiosReturn NSCHelper::wrapReturnString(char *buffer, unsigned int bufLen, std::string str, NSCAPI::nagiosReturn defaultReturnCode /* = NSCAPI::success */) { 
    1919  if (str.length() >= bufLen) 
     
    2222  return defaultReturnCode; 
    2323} 
     24/** 
     25* Wrap a return string. 
     26* This function copies a string to a char buffer making sure the buffer has the correct length. 
     27* 
     28* @param *buffer Buffer to copy the string to. 
     29* @param bufLen Length of the buffer 
     30* @param str Th string to copy 
     31* @return NSCAPI::success unless the buffer is to short then it will be NSCAPI::invalidBufferLen 
     32*/ 
    2433NSCAPI::errorReturn NSCHelper::wrapReturnString(char *buffer, unsigned int bufLen, std::string str, NSCAPI::errorReturn defaultReturnCode /* = NSCAPI::success */) { 
    2534  if (str.length() >= bufLen) 
     
    2938} 
    3039#else 
     40/** 
     41* Wrap a return string. 
     42* This function copies a string to a char buffer making sure the buffer has the correct length. 
     43* 
     44* @param *buffer Buffer to copy the string to. 
     45* @param bufLen Length of the buffer 
     46* @param str Th string to copy 
     47* @param defaultReturnCode The default return code 
     48* @return NSCAPI::success unless the buffer is to short then it will be NSCAPI::invalidBufferLen 
     49*/ 
    3150int NSCHelper::wrapReturnString(char *buffer, unsigned int bufLen, std::string str, int defaultReturnCode ) { 
    3251  // @todo deprecate this 
    3352  if (str.length() >= bufLen) 
    34     return -1; 
     53    return NSCAPI::isInvalidBufferLen; 
    3554  strncpy(buffer, str.c_str(), bufLen); 
    3655  return defaultReturnCode; 
     
    6079  return "unknown"; 
    6180} 
     81/** 
     82 * Translate a return code into the corresponding string 
     83 * @param returnCode  
     84 * @return  
     85 */ 
    6286std::string NSCHelper::translateReturn(NSCAPI::nagiosReturn returnCode) { 
    6387  if (returnCode == NSCAPI::returnOK) 
     
    110134 * @throws NSCMHExcpetion When core pointer set is unavailable or an unknown inject error occurs. 
    111135 */ 
     136 
     137/** 
     138 * Inject a request command in the core (this will then be sent to the plug-in stack for processing) 
     139 * @param command Command to inject 
     140 * @param argLen The length of the argument buffer 
     141 * @param **argument The argument buffer 
     142 * @param *returnMessageBuffer Buffer to hold the returned message 
     143 * @param returnMessageBufferLen Length of returnMessageBuffer 
     144 * @param *returnPerfBuffer Buffer to hold the returned performance data 
     145 * @param returnPerfBufferLen returnPerfBuffer 
     146 * @return The returned status of the command 
     147 */ 
    112148NSCAPI::nagiosReturn NSCModuleHelper::InjectCommandRAW(const char* command, const unsigned int argLen, char **argument, char *returnMessageBuffer, unsigned int returnMessageBufferLen, char *returnPerfBuffer, unsigned int returnPerfBufferLen)  
    113149{ 
     
    116152  return fNSAPIInject(command, argLen, argument, returnMessageBuffer, returnMessageBufferLen, returnPerfBuffer, returnPerfBufferLen); 
    117153} 
     154/** 
     155 * Inject a request command in the core (this will then be sent to the plug-in stack for processing) 
     156 * @param command Command to inject (password should not be included. 
     157 * @param argLen The length of the argument buffer 
     158 * @param **argument The argument buffer 
     159 * @param message The return message buffer 
     160 * @param perf The return performance data buffer 
     161 * @return The return of the command 
     162 */ 
    118163NSCAPI::nagiosReturn NSCModuleHelper::InjectCommand(const char* command, const unsigned int argLen, char **argument, std::string & message, std::string & perf)  
    119164{ 
     
    151196 * Parses a string by splitting and makes the array and also manages return buffers and such. 
    152197 * @param command The command to execute 
    153  * @param buffer The buffer to splitwww.ikea.se 
    154  
     198 * @param buffer The buffer to split 
    155199 * @param splitChar The char to use as splitter 
     200 * @param message The return message buffer 
     201 * @param perf The return performance data buffer 
    156202 * @return The result of the command 
    157203 */ 
     
    170216  return ret; 
    171217} 
     218/** 
     219 * A wrapper around the InjetCommand that is simpler to use. 
     220 * @param command The command to execute 
     221 * @param buffer The buffer to split 
     222 * @param splitChar The char to use as splitter 
     223 * @param message The return message buffer 
     224 * @param perf The return performance data buffer 
     225 * @return The result of the command 
     226 */ 
    172227NSCAPI::nagiosReturn NSCModuleHelper::InjectSplitAndCommand(const std::string command, const std::string buffer, char splitChar, std::string & message, std::string & perf) 
    173228{ 
     
    214269  return ret; 
    215270} 
     271/** 
     272 * Get a section of settings strings 
     273 * @param section The section to retrieve 
     274 * @return The keys in the section 
     275 */ 
    216276std::list<std::string> NSCModuleHelper::getSettingsSection(std::string section) { 
    217277  if (!fNSAPIGetSettingsSection) 
     
    241301  return fNSAPIGetSettingsInt(section.c_str(), key.c_str(), defaultValue); 
    242302} 
    243  
    244  
    245 /*************************************************************************** 
    246 * max_state(STATE_x, STATE_y) 
    247 * compares STATE_x to  STATE_y and returns result based on the following 
    248 * STATE_UNKNOWN < STATE_OK < STATE_WARNING < STATE_CRITICAL 
    249 * 
    250 * Note that numerically the above does not hold 
    251 ****************************************************************************/ 
     303/** 
     304 * Returns the biggest of the two states 
     305 * STATE_UNKNOWN < STATE_OK < STATE_WARNING < STATE_CRITICAL 
     306 * @param a  
     307 * @param b  
     308 * @return  
     309 */ 
    252310NSCAPI::nagiosReturn NSCHelper::maxState(NSCAPI::nagiosReturn a, NSCAPI::nagiosReturn b) 
    253311{ 
     
    260318  else if (a == NSCAPI::returnUNKNOWN || b == NSCAPI::returnUNKNOWN) 
    261319    return NSCAPI::returnUNKNOWN; 
    262   /* 
    263   else if (a == STATE_DEPENDENT || b == STATE_DEPENDENT) 
    264   return STATE_DEPENDENT; 
    265   */ 
    266   //    else 
    267   throw "undefined state"; 
    268   //      return max (a, b); 
    269 } 
    270  
    271  
     320  return NSCAPI::returnUNKNOWN; 
     321} 
    272322/** 
    273323 * Retrieve the application name (in human readable format) from the core. 
     
    319369} 
    320370 
    321 ////////////////////////////////////////////////////////////////////////// 
    322 // Module helper functions 
    323 ////////////////////////////////////////////////////////////////////////// 
    324371namespace NSCModuleWrapper { 
    325372  HINSTANCE hModule_ = NULL; 
     
    417464/** 
    418465 * Wrap the HandleCommand call 
    419  * @param retStr The string to return to the core 
    420  * @param *returnBuffer A buffer to copy the return string to 
    421  * @param returnBufferLen length of returnBuffer 
    422  * @return copy status or NSCAPI::isfalse if retStr is empty 
     466 * @param retResult The returned result 
     467 * @param retMessage The returned message 
     468 * @param retPerformance The returned performance data 
     469 * @param *returnBufferMessage The return message buffer 
     470 * @param returnBufferMessageLen The return message buffer length 
     471 * @param *returnBufferPerf The return perfomance data buffer 
     472 * @param returnBufferPerfLen The return perfomance data buffer length 
     473 * @return the return code 
    423474 */ 
    424475NSCAPI::nagiosReturn NSCModuleWrapper::wrapHandleCommand(NSCAPI::nagiosReturn retResult, const std::string retMessage, const std::string retPerformance, char *returnBufferMessage, unsigned int returnBufferMessageLen, char *returnBufferPerf, unsigned int returnBufferPerfLen) { 
  • trunk/include/NSCHelper.h

    r5d8e0b5 rf896cfb  
    5757  } 
    5858#endif 
    59  
    60 /* 
    61   inline void escalteReturnCode(NSCAPI::nagiosReturn &currentReturnCode, NSCAPI::nagiosReturn newReturnCode) { 
    62     if (newReturnCode == NSCAPI::returnCRIT) 
    63       currentReturnCode = NSCAPI::returnCRIT; 
    64     else if ((newReturnCode == NSCAPI::returnWARN) && (currentReturnCode != NSCAPI::returnCRIT) ) 
    65       currentReturnCode = NSCAPI::returnWARN; 
    66     else if ((newReturnCode == NSCAPI::returnUNKNOWN)  
    67       && (currentReturnCode != NSCAPI::returnCRIT)  
    68       && (currentReturnCode != NSCAPI::returnWARN) ) 
    69       currentReturnCode = NSCAPI::returnUNKNOWN; 
    70   } 
    71   */ 
    7259  inline void escalteReturnCodeToCRIT(NSCAPI::nagiosReturn &currentReturnCode) { 
    7360    currentReturnCode = NSCAPI::returnCRIT; 
  • trunk/include/ServiceCmd.cpp

    re0705d4 rf896cfb  
    6767   * Stars the service. 
    6868   * 
    69    * @param szName  
     69   * @param name The name of the service to start  
    7070   * 
    7171   * @author mickem 
     
    112112   * Stops and removes the service 
    113113   * 
    114    * @param szName  
     114   * @param name The name of the service to uninstall  
    115115   * 
    116116   * @author mickem 
     
    145145   * Stops the service 
    146146   * 
    147    * @param szName  
     147   * @param name The name of the serive to stop  
    148148   * 
    149149   * @author MickeM 
  • trunk/include/Socket.cpp

    rf22f5a9 rf896cfb  
    33#include <NSCHelper.h> 
    44 
    5  
    6  
    7  
    85/** 
    9 * Thread procedure for the socket listener 
    10 * @param lpParameter Potential argument to the thread proc. 
    11 * @return thread exit status 
    12 * @todo This needs to be reworked, possibly completely redone ? 
    13 */ 
    14  
    15  
     6 * Print an error message  
     7 * @param error  
     8 */ 
    169void simpleSocket::Socket::printError(std::string error) { 
    1710  NSC_LOG_ERROR_STD(error); 
     
    1912 
    2013 
    21 void simpleSocket::Socket::readAll(DataBuffer &buffer, unsigned int tmpBufferLength /* = 1024*/) { 
     14/** 
     15 * Read all data on the socket 
     16 * @param buffer  
     17 * @param tmpBufferLength Length of temporary buffer to use (generally larger then expected data) 
     18 */ 
     19void simpleSocket::Socket::readAll(DataBuffer& buffer, unsigned int tmpBufferLength /* = 1024*/) { 
    2220  // @todo this could be optimized a bit if we want to 
    2321  // If only one buffer is needed we could "reuse" the buffer instead of copying it. 
     
    4038 
    4139 
     40/** 
     41 * Startup WSA 
     42 * @param wVersionRequested Version to use 
     43 * @return stuff 
     44 */ 
    4245WSADATA simpleSocket::WSAStartup(WORD wVersionRequested /* = 0x202 */) { 
    4346  WSADATA wsaData; 
     
    4750  return wsaData; 
    4851} 
     52/** 
     53 * Cleanup (Shutdown) WSA 
     54 */ 
    4955void simpleSocket::WSACleanup() { 
    5056  if (::WSACleanup() != 0) 
  • trunk/include/Socket.h

    rf22f5a9 rf896cfb  
    226226    Listener() : pHandler_(NULL) {}; 
    227227    virtual ~Listener() { 
    228       std::cout << "Stale process count: " << responderList_.size() << std::endl; 
     228      if (responderList_.size() > 0) 
     229        std::cout << "We had stale processes running then the socket closed." << std::endl; 
    229230      // @todo check if we have stale processes here (if so log an error) 
    230231    }; 
  • trunk/include/arrayBuffer.cpp

    rf705d34 rf896cfb  
    44 
    55/** 
    6 * Make a list out of a array of char arrays (arguments type) 
    7 * @param argLen Length of argument array 
    8 * @param *argument[] Argument array 
    9 * @return Argument wrapped as a list 
    10 */ 
     6 * Make a list out of a array of char arrays (arguments type) 
     7 * @param argLen Length of argument array 
     8 * @param *argument[] Argument array 
     9 * @return Argument wrapped as a list 
     10 */ 
    1111arrayBuffer::arrayList arrayBuffer::arrayBuffer2list(const unsigned int argLen, char *argument[]) { 
    1212  arrayList ret; 
     
    4949  return arrayBuffer; 
    5050} 
    51  
    52  
    53  
    5451/** 
    5552* Joins an arrayBuffer back into a string 
     
    6966} 
    7067/** 
    71 * Split a string into elements as an arrayBuffer 
     68* Split a string into elements as a newly created arrayBuffer 
    7269* @param buffer The CharArray to split along 
    7370* @param splitChar The char to use as splitter 
     
    10097  return arrayBuffer; 
    10198} 
     99/** 
     100 * Split a string into elements as a newly created arrayBuffer 
     101 * @param inBuf The CharArray to split along 
     102 * @param splitChar The char to use as splitter 
     103 * @param &argLen [OUT] The length of the Array 
     104 * @return The arrayBuffer 
     105 */ 
    102106char ** arrayBuffer::split2arrayBuffer(const std::string inBuf, char splitChar, unsigned int &argLen) { 
    103107  if (inBuf.empty()) 
     
    144148 
    145149#ifdef _DEBUG 
     150/** 
     151 * Test function for createEmptyArrayBuffer 
     152 */ 
    146153void arrayBuffer::test_createEmptyArrayBuffer() { 
    147154  std::cout << "arrayBuffer::test_createEmptyArrayBuffer() : "; 
     
    154161  destroyArrayBuffer(c, argLen); 
    155162} 
     163/** 
     164 * Test function for split2arrayBuffer 
     165 * @param buffer  
     166 * @param splitter  
     167 * @param OUT_argLen  
     168 */ 
    156169void arrayBuffer::test_split2arrayBuffer_str(std::string buffer, char splitter, int OUT_argLen) { 
    157170  std::cout << "arrayBuffer::test_split2arrayBuffer(" << buffer << ", ...) : "; 
     
    164177  destroyArrayBuffer(c, argLen); 
    165178} 
     179/** 
     180 * Test function for split2arrayBuffer 
     181 * @param buffer  
     182 * @param splitter  
     183 * @param OUT_argLen  
     184 */ 
    166185void arrayBuffer::test_split2arrayBuffer_char(char* buffer, char splitter, int OUT_argLen) { 
    167186  std::cout << "arrayBuffer::test_split2arrayBuffer(" << buffer << ", ...) : "; 
     
    175194} 
    176195 
     196/** 
     197 * Test function for ArrayBuffer 
     198 */ 
    177199void arrayBuffer::run_testArrayBuffer() { 
    178200  test_createEmptyArrayBuffer(); 
     
    195217  test_split2arrayBuffer_char("foo&&&", '&', 4); 
    196218} 
    197  
    198219#endif 
  • trunk/include/arrayBuffer.h

    rf705d34 rf896cfb  
    11#pragma once 
    22 
    3  
     3/** 
     4 * @ingroup NSClient++ 
     5 * 
     6 * A simple namespace (wrapper) to wrap functions to manipulate an array buffer. 
     7 * 
     8 * @version 1.0 
     9 * first version 
     10 * 
     11 * @date 05-14-2005 
     12 * 
     13 * @author mickem 
     14 * 
     15 * @par license 
     16 * This code is absolutely free to use and modify. The code is provided "as is" with 
     17 * no expressed or implied warranty. The author accepts no liability if it causes 
     18 * any damage to your computer, causes your pet to fall ill, increases baldness 
     19 * or makes your car start emitting strange noises when you start it up. 
     20 * This code has no bugs, just undocumented features! 
     21 *  
     22 * @todo  
     23 * 
     24 * @bug  
     25 * 
     26 */ 
    427namespace arrayBuffer { 
    5  
    628  typedef std::list<std::string> arrayList; 
    7  
    829  arrayList arrayBuffer2list(const unsigned int argLen, char **argument); 
    930  char ** list2arrayBuffer(const arrayList lst, unsigned int &argLen); 
     
    1435  void destroyArrayBuffer(char **argument, const unsigned int argLen); 
    1536 
    16  
    1737#ifdef _DEBUG 
    1838  void test_createEmptyArrayBuffer(); 
    1939  void test_split2arrayBuffer_str(std::string buffer, char splitter, int OUT_argLen); 
    2040  void test_split2arrayBuffer_char(char* buffer, char splitter, int OUT_argLen); 
    21  
    2241  void run_testArrayBuffer(); 
    2342#endif 
    24  
    2543} 
  • trunk/include/config.h

    rf22f5a9 rf896cfb  
    55 
    66// Version 
    7 #define SZVERSION "0.0.9 rc1 2005-04-19" 
     7#define SZVERSION "0.3.0 a1 2005-05-16" 
    88 
    99// internal name of the service 
  • trunk/include/strEx.h

    r5d8e0b5 rf896cfb  
    9999 
    100100  inline long long stoi64_as_BKMG(std::string s) { 
    101     std::string::size_type p = s.find_first_of("BMKG"); 
     101    std::string::size_type p = s.find_first_of("BMKGT"); 
    102102    if (p == std::string::npos) 
    103103      return _atoi64(s.c_str()); 
     
    110110    else if (s[p] == 'G')  
    111111      return _atoi64(s.c_str())*1024*1024*1024; 
     112    else if (s[p] == 'T')  
     113      return _atoi64(s.c_str())*1024*1024*1024*1024; 
    112114    else 
    113115      return _atoi64(s.c_str()); 
    114116  } 
    115   inline std::string itos_as_BKMG(long long i) { 
    116     if (i > (1024*1024*1024)) 
    117       return itos(i/(1024*1024*1024))+"G (" + itos(i) + "B)"; 
    118     if (i > (1024*1024)) 
    119       return itos(i/(1024*1024))+"M (" + itos(i) + "B)"; 
    120     if (i > (1024)) 
    121       return itos(i/(1024))+"K (" + itos(i) + "B)"; 
    122     return itos(i>>24)+"B"; 
     117#define BKMG_RANGE "BKMGTP" 
     118#define BKMG_SIZE 5 
     119 
     120  inline std::string itos_as_BKMG(unsigned __int64 i) { 
     121    unsigned __int64 cpy = i; 
     122    char postfix[] = BKMG_RANGE; 
     123    int idx = 0; 
     124    while ((cpy > 1024)&&(idx<BKMG_SIZE)) { 
     125      cpy/=1024; 
     126      idx++; 
     127    } 
     128    std::string ret = itos(cpy); 
     129    ret += postfix[idx]; 
     130    if (idx > 0) { 
     131      ret += " (" + itos(i) + "B)"; 
     132    } 
     133    return ret; 
    123134  } 
    124135 
     
    151162    return token(buffer.substr(0, pos-1), buffer.substr(++pos)); 
    152163  } 
     164 
     165 
     166  template<class _E> 
     167  struct blind_traits : public std::char_traits<_E> 
     168  { 
     169    static bool eq(const _E& x, const _E& y) { 
     170      return tolower( x ) == tolower( y );  
     171    } 
     172    static bool lt(const _E& x, const _E& y) { 
     173      return tolower( x ) < tolower( y );  
     174    } 
     175 
     176    static int compare(const _E *x, const _E *y, size_t n) {  
     177      return strnicmp( x, y, n ); 
     178    } 
     179 
     180    //  There's no memichr(), so we roll our own.  It ain't rocket science. 
     181    static const _E * __cdecl find(const _E *buf, size_t len, const _E& ch) { 
     182      //  Jerry says that x86s have special mojo for memchr(), so the  
     183      //  memchr() calls end up being reasonably efficient in practice. 
     184      const _E *pu = (const _E *)memchr(buf, ch, len); 
     185      const _E *pl = (const _E *)memchr(buf, tolower( ch ), len); 
     186      if ( ! pu ) 
     187        return pl;  //  Might be NULL; if so, NULL's the word. 
     188      else if ( ! pl ) 
     189        return pu; 
     190      else 
     191        //  If either one was NULL, we return the other; if neither is  
     192        //  NULL, we return the lesser of the two. 
     193        return ( pu < pl ) ? pu : pl; 
     194    } 
     195 
     196    //  I'm reasonably sure that this is eq() for wide characters.  Maybe. 
     197    static bool eq_int_type(const int_type& ch1, const int_type& ch2) {  
     198      return char_traits<_E>::eq_int_type( tolower( ch1 ), tolower( ch2 ) );  
     199    } 
     200  }; 
     201 
     202  //  And here's our case-blind string class. 
     203  typedef std::basic_string<char, blind_traits<char>, std::allocator<char> >  blindstr; 
     204 
    153205#ifdef _DEBUG 
    154206  inline void test_getToken(std::string in1, char in2, std::string out1, std::string out2) { 
  • trunk/include/utils.cpp

    r5d8e0b5 rf896cfb  
    11#include <utils.h> 
    22 
    3  
    4 checkHolders::Size::Size() : type_(none), value_(0) {} 
    5  
    6 void checkHolders::Size::set(std::string s) { 
    7   std::string::size_type p = s.find_first_of('%'); 
    8   if (p == std::string::npos) { 
    9     value_ = strEx::stoi64_as_BKMG(s); 
    10     type_ = size; 
    11   } else { 
    12     value_ = strEx::stoi64(s.substr(0,p)); 
    13     type_ = percentage; 
    14   } 
    15 } 
    16 checkHolders::Size::checkResult checkHolders::Size::check(long long value, long long max) const { 
    17   long long p = getValue(value, max); 
    18   if (p == value_) 
    19     return same; 
    20   else if (p > value_) 
    21     return above; 
    22   return below; 
    23 } 
    24 std::string checkHolders::Size::prettyPrint(std::string name, long long value, long long max) const { 
    25   if (type_ == percentage) 
    26     return name + ": " + strEx::itos(getValue(value, max)); 
    27   return name + ": " + strEx::itos_as_BKMG(getValue(value, max)); 
    28 } 
    29  
    30 std::string checkHolders::SizeMaxMin::printPerfHead(bool percentage, std::string name, long long value, long long total)  
    31 { 
    32   if (percentage) 
    33     return name + "=" + strEx::itos(value*100/total)+ "% "; 
    34   return name + "=" + strEx::itos(value) + ";"; 
    35 } 
    36 std::string checkHolders::SizeMaxMin::printPerfData(bool percentage, long long value, long long total) 
    37 { 
    38   if (percentage) { 
    39     if (max.hasBounds()) { 
    40       if (max.isPercentage()) { 
    41         return strEx::itos(max.value_) + ";"; 
    42       } else { 
    43         return strEx::itos((max.value_*total)/100) + ";"; 
    44       } 
    45     } else if (min.hasBounds()) { 
    46       if (min.isPercentage()) { 
    47         return strEx::itos(min.value_) + ";"; 
    48       } else { 
    49         return strEx::itos((min.value_*total)/100) + ";"; 
    50       } 
    51     } 
    52   } 
    53   return "0;"; 
    54 } 
    55  
    56 std::string checkHolders::SizeMaxMin::printPerf(std::string name, long long value, long long total, SizeMaxMin &warn, SizeMaxMin &crit) 
    57 { 
    58   std::string s; 
    59   bool bPercentage = warn.isPercentage() && crit.isPercentage(); 
    60   s = printPerfHead(bPercentage, name, value, total); 
    61   s += warn.printPerfData(bPercentage, value, total); 
    62   s += crit.printPerfData(bPercentage, value, total); 
    63   s += " "; 
    64   return s; 
    65 } 
    663 
    674static unsigned long crc32_table[256]; 
  • trunk/include/utils.h

    r5d8e0b5 rf896cfb  
    55 
    66namespace checkHolders { 
    7   struct Size { 
     7 
     8  typedef unsigned __int64 drive_size; 
     9  template <typename TType = drive_size> 
     10  class drive_size_handler { 
     11  public: 
     12    static TType parse(std::string s) { 
     13      return strEx::stoi64_as_BKMG(s); 
     14    } 
     15    static TType parse_percent(std::string s) { 
     16      return strEx::stoi64(s); 
     17    } 
     18    static std::string print(TType value) { 
     19      return strEx::itos_as_BKMG(value); 
     20    } 
     21    static std::string print_percent(TType value) { 
     22      return strEx::itos(value) + "%"; 
     23    } 
     24  }; 
     25 
     26  template <typename TType = __int64> 
     27  class int64_handler { 
     28  public: 
     29    static TType parse(std::string s) { 
     30      return strEx::stoi64(s); 
     31    } 
     32    static TType parse_percent(std::string s) { 
     33      return strEx::stoi(s); 
     34    } 
     35    static std::string print(TType value) { 
     36      return strEx::itos(value); 
     37    } 
     38    static std::string print_percent(TType value) { 
     39      return strEx::itos(value) + "%"; 
     40    } 
     41  }; 
     42 
     43  template <typename TType = drive_size, class THandler = drive_size_handler<> > 
     44  class Size { 
     45  public: 
     46    typedef enum { 
     47      above = 1, 
     48      below = -1, 
     49      same = 0, 
     50    } checkResult; 
     51 
     52    bool bHasBounds_; 
     53    TType value_; 
     54 
     55    Size() : bHasBounds_(false), value_(0) {}; 
     56    void set(std::string s) { 
     57      value_ = THandler::parse(s); 
     58      bHasBounds_ = true; 
     59    } 
     60    checkResult check(TType value) const { 
     61      if (value == value_) 
     62        return same; 
     63      else if (value > value_) 
     64        return above; 
     65      return below; 
     66    } 
     67    std::string prettyPrint(std::string name, TType value) const { 
     68      return name + ": " + THandler::print(value); 
     69    } 
     70 
     71    inline bool hasBounds() const { 
     72      return bHasBounds_; 
     73    } 
     74    inline bool checkMAX(TType value) const { 
     75      return check(value)==above; 
     76    } 
     77    inline bool checkMIN(TType value) const { 
     78      return check(value)==below; 
     79    } 
     80    inline std::string toString() const { 
     81      return strEx::itos(value_) + (type_==percentage?"%":""); 
     82    } 
     83  }; 
     84 
     85  template <typename TType = drive_size, class THandler = drive_size_handler<> > 
     86  class SizePercentage { 
     87  public: 
    888    typedef enum { 
    989      none, 
     
    1898 
    1999    checkTypes type_; 
    20     long long value_; 
    21  
    22     Size(); 
    23     void set(std::string s); 
    24     checkResult check(long long value, long long max) const; 
    25     std::string prettyPrint(std::string name, long long value, long long max) const; 
     100    TType value_; 
     101 
     102    SizePercentage() : type_(none), value_(0) {}; 
     103    void set(std::string s) { 
     104      std::string::size_type p = s.find_first_of('%'); 
     105      if (p == std::string::npos) { 
     106        value_ = THandler::parse(s); 
     107        type_ = size; 
     108      } else { 
     109        value_ = THandler::parse_percent(s); 
     110        type_ = percentage; 
     111      } 
     112    } 
     113    checkResult check(TType value, TType max) const { 
     114      unsigned long long p = getValue(value, max); 
     115      if (p == value_) 
     116        return same; 
     117      else if (p > value_) 
     118        return above; 
     119      return below; 
     120    } 
     121    std::string prettyPrint(std::string name, TType value, TType max) const { 
     122      if (type_ == percentage) 
     123        return name + ": " + THandler::print_percent(getValue(value, max)); 
     124      return name + ": " + THandler::print(getValue(value, max)); 
     125    } 
    26126 
    27127    inline bool hasBounds() const { 
     
    31131      return type_ == percentage; 
    32132    } 
    33     inline bool checkMAX(long long value, long long max) const { 
     133    inline bool checkMAX(TType value, TType max) const { 
    34134      return check(value, max)==above; 
    35135    } 
    36     inline bool checkMIN(long long value, long long max) const { 
     136    inline bool checkMIN(TType value, TType max) const { 
    37137      return check(value, max)==below; 
    38138    } 
     
    40140      return strEx::itos(value_) + (type_==percentage?"%":""); 
    41141    } 
    42     inline long long getValue(long long value, long long max) const { 
     142    inline long long getValue(TType value, TType max) const { 
    43143      if (type_ == percentage) { 
    44144        return static_cast<int>((value*100) / max); 
     
    50150    } 
    51151  }; 
    52   struct SizeMaxMin { 
    53     Size max; 
    54     Size min; 
     152 
     153 
     154  template <typename TType = drive_size, class THandler = drive_size_handler<>, class THolder = Size<TType, THandler> > 
     155  class SizeMaxMin { 
     156  public: 
     157    THolder max; 
     158    THolder min; 
     159    typedef SizeMaxMin<TType, THandler, THolder> TMyType; 
     160 
     161    std::string printPerfData() 
     162    { 
     163      if (max.hasBounds()) { 
     164        return THandler::print(max.value_) + ";"; 
     165      } else if (min.hasBounds()) { 
     166        return THandler::print(min.value_) + ";"; 
     167      } 
     168      return "0;"; 
     169    } 
     170    static std::string printPerf(std::string name, TType value, TMyType &warn, TMyType &crit) 
     171    { 
     172      return name + "=" + strEx::itos(value) + ";" + warn.printPerfData() + crit.printPerfData(); 
     173    } 
     174 
     175  }; 
     176  template <typename TType = drive_size, class THandler = drive_size_handler<>, class THolder = SizePercentage<TType, THandler> > 
     177  struct SizeMaxMinPercentage { 
     178  public: 
     179    THolder max; 
     180    THolder min; 
     181    typedef SizeMaxMinPercentage<TType, THandler, THolder> TMyType; 
    55182 
    56183    bool isPercentage() { 
     
    61188      return false; 
    62189    } 
    63     std::string printPerfData(bool percentage, long long value, long long total); 
    64     static std::string printPerfHead(bool percentage, std::string name, long long value, long long total); 
    65     static std::string printPerf(std::string name, long long value, long long total, SizeMaxMin &warn, SizeMaxMin &crit); 
    66   }; 
     190    std::string printPerfData(bool bPercentage, TType value, TType total) 
     191    { 
     192      if (bPercentage) { 
     193        if (max.hasBounds()) { 
     194          if (max.isPercentage()) { 
     195            return THandler::print_percent(max.value_) + ";"; 
     196          } else { 
     197            return THandler::print_percent((total*100)/(max.value_==0?1:max.value_)) + ";"; 
     198          } 
     199        } else if (min.hasBounds()) { 
     200          if (min.isPercentage()) { 
     201            return THandler::print_percent(min.value_) + ";"; 
     202          } else { 
     203            return THandler::print_percent((total*100)/(min.value_==0?1:min.value_)) + ";"; 
     204          } 
     205        } 
     206      } else { 
     207        if (max.hasBounds()) { 
     208          if (max.isPercentage()) { 
     209            return THandler::print((max.value_*total)/100) + ";"; 
     210          } else { 
     211            return THandler::print(max.value_) + ";"; 
     212          } 
     213        } else if (min.hasBounds()) { 
     214          if (min.isPercentage()) { 
     215            return THandler::print((min.value_*total)/100) + ";"; 
     216          } else { 
     217            return THandler::print(min.value_) + ";"; 
     218          } 
     219        } 
     220      } 
     221      return "0;"; 
     222    } 
     223    static std::string printPerf(std::string name, TType value, TType total, TMyType &warn, TMyType &crit) 
     224    { 
     225      std::string s; 
     226      bool percentage = crit.isPercentage()  || warn.isPercentage(); 
     227      if (percentage) 
     228        s += name + "=" + strEx::itos(value*100/total)+ "% "; 
     229      else 
     230        s+= name + "=" + strEx::itos(value) + ";"; 
     231      s += warn.printPerfData(percentage, value, total); 
     232      s += crit.printPerfData(percentage, value, total); 
     233      s += " "; 
     234      return s; 
     235    } 
     236 
     237  }; 
     238/* 
     239  template <typename TType = drive_size, class THandler = drive_size_handler<>, class THolder = SizeMaxMinPercentage<> >  
     240  class PerformancePrinterPercentage { 
     241  public: 
     242    static std::string printPerf(std::string name, TType value, TType total, THolder &warn, THolder &crit) 
     243    { 
     244      std::string s; 
     245      bool percentage = crit.isPercentage()  || warn.isPercentage(); 
     246      if (percentage) 
     247        s += name + "=" + strEx::itos(value*100/total)+ "% "; 
     248      else 
     249        s+= name + "=" + strEx::itos(value) + ";"; 
     250      s += warn.printPerfData(percentage, value, total); 
     251      s += crit.printPerfData(percentage, value, total); 
     252      s += " "; 
     253      return s; 
     254    } 
     255  }; 
     256  template <typename TType = drive_size, class THandler = drive_size_handler<>, class THolder = SizeMaxMin<> >  
     257  class PerformancePrinter { 
     258  public: 
     259    static std::string printPerf(std::string name, TType value, THolder &warn, THolder &crit) 
     260    { 
     261      return name + "=" + strEx::itos(value) + ";" + warn.printPerfData() + crit.printPerfData(); 
     262    } 
     263  }; 
     264*/ 
    67265} 
    68266void generate_crc32_table(void); 
  • trunk/modules/CheckDisk/CheckDisk.cpp

    rae192e3 rf896cfb  
    8383} 
    8484 
     85 
     86#define MY_FILTER_UNKNOWN     0 
     87#define MY_FILTER_NO_ROOT_DIR 1 
     88#define MY_FILTER_REMOVABLE   2 
     89#define MY_FILTER_FIXED       4 
     90#define MY_FILTER_REMOTE      8 
     91#define MY_FILTER_CDROM       16 
     92#define MY_FILTER_RAMDISK     32 
     93 
    8594NSCAPI::nagiosReturn CheckDisk::CheckDriveSize(const unsigned int argLen, char **char_args, std::string &message, std::string &perf) { 
    86   // CheckFileSize 
    87   // request: CheckFileSize <option> <option>... 
    88   // <option>     MaxWarn=<size gmkb> 
    89   //          MaxCrit=<size gmkb> 
    90   //          MinWarn=<size gmkb> 
    91   //          MinCrit=<size gmkb> 
    92   //          ShowAll 
    93   //          File=<path> 
    94   //          File:<shortname>=<path> 
    95   // 
    96   // Return: <return state>&<return string>... 
    97   // <return state> 0 - No errors 
    98   //          1 - Unknown 
    99   //          2 - Errors 
    100   // <size gmkb> is a size with a possible modifier letter (such as G for gigabyte, M for Megabyte, K for kilobyte etc) 
    101   // Examples: 
    102   // <return string>  <directory> <size gmkb> ... |<shortname>=<size>:<warn>:<crit> 
    103   // test: CheckFileSize ShowAll MaxWarn=1024M MaxCrit=4096M File:WIN=c:\WINDOWS\*.* 
    104   //       CheckFileSize 
    105   // 
    106   // check_nscp -H <ip> -p <port> -s <passwd> -c <commandstring> 
    107   // 
    108   // ./check_nscp -H 192.168.0.167 -p 1234 -s pwd -c 'CheckFileSize&ShowAll&MaxWarn=1024M&MaxCrit=4096M&File:WIN=c:\WINDOWS\*.*' 
    109   // WIN: 1G (2110962363B)|WIN:2110962363:1073741824:4294967296 
    11095  NSCAPI::nagiosReturn returnCode = NSCAPI::returnOK; 
    11196  std::list<std::string> args = arrayBuffer::arrayBuffer2list(argLen, char_args); 
     
    115100  } 
    116101 
    117   checkHolders::SizeMaxMin warn; 
    118   checkHolders::SizeMaxMin crit; 
     102  checkHolders::SizeMaxMinPercentage<> warn; 
     103  checkHolders::SizeMaxMinPercentage<> crit; 
    119104  bool bShowAll = false; 
    120105  bool bNSClient = false; 
     106  bool bCheckAll = false; 
     107 
     108  bool bFilter = false; 
     109  bool bFilterRemote = false; 
     110  bool bFilterRemovable = false; 
     111  bool bFilterFixed = false; 
     112  bool bFilterCDROM = false; 
    121113  std::list<std::string> drives; 
    122114 
     
    135127    } else if (p.first == "MinCrit") { 
    136128      crit.min.set(p.second); 
    137     } else if (p.first == "ShowAll") { 
     129    } else if (p.first == SHOW_ALL) { 
    138130      bShowAll = true; 
    139131    } else if (p.first == "nsclient") { 
    140132      bNSClient = true; 
     133    } else if (p.first == "FilterType") { 
     134      bFilter = true; 
     135      if (p.second == "FIXED") { 
     136        bFilterFixed = true; 
     137      } else if (p.second == "CDROM") { 
     138        bFilterCDROM= true; 
     139      } else if (p.second == "REMOVABLE") { 
     140        bFilterRemovable = true; 
     141      } else if (p.second == "REMOTE") { 
     142        bFilterRemote= true; 
     143      } 
     144    } else if (p.first == "CheckAll") { 
     145      bCheckAll = true; 
    141146    } else { 
    142147      drives.push_back(p.first); 
     148    } 
     149  } 
     150 
     151  if (bCheckAll) { 
     152    DWORD dwDrives = GetLogicalDrives(); 
     153    int idx = 0; 
     154    while (dwDrives != 0) { 
     155      if (dwDrives & 0x1) { 
     156        std::string drv; 
     157        drv += static_cast<char>('A' + idx); drv += ":\\"; 
     158        UINT drvType = GetDriveType(drv.c_str()); 
     159        if ((!bFilter)&&(drvType == DRIVE_FIXED)) { 
     160          drives.push_back(drv); 
     161        } else if ((bFilter)&&(bFilterFixed)&&(drvType==DRIVE_FIXED)) { 
     162          drives.push_back(drv); 
     163        } else if ((bFilter)&&(bFilterCDROM)&&(drvType==DRIVE_CDROM)) { 
     164          drives.push_back(drv); 
     165        } else if ((bFilter)&&(bFilterRemote)&&(drvType==DRIVE_REMOTE)) { 
     166          drives.push_back(drv); 
     167        } else if ((bFilter)&&(bFilterRemovable)&&(drvType==DRIVE_REMOVABLE)) { 
     168          drives.push_back(drv); 
     169        } 
     170      } 
     171      idx++; 
     172      dwDrives >>= 1; 
    143173    } 
    144174  } 
     
    148178    if (drive.length() == 1) 
    149179      drive += ":"; 
    150     if (GetDriveType(drive.c_str()) != DRIVE_FIXED){ 
    151       message = "ERROR: Drive is not a fixed drive: " + drive; 
    152       return NSCAPI::returnUNKNOWN; 
    153     } 
     180    UINT drvType = GetDriveType(drive.c_str()); 
     181 
     182    if ((!bFilter)&&(drvType != DRIVE_FIXED)) { 
     183      message = "UNKNOWN: Drive is not a fixed drive: " + drive + " (it is a: " + strEx::itos(drvType) + ")"; 
     184      return NSCAPI::returnUNKNOWN; 
     185    } else if ((bFilter)&&(!bFilterFixed)&&(drvType==DRIVE_FIXED)) { 
     186      message = "UNKNOWN: Drive does not match the current filter: " + drive + " (it is a: " + strEx::itos(drvType) + ")"; 
     187      return NSCAPI::returnUNKNOWN; 
     188    } else if ((bFilter)&&(!bFilterCDROM)&&(drvType==DRIVE_CDROM)) { 
     189      message = "UNKNOWN: Drive does not match the current filter: " + drive + " (it is a: " + strEx::itos(drvType) + ")"; 
     190      return NSCAPI::returnUNKNOWN; 
     191    } else if ((bFilter)&&(!bFilterRemote)&&(drvType==DRIVE_REMOTE)) { 
     192      message = "UNKNOWN: Drive does not match the current filter: " + drive + " (it is a: " + strEx::itos(drvType) + ")"; 
     193      return NSCAPI::returnUNKNOWN; 
     194    } else if ((bFilter)&&(!bFilterRemovable)&&(drvType==DRIVE_REMOVABLE)) { 
     195      message = "UNKNOWN: Drive does not match the current filter: " + drive + " (it is a: " + strEx::itos(drvType) + ")"; 
     196      return NSCAPI::returnUNKNOWN; 
     197    } 
     198 
    154199    ULARGE_INTEGER freeBytesAvailableToCaller; 
    155200    ULARGE_INTEGER totalNumberOfBytes; 
    156201    ULARGE_INTEGER totalNumberOfFreeBytes; 
    157202    if (!GetDiskFreeSpaceEx(drive.c_str(), &freeBytesAvailableToCaller, &totalNumberOfBytes, &totalNumberOfFreeBytes)) { 
    158       message = "ERROR: Could not get free space for" + drive; 
     203      message = "UNKNOWN: Could not get free space for: " + drive; 
    159204      return NSCAPI::returnUNKNOWN; 
    160205    } 
     
    165210    } else { 
    166211      std::string tStr; 
    167       long long usedSpace = totalNumberOfBytes.QuadPart-totalNumberOfFreeBytes.QuadPart; 
    168       long long totalSpace = totalNumberOfBytes.QuadPart; 
     212      checkHolders::drive_size usedSpace = totalNumberOfBytes.QuadPart-totalNumberOfFreeBytes.QuadPart; 
     213      checkHolders::drive_size totalSpace = totalNumberOfBytes.QuadPart; 
    169214      if (crit.max.hasBounds() && crit.max.checkMAX(usedSpace, totalSpace)) { 
    170         message += crit.max.prettyPrint(drive, usedSpace, totalSpace); 
     215        tStr += crit.max.prettyPrint(drive, usedSpace, totalSpace) + " > critical"; 
    171216        NSCHelper::escalteReturnCodeToCRIT(returnCode); 
    172217      } else if (crit.min.hasBounds() && crit.min.checkMIN(usedSpace, totalSpace)) { 
    173         tStr = crit.min.prettyPrint(drive, usedSpace, totalSpace); 
     218        tStr = crit.min.prettyPrint(drive, usedSpace, totalSpace) + " < critical"; 
    174219        NSCHelper::escalteReturnCodeToCRIT(returnCode); 
    175220      } else if (warn.max.hasBounds() && warn.max.checkMAX(usedSpace, totalSpace)) { 
    176         tStr = warn.max.prettyPrint(drive, usedSpace, totalSpace); 
     221        tStr = warn.max.prettyPrint(drive, usedSpace, totalSpace) + " > warning"; 
    177222        NSCHelper::escalteReturnCodeToWARN(returnCode); 
    178223      } else if (warn.min.hasBounds() && warn.min.checkMIN(usedSpace, totalSpace)) { 
    179         tStr = warn.min.prettyPrint(drive, usedSpace, totalSpace); 
     224        tStr = warn.min.prettyPrint(drive, usedSpace, totalSpace) + " < warning"; 
    180225        NSCHelper::escalteReturnCodeToWARN(returnCode); 
    181226      } else if (bShowAll) { 
    182227        tStr = drive + ": " + strEx::itos_as_BKMG(usedSpace); 
    183228      } 
    184       perf += checkHolders::SizeMaxMin::printPerf(drive, usedSpace, totalSpace, warn, crit); 
     229      perf += checkHolders::SizeMaxMinPercentage<>::printPerf(drive, usedSpace, totalSpace, warn, crit); 
    185230      if (!message.empty() && !tStr.empty()) 
    186231        message += ", "; 
     
    191236  if (message.empty()) 
    192237    message = "All drive sizes are within bounds."; 
     238  else 
     239    message = NSCHelper::translateReturn(returnCode) + ": " + message; 
    193240  return returnCode; 
    194241} 
     
    246293    } else if (p.first == "MinCrit") { 
    247294      minCrit = strEx::stoi64_as_BKMG(p.second); 
    248     } else if (p.first == "ShowAll") { 
     295    } else if (p.first == SHOW_ALL) { 
    249296      bShowAll = true; 
    250297    } else if (p.first.find(":") != std::string::npos) { 
     
    295342  if (message.empty()) 
    296343    message = "OK all file sizes are within bounds."; 
     344  else 
     345    message = NSCHelper::translateReturn(returnCode) + ": " + message; 
    297346  return returnCode; 
    298347} 
     
    301350#define BUFFER_SIZE 1024*64 
    302351 
    303 NSCAPI::nagiosReturn CheckDisk::handleCommand(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) { 
     352NSCAPI::nagiosReturn CheckDisk::handleCommand(const strEx::blindstr command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) { 
    304353  if (command == "CheckFileSize") { 
    305354    return CheckFileSize(argLen, char_args, msg, perf); 
  • trunk/modules/CheckDisk/CheckDisk.h

    r5d8e0b5 rf896cfb  
    11NSC_WRAPPERS_MAIN(); 
     2#include <config.h> 
     3#include <strEx.h> 
    24 
    35class CheckDisk { 
     
    1416  bool hasCommandHandler(); 
    1517  bool hasMessageHandler(); 
    16   NSCAPI::nagiosReturn handleCommand(const std::string command, const unsigned int argLen, char **char_args, std::string &message, std::string &perf); 
     18  NSCAPI::nagiosReturn handleCommand(const strEx::blindstr command, const unsigned int argLen, char **char_args, std::string &message, std::string &perf); 
    1719 
    1820  // Check commands 
  • trunk/modules/CheckEventLog/CheckEventLog.cpp

    rf705d34 rf896cfb  
    296296#define BUFFER_SIZE 1024*64 
    297297 
    298 NSCAPI::nagiosReturn CheckEventLog::handleCommand(const std::string command, const unsigned int argLen, char **char_args, std::string &message, std::string &perf) { 
     298NSCAPI::nagiosReturn CheckEventLog::handleCommand(const strEx::blindstr command, const unsigned int argLen, char **char_args, std::string &message, std::string &perf) { 
    299299  if (command != "CheckEventLog") 
    300300    return NSCAPI::returnIgnored; 
  • trunk/modules/CheckEventLog/CheckEventLog.h

    rc515660 rf896cfb  
    11NSC_WRAPPERS_MAIN(); 
     2 
     3#include <strEx.h> 
    24 
    35class CheckEventLog { 
     
    1416  bool hasCommandHandler(); 
    1517  bool hasMessageHandler(); 
    16   NSCAPI::nagiosReturn handleCommand(const std::string command, const unsigned int argLen, char **char_args, std::string &message, std::string &perf); 
     18  NSCAPI::nagiosReturn handleCommand(const strEx::blindstr command, const unsigned int argLen, char **char_args, std::string &message, std::string &perf); 
    1719}; 
  • trunk/modules/CheckSystem/CheckSystem.cpp

    rf22f5a9 rf896cfb  
    8484 */ 
    8585NSCModuleWrapper::module_version CheckSystem::getModuleVersion() { 
    86   NSCModuleWrapper::module_version version = {0, 0, 1 }; 
     86  NSCModuleWrapper::module_version version = {0, 3, 0 }; 
    8787  return version; 
    8888} 
     
    113113 * @return  
    114114 */ 
    115 NSCAPI::nagiosReturn CheckSystem::handleCommand(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) { 
     115NSCAPI::nagiosReturn CheckSystem::handleCommand(const strEx::blindstr command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) { 
    116116  std::list<std::string> stl_args; 
    117117  CheckSystem::returnBundle rb; 
    118118  if (command == "checkCPU") { 
    119     return checkCPU(command, argLen, char_args, msg, perf); 
     119    return checkCPU(argLen, char_args, msg, perf); 
    120120  } else if (command == "checkUpTime") { 
    121     return checkUpTime(command, argLen, char_args, msg, perf); 
     121    return checkUpTime(argLen, char_args, msg, perf); 
    122122  } else if (command == "checkServiceState") { 
    123     return checkServiceState(command, argLen, char_args, msg, perf); 
     123    return checkServiceState(argLen, char_args, msg, perf); 
    124124  } else if (command == "checkProcState") { 
    125     return checkProcState(command, argLen, char_args, msg, perf); 
     125    return checkProcState(argLen, char_args, msg, perf); 
    126126  } else if (command == "checkMem") { 
    127     return checkMem(command, argLen, char_args, msg, perf); 
     127    return checkMem(argLen, char_args, msg, perf); 
    128128  } else if (command == "checkCounter") { 
    129     return checkCounter(command, argLen, char_args, msg, perf); 
     129    return checkCounter(argLen, char_args, msg, perf); 
    130130  } 
    131131  return NSCAPI::returnIgnored; 
     
    135135// checkCPU warn=80 crit=90 time=20m time=10s time=4 showAll 
    136136// checkCPU 20 10 4 nsclient 
    137 NSCAPI::nagiosReturn CheckSystem::checkCPU(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf)  
     137NSCAPI::nagiosReturn CheckSystem::checkCPU(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf)  
    138138{ 
    139139  std::list<std::string> stl_args = arrayBuffer::arrayBuffer2list(argLen, char_args); 
     
    208208// checkUpTime crit=1d warn=6h 
    209209// checkUpTime nsclient 
    210 NSCAPI::nagiosReturn CheckSystem::checkUpTime(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) 
     210NSCAPI::nagiosReturn CheckSystem::checkUpTime(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) 
    211211{ 
    212212  std::list<std::string> stl_args = arrayBuffer::arrayBuffer2list(argLen, char_args); 
     
    234234  PDHCollector *pObject = pdhThread.getThread(); 
    235235  assert(pObject); 
    236   long long uptime = pObject->getUptime(); 
     236  unsigned long long uptime = pObject->getUptime(); 
    237237  if (bNSCLientCompatible) { 
    238238    msg = strEx::itos(uptime); 
     
    270270 *</pre> 
    271271 * 
    272  * @param args  
    273  * @return  
    274  */ 
    275 NSCAPI::nagiosReturn CheckSystem::checkServiceState(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) 
     272 * @param command Command to execute 
     273 * @param argLen The length of the argument buffer 
     274 * @param **char_args The argument buffer 
     275 * @param &msg String to put message in 
     276 * @param &perf String to put performance data in  
     277 * @return The status of the command 
     278 */ 
     279NSCAPI::nagiosReturn CheckSystem::checkServiceState(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) 
    276280{ 
    277281  std::list<std::string> stl_args = arrayBuffer::arrayBuffer2list(argLen, char_args); 
     
    330334 
    331335 
    332 // checkMem showAll maxWarn=50 maxCrit=75 
    333 NSCAPI::nagiosReturn CheckSystem::checkMem(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) 
     336/** 
     337 * Check availible memory and return various check results 
     338 * Example: checkMem showAll maxWarn=50 maxCrit=75 
     339 * 
     340 * @param command Command to execute 
     341 * @param argLen The length of the argument buffer 
     342 * @param **char_args The argument buffer 
     343 * @param &msg String to put message in 
     344 * @param &perf String to put performance data in  
     345 * @return The status of the command 
     346 */ 
     347NSCAPI::nagiosReturn CheckSystem::checkMem(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) 
    334348{ 
    335349  std::list<std::string> stl_args = arrayBuffer::arrayBuffer2list(argLen, char_args); 
     
    343357  bool bNSCLientCompatible = false; 
    344358 
    345   checkHolders::SizeMaxMin warn; 
    346   checkHolders::SizeMaxMin crit; 
     359  checkHolders::SizeMaxMinPercentage<> warn; 
     360  checkHolders::SizeMaxMinPercentage<> crit; 
    347361 
    348362  for (arrayBuffer::arrayList::const_iterator it = stl_args.begin(); it != stl_args.end(); ++it) { 
     
    390404      tStr = "page: " + strEx::itos_as_BKMG(pageCommit); 
    391405    } 
    392     perf += checkHolders::SizeMaxMin::printPerf("page", pageCommit, pageCommitLimit, warn, crit); 
     406    perf += checkHolders::SizeMaxMinPercentage<>::printPerf("page", pageCommit, pageCommitLimit, warn, crit); 
    393407    msg += tStr; 
    394408  } 
    395409  if (msg.empty()) 
    396     msg ="Memory ok."; 
     410    msg = "OK memory within bounds."; 
     411  else 
     412    msg = NSCHelper::translateReturn(returnCode) + ": " + msg; 
    397413  return returnCode; 
    398414} 
     
    419435} 
    420436 
    421 NSCAPI::nagiosReturn CheckSystem::checkProcState(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) 
     437/** 
     438 * Check process state and return result 
     439 * 
     440 * @param command Command to execute 
     441 * @param argLen The length of the argument buffer 
     442 * @param **char_args The argument buffer 
     443 * @param &msg String to put message in 
     444 * @param &perf String to put performance data in  
     445 * @return The status of the command 
     446 */ 
     447NSCAPI::nagiosReturn CheckSystem::checkProcState(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) 
    422448{ 
    423449  std::list<std::string> stl_args = arrayBuffer::arrayBuffer2list(argLen, char_args); 
     
    482508} 
    483509 
    484 NSCAPI::nagiosReturn CheckSystem::checkCounter(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) 
     510/** 
     511 * Check a counter and return the value 
     512 * 
     513 * @param command Command to execute 
     514 * @param argLen The length of the argument buffer 
     515 * @param **char_args The argument buffer 
     516 * @param &msg String to put message in 
     517 * @param &perf String to put performance data in  
     518 * @return The status of the command 
     519 * 
     520 * @todo add parsing support for NRPE 
     521 */ 
     522NSCAPI::nagiosReturn CheckSystem::checkCounter(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf) 
    485523{ 
    486524  std::list<std::string> stl_args = arrayBuffer::arrayBuffer2list(argLen, char_args); 
     
    489527    return NSCAPI::returnUNKNOWN; 
    490528  } 
    491   std::list<std::string> counters; 
    492   NSCAPI::nagiosReturn ret = NSCAPI::returnOK; 
     529  std::list<std::pair<std::string,std::string> > counters; 
     530  NSCAPI::nagiosReturn returnCode = NSCAPI::returnOK; 
    493531  bool bShowAll = false; 
    494532  bool bNSCLientCompatible = false; 
     533 
     534  checkHolders::SizeMaxMin<__int64, checkHolders::int64_handler<> > warn; 
     535  checkHolders::SizeMaxMin<__int64, checkHolders::int64_handler<> > crit; 
    495536 
    496537  for (arrayBuffer::arrayList::const_iterator it = stl_args.begin(); it != stl_args.end(); ++it) { 
     
    500541    else if (t.first == SHOW_FAIL)  { 
    501542      bShowAll = false; 
     543    } else if (t.first == "MaxWarn") { 
     544      warn.max.set(t.second); 
     545    } else if (t.first == "MinWarn") { 
     546      warn.min.set(t.second); 
     547    } else if (t.first == "MaxCrit") { 
     548      crit.max.set(t.second); 
     549    } else if (t.first == "MinCrit") { 
     550      crit.min.set(t.second); 
    502551    } else if (t.first == NSCLIENT) { 
    503552      bNSCLientCompatible = true; 
    504     } else if (t.first == "counter") { 
    505       counters.push_back(t.second); 
     553    } else if (t.first == "Counter") { 
     554      counters.push_back(std::pair<std::string,std::string>("",t.second)); 
     555    } else if (t.first.find(":") != std::string::npos) { 
     556      std::pair<std::string,std::string> t2 = strEx::split(t.first,":"); 
     557      if (t2.first == "Counter") { 
     558        counters.push_back(std::pair<std::string,std::string>(t2.second,t.second)); 
     559      } else { 
     560        msg = "Unknown command: " + t.first; 
     561        return NSCAPI::returnUNKNOWN; 
     562      } 
    506563    } else { 
    507       counters.push_back(t.first); 
    508     } 
    509   } 
    510  
    511   for (std::list<std::string>::iterator it = counters.begin(); it != counters.end(); ++it) { 
     564      counters.push_back(std::pair<std::string,std::string>("",t.first)); 
     565    } 
     566  } 
     567 
     568  for (std::list<std::pair<std::string,std::string> >::iterator it = counters.begin(); it != counters.end(); ++it) { 
    512569    try { 
    513570      try { 
    514571        PDH::PDHQuery pdh; 
    515572        PDHCollectors::StaticPDHCounterListener counter; 
    516         pdh.addCounter((*it), &counter); 
     573        pdh.addCounter((*it).second, &counter); 
    517574        pdh.open(); 
    518575        pdh.collect(); 
    519         msg += strEx::itos(counter.getValue()); 
     576        std::string name = (*it).first; 
     577        if (name.empty()) 
     578          name = (*it).second; 
     579        if (bNSCLientCompatible) { 
     580          msg += strEx::itos(counter.getValue()); 
     581        } else { 
     582          std::string tStr; 
     583          if (crit.max.hasBounds() && crit.max.checkMAX(counter.getValue())) { 
     584            tStr = crit.max.prettyPrint(name, counter.getValue()) + " > critical"; 
     585            NSCHelper::escalteReturnCodeToCRIT(returnCode); 
     586          } else if (crit.min.hasBounds() && crit.min.checkMIN(counter.getValue())) { 
     587            tStr = crit.min.prettyPrint(name, counter.getValue()) + " < critical"; 
     588            NSCHelper::escalteReturnCodeToCRIT(returnCode); 
     589          } else if (warn.max.hasBounds() && warn.max.checkMAX(counter.getValue())) { 
     590            tStr = warn.max.prettyPrint(name, counter.getValue()) + " > warning"; 
     591            NSCHelper::escalteReturnCodeToWARN(returnCode); 
     592          } else if (warn.min.hasBounds() && warn.min.checkMIN(counter.getValue())) { 
     593            tStr = warn.min.prettyPrint(name, counter.getValue()) + " < warning"; 
     594            NSCHelper::escalteReturnCodeToWARN(returnCode); 
     595          } else if (bShowAll) { 
     596            tStr = name + ": " + strEx::itos(counter.getValue()); 
     597          } 
     598          perf += checkHolders::SizeMaxMin<__int64, checkHolders::int64_handler<> >::printPerf(name, counter.getValue(), warn, crit); 
     599          msg += tStr; 
     600        } 
     601 
    520602        pdh.close(); 
    521603      } catch (const PDH::PDHException &e) { 
     
    531613  } 
    532614  if (msg.empty()) 
    533     msg ="uhmm..."; 
    534   return ret; 
     615    msg = "OK all counters within bounds."; 
     616  else 
     617    msg = NSCHelper::translateReturn(returnCode) + ": " + msg; 
     618  return returnCode; 
    535619} 
    536620NSC_WRAPPERS_MAIN_DEF(gNSClientCompat); 
  • trunk/modules/CheckSystem/CheckSystem.h

    rf22f5a9 rf896cfb  
    2929  bool hasCommandHandler(); 
    3030  bool hasMessageHandler(); 
    31   NSCAPI::nagiosReturn handleCommand(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
     31  NSCAPI::nagiosReturn handleCommand(const strEx::blindstr command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
    3232 
    3333 
    34   NSCAPI::nagiosReturn checkCPU(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
    35   NSCAPI::nagiosReturn checkUpTime(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
    36   NSCAPI::nagiosReturn checkServiceState(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
    37   NSCAPI::nagiosReturn checkMem(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
    38   NSCAPI::nagiosReturn checkProcState(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
    39   NSCAPI::nagiosReturn checkCounter(const std::string command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
     34  NSCAPI::nagiosReturn checkCPU(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
     35  NSCAPI::nagiosReturn checkUpTime(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
     36  NSCAPI::nagiosReturn checkServiceState(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
     37  NSCAPI::nagiosReturn checkMem(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
     38  NSCAPI::nagiosReturn checkProcState(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
     39  NSCAPI::nagiosReturn checkCounter(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); 
    4040 
    4141 
  • trunk/modules/NRPEListener/NRPEListener.cpp

    rf22f5a9 rf896cfb  
    3838    if (t.first.empty() || t.second.empty()) { 
    3939      NSC_LOG_ERROR_STD("Invalid command definition: " + (*it)); 
    40     } else 
    41       addCommand(t.first, t.second); 
     40    } else { 
     41      addCommand(t.first.c_str(), t.second); 
     42    } 
    4243  } 
    4344 
     
    9697 
    9798 
    98 NSCAPI::nagiosReturn NRPEListener::handleCommand(const std::string command, const unsigned int argLen, char **char_args, std::string &message, std::string &perf) { 
     99NSCAPI::nagiosReturn NRPEListener::handleCommand(const strEx::blindstr command, const unsigned int argLen, char **char_args, std::string &message, std::string &perf) { 
    99100  commandList::iterator it = commands.find(command); 
    100101  if (it == commands.end()) 
  • trunk/modules/NRPEListener/NRPEListener.h

    rae192e3 rf896cfb  
    1010  simpleSSL::Listener socket_ssl_; 
    1111  simpleSocket::Listener<> socket_; 
    12   typedef std::map<std::string, std::string> commandList; 
     12  typedef std::map<strEx::blindstr, std::string> commandList; 
    1313  commandList commands; 
    1414  unsigned int timeout; 
     
    2525  bool hasCommandHandler(); 
    2626  bool hasMessageHandler(); 
    27   NSCAPI::nagiosReturn handleCommand(const std::string command, const unsigned int argLen, char **char_args, std::string &message, std::string &perf); 
     27  NSCAPI::nagiosReturn handleCommand(const strEx::blindstr command, const unsigned int argLen, char **char_args, std::string &message, std::string &perf); 
    2828 
    2929private: 
     
    5454  NRPEPacket handlePacket(NRPEPacket p); 
    5555  int executeNRPECommand(std::string command, std::string &msg, std::string &perf); 
    56   void addCommand(std::string key, std::string args) { 
     56  void addCommand(strEx::blindstr key, std::string args) { 
    5757    commands[key] = args; 
    5858  } 
  • trunk/modules/NSClientListener/NSClientListener.cpp

    rf22f5a9 rf896cfb  
    6363} 
    6464 
     65/** 
     66* Main command parser and delegator. 
     67* This also handles a lot of the simpler responses (though some are deferred to other helper functions) 
     68* 
     69#define REQ_CLIENTVERSION 1 // Works fine! 
     70#define REQ_CPULOAD   2 // Quirks 
     71- Needs settings for default buffer size (backlog) and possibly other things. 
     72- Buffer needs to be synced with the client (don't know the size of that) 
     73- I think the idea was that the buffer would recursive to make a smaller memory footprint. 
     74(ie. the first level buffer have samples from every second, next level samples from every minute, next level hours etc...) 
     75(and I don't know the status of this, doesn't seem to be that way) 
     76#define REQ_UPTIME      3 // Works fine! 
     77#define REQ_USEDDISKSPACE 4 // Works fine! 
     78#define REQ_SERVICESTATE  5 // Works fine! 
     79#define REQ_PROCSTATE   6 // Works fine! 
     80#define REQ_MEMUSE      7 // Works fine! 
     81//#define REQ_COUNTER   8 // ! - not implemented Have to look at this, if anyone has a sample let me know... 
     82//#define REQ_FILEAGE   9 // ! - not implemented Don't know how to use 
     83//#define REQ_INSTANCES 10  // ! - not implemented Don't know how to use 
     84* 
     85*/ 
    6586 
    6687std::string NSClientListener::parseRequest(std::string buffer)  { 
Note: See TracChangeset for help on using the changeset viewer.