Changeset 3baaa4d in nscp for modules


Ignore:
Timestamp:
02/17/05 22:41:31 (8 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
db70efa
Parents:
50744c5
Message:

Verified NSCLient compatiblity for many commands and some minor tweaks (now most NSClient commands are OK)

Location:
modules
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • modules/NSClientCompat/NSClientCompat.cpp

    ra0528c4 r3baaa4d  
    8686 * This also handles a lot of the simpler responses (though some are deferred to other helper functions) 
    8787 * 
    88  #define REQ_CLIENTVERSION  1 // x 
    89  #define REQ_CPULOAD    2 // x 
    90  #define REQ_UPTIME     3 // x 
    91  #define REQ_USEDDISKSPACE  4 // x 
    92  #define REQ_SERVICESTATE 5 // x 
    93  #define REQ_PROCSTATE    6 // x 
    94  #define REQ_MEMUSE     7 // x 
    95  //#define REQ_COUNTER    8 // ! - not implemented 
    96  //#define REQ_FILEAGE    9 // ! - not implemented 
    97  //#define REQ_INSTANCES  10  // ! - not implemented 
     88 #define REQ_CLIENTVERSION  1 // Works fine! 
     89 #define REQ_CPULOAD    2 // Quirks 
     90 - Needs settings for default buffer size (backlog) and possibly other things. 
     91 - Buffer needs to be synced with the client (don't know the size of that) 
     92 - I think the idea was that the buffer would recursive to make a smaller memory footprint. 
     93  (ie. the first level buffer have samples from every second, next level samples from every minute, next level hours etc...) 
     94  (and I don't know the status of this, doesn't seem to be that way) 
     95 #define REQ_UPTIME     3 // Works fine! 
     96 #define REQ_USEDDISKSPACE  4 // Works fine! 
     97 #define REQ_SERVICESTATE 5 // Works fine! 
     98 #define REQ_PROCSTATE    6 // Works fine! 
     99 #define REQ_MEMUSE     7 // Works fine! 
     100 //#define REQ_COUNTER    8 // ! - not implemented Have to look at this, if anyone has a sample let me know... 
     101 //#define REQ_FILEAGE    9 // ! - not implemented Dont know how to use 
     102 //#define REQ_INSTANCES  10  // ! - not implemented Dont know how to use 
    98103 * 
    99104 * @param command  
     
    109114  switch (id) { 
    110115    case REQ_CLIENTVERSION: 
    111       return NSCModuleHelper::getApplicationName() + " " + NSCModuleHelper::getApplicationVersionString(); 
    112      
     116      { 
     117        std::string version = NSCModuleHelper::getSettingsString("nsclient compat", "version", "modern"); 
     118        if (version == "modern") 
     119          return NSCModuleHelper::getApplicationName() + " " + NSCModuleHelper::getApplicationVersionString(); 
     120        return version; 
     121      } 
    113122    case REQ_UPTIME: 
    114123      return strEx::itos(pdhCollector->getUptime()); 
    115124 
    116125    case REQ_CPULOAD: 
    117       stl_args = NSCHelper::makelist(argLen, args); 
    118       if (stl_args.empty()) 
    119         return "ERROR: Missing argument exception."; 
    120       return strEx::itos(pdhCollector->getCPUAvrage(strEx::stoi(stl_args.front())*(60/CHECK_INTERVAL))); 
    121  
     126      { 
     127        stl_args = NSCHelper::makelist(argLen, args); 
     128        if (stl_args.empty()) 
     129          return "ERROR: Missing argument exception."; 
     130        std::string ret; 
     131        while (!stl_args.empty()) { 
     132          std::string s = stl_args.front(); stl_args.pop_front(); 
     133          int v = pdhCollector->getCPUAvrage(strEx::stoi(s)*(60/CHECK_INTERVAL)); 
     134          if (v == -1) 
     135            return ret; 
     136          if (!ret.empty()) 
     137            ret += "&"; 
     138          ret += strEx::itos(v); 
     139        } 
     140        return ret; 
     141      } 
    122142    case REQ_SERVICESTATE: 
    123143      return NSCommands::serviceState(NSCHelper::makelist(argLen, args)); 
  • modules/NSClientCompat/NSCommands.cpp

    ra0528c4 r3baaa4d  
    8282        state = error; 
    8383      if (!ret.empty()) ret += " - "; 
    84       ret += exe + " : Stopped"; 
     84      ret += exe + " : not running"; 
    8585    } else if (showAll) { 
    8686      if (!ret.empty()) ret += " - "; 
  • modules/SysTray/TrayIcon.cpp

    r50744c5 r3baaa4d  
    4343  case WM_INITDIALOG: 
    4444    addIcon(hwndDlg); 
    45 //    return TRUE; 
    4645    break; 
    4746 
Note: See TracChangeset for help on using the changeset viewer.