Changeset 1d53fe0 in nscp for include


Ignore:
Timestamp:
02/12/09 20:28:56 (4 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
b1ac2fa
Parents:
04f2743
Message:

2009-02-11 MickeM

  • Fixed so that performance data is always(?) renderd regardless of if we have bounds or not. This was primarily to fix issues where we have might not "unexpectedly" get performance data (might still be some issues here so let me know).

2009-02-06 MickeM

2009-02-05 MickeM

  • Fixed so the error message for "to small eventlog buffer" specifies the required size.
  • Changed so that event log buffer problems are "ignored in the result" (still logged in the error log).

2009-02-03 MickeM

  • Added support for changing the time when using NSCA with the time_delay in NSC.ini time_delay=+4h or time_delay=-1h etc should can now be used when system time not the same as NSCA time.

2009-01-30 MickeM

  • Added support for changing name and description of service from the /install command line NSClient++ /install [gui] [start] [service name] [description] NSClient++ /uninstall [gui] [stop] [service name] NSClient++ /start [gui] [service name] NSClient++ /stop [gui] [service name]

2009-01-28 MickeM

  • Slightly improved error handling around socket creation
  • Fixed some pretty minor issues with the SysTray module (uncreation as well as new boost build).

2009-01-25 MickeM

  • Fixed issue with checkVersion (#242)
  • Fixed spelling error (#244)
  • Fixed crash in CheckFile when a file was locked in exclusive mode (#254) + Improved error handling in all CheckDIsk/CheckFile checks. Should report errors better now.
  • Updated the config file a bit: remving "beta" from a bunch of modules no longer in beta. (#270) + Added more filter operatos to all numeric filters so they accept eq:, ne:, gt:, lt: in addition to =, >, <, <>, !, !=, in: (#269)

2009-01-23 MickeM

+ Added better support for numerical hit matching in the eventlog module. You can now use exact and detailed matching.

You can now use the following syntax:
CheckEventLog ... warn=ne:1 crit=eq:0 ...
To generate a warning if the number of hits are != 1 and a critical if the number of hits are = 0.
Other operators avalible are: =, >, <, <>, !, !=, eq:, ne:, gt:, lt:

Location:
include
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • include/REGSettings.h

    rfebff5f r1d53fe0  
    148148    DWORD type; 
    149149    DWORD cbData = sizeof(DWORD); 
    150     BYTE *bData = new BYTE[cbData+1]; 
    151     bRet = RegQueryValueEx(hTemp, lpszKey, NULL, &type, bData, &cbData); 
     150    DWORD buffer; 
     151    //BYTE *bData = new BYTE[cbData+1]; 
     152    bRet = RegQueryValueEx(hTemp, lpszKey, NULL, &type, reinterpret_cast<LPBYTE>(&buffer), &cbData ); 
    152153    if (type != REG_DWORD) { 
    153154      bRet = -1; 
     
    155156    RegCloseKey(hTemp); 
    156157    if (bRet == ERROR_SUCCESS) { 
    157       ret = static_cast<DWORD>(*bData); 
    158     } 
    159     delete [] bData; 
     158      ret = buffer; 
     159    } 
     160    //delete [] bData; 
    160161    return ret; 
    161162  } 
  • include/ServiceCmd.cpp

    r3692371 r1d53fe0  
    2121#include <iostream> 
    2222#include <msvc_wrappers.h> 
     23#include <error.hpp> 
    2324 
    2425namespace serviceControll { 
     
    4546    schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); 
    4647    if (!schSCManager) 
    47       throw SCException(_T("OpenSCManager failed.")); 
     48      throw SCException(_T("OpenSCManager failed:") + error::lookup::last_error()); 
    4849    schService = CreateService( 
    4950      schSCManager,               // SCManager database 
     
    6768        throw SCException(_T("Service already installed!")); 
    6869      } 
    69       throw SCException(_T("Unable to install service."), err); 
     70      throw SCException(_T("Unable to install service.") + error::lookup::last_error(err)); 
    7071    } 
    7172    std::wcout << _T("Service ") << szName << _T(" installed...") << std::endl;; 
     
    8485    schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); 
    8586    if (!schSCManager) 
    86       throw SCException(_T("OpenSCManager failed.")); 
     87      throw SCException(_T("OpenSCManager failed: ") + error::lookup::last_error()); 
    8788    schService = OpenService(schSCManager, szName, SERVICE_ALL_ACCESS); 
    8889    if (!schService) { 
    8990      DWORD err = GetLastError(); 
    9091      CloseServiceHandle(schSCManager); 
    91       throw SCException(_T("Unable to open service."), err); 
     92      throw SCException(_T("Unable to open service: ") + error::lookup::last_error(err)); 
    9293    } 
    9394    BOOL result = ChangeServiceConfig(schService, dwServiceType, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE , NULL, NULL, NULL,  
     
    118119      DWORD err = GetLastError(); 
    119120      CloseServiceHandle(schSCManager); 
    120       throw SCException(_T("Unable to open service."), err); 
     121      throw SCException(_T("Unable to open service: ") + error::lookup::last_error(err)); 
    121122    } 
    122123 
     
    150151    schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS ); 
    151152    if (!schSCManager)  
    152       throw SCException(_T("OpenSCManager failed.")); 
     153      throw SCException(_T("OpenSCManager failed: ") + error::lookup::last_error()); 
    153154    schService = OpenService(schSCManager, name.c_str(), SERVICE_ALL_ACCESS); 
    154155    if (schService) { 
     
    172173      CloseServiceHandle(schService); 
    173174    } else { 
    174       CloseServiceHandle(schSCManager); 
    175       throw SCException(_T("OpenService failed.")); 
     175      std::wstring err = _T("OpenService failed: ") + error::lookup::last_error(); 
     176      CloseServiceHandle(schSCManager); 
     177      throw SCException(err); 
    176178    } 
    177179    CloseServiceHandle(schSCManager); 
     
    187189    schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS ); 
    188190    if (!schSCManager)  
    189       throw SCException(_T("OpenSCManager failed.")); 
     191      throw SCException(_T("OpenSCManager failed: ") + error::lookup::last_error()); 
    190192    schService = OpenService(schSCManager, name.c_str(), SERVICE_ALL_ACCESS); 
    191193    if (schService) { 
  • include/Socket.h

    r846bbe4 r1d53fe0  
    507507        bindAddres_ = INADDR_ANY; 
    508508      listenQue_ = queLength; 
    509       threadManager_.createThread(this); 
     509      try { 
     510        threadManager_.createThread(this); 
     511      } catch (ThreadException e) { 
     512        throw SocketException(_T("Could not start thread (got exception in thread): ") + e.e_); 
     513      } 
    510514    } 
    511515    virtual void StopListener() { 
     
    518522      } catch (ThreadException e) { 
    519523        tBase::close(); 
    520         throw SocketException(_T("Could not terminate thread (got exception in thread).")); 
     524        throw SocketException(_T("Could not terminate thread (got exception in thread): ") + e.e_); 
    521525      } 
    522526      tBase::close(); 
  • include/checkHelpers.hpp

    r04f2743 r1d53fe0  
    137137      std::wstring tstr; 
    138138      if (crit.check(value, getAlias(), tstr, critical)) { 
    139         std::wcout << _T("crit") << std::endl; 
     139        //std::wcout << _T("crit") << std::endl; 
    140140        NSCHelper::escalteReturnCodeToCRIT(returnCode); 
    141141      } else if (warn.check(value, getAlias(), tstr, warning)) { 
    142         std::wcout << _T("warn") << std::endl; 
     142        //std::wcout << _T("warn") << std::endl; 
    143143        NSCHelper::escalteReturnCodeToWARN(returnCode); 
    144144      }else if (show == showLong) { 
    145         std::wcout << _T("long") << std::endl; 
     145        //std::wcout << _T("long") << std::endl; 
    146146        tstr = getAlias() + _T(": ") + TContents::toStringLong(value); 
    147147      }else if (show == showShort) { 
    148         std::wcout << _T("short") << std::endl; 
     148        //std::wcout << _T("short") << std::endl; 
    149149        tstr = getAlias() + _T(": ") + TContents::toStringShort(value); 
    150150      } 
    151       std::wcout << _T("result: ") << tstr << _T("--") << std::endl; 
    152151      if (perfData) 
    153152        perf += gatherPerfData(value); 
     
    682681        return true; 
    683682      } else { 
     683        NSC_DEBUG_MSG_STD(_T("Missing bounds for check: ") + lable); 
    684684        //std::cout << "No bounds specified..." << std::endl; 
    685685      } 
     
    757757      } else { 
    758758        NSC_DEBUG_MSG_STD(_T("Missing bounds for maxmin-bounds check: ") + alias); 
     759        return min.gatherPerfData(alias, value, 0, 0); 
    759760      } 
    760761      return _T(""); 
  • include/config.h

    rbb8b6d1 r1d53fe0  
    184184#define NSCA_CACHE_HOST _T("cache_hostname") 
    185185#define NSCA_CACHE_HOST_DEFAULT 0 
     186#define NSCA_TIME_DELTA _T("time_delay") 
     187#define NSCA_TIME_DELTA_DEFAULT _T("0") 
    186188 
    187189#define C_SYSTEM_SVC_ALL_0 _T("check_all_services[SERVICE_BOOT_START]") 
Note: See TracChangeset for help on using the changeset viewer.