Changeset 3f69109 in nscp


Ignore:
Timestamp:
12/11/07 21:34:14 (6 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
47b843a
Parents:
5ca3931
Message:

2007-12-11 MickeM

+ Added support for index-lookups of PDH counters (hopefully *all* local problems are now fixed (yeah right))

2007-12-10 MickeM

+ Added intial draft for LUA module

Files:
5 added
9 edited

Legend:

Unmodified
Added
Removed
  • AutoBuild.h

    r5ca3931 r3f69109  
    33// change the FALSE to TRUE for autoincrement of build number 
    44#define INCREMENT_VERSION TRUE 
    5 #define FILEVER        0,3,0,6 
    6 #define PRODUCTVER     0,3,0,6 
    7 #define STRFILEVER     _T("0.3.0.6") 
    8 #define STRPRODUCTVER  _T("0.3.0.6") 
    9 #define STRPRODUCTDATE  _T("2007-12-05") 
     5#define FILEVER        0,3,0,12 
     6#define PRODUCTVER     0,3,0,12 
     7#define STRFILEVER     _T("0.3.0.12") 
     8#define STRPRODUCTVER  _T("0.3.0.12") 
     9#define STRPRODUCTDATE  _T("2007-12-11") 
    1010#endif // AUTOBUILD_H 
  • NSC.dist

    r23c63eb r3f69109  
    2020; RemoteConfiguration IS AN EXTREM EARLY IDEA SO DONT USE FOR PRODUCTION ENVIROMNEMTS! 
    2121;RemoteConfiguration.dll 
     22; NSCA Agent is a new beta module use with care! 
     23;NSCAAgent.dll 
    2224 
    2325[Settings] 
     
    178180; myotherfile.ini 
    179181; real.ini 
     182 
     183[NSCA Agent] 
     184;# CHECK INTERVALL (in seconds) 
     185;   How often we should run the checks and submit the results. 
     186interval=5 
     187; 
     188;# ENCRYPTION METHOD 
     189;   This option determines the method by which the send_nsca client will encrypt the packets it sends  
     190;   to the nsca daemon. The encryption method you choose will be a balance between security and  
     191;   performance, as strong encryption methods consume more processor resources. 
     192;   You should evaluate your security needs when choosing an encryption method. 
     193; 
     194; Note: The encryption method you specify here must match the decryption method the nsca daemon uses  
     195;       (as specified in the nsca.cfg file)!! 
     196; Values: 
     197; 0 = None  (Do NOT use this option) 
     198; -- only 0 is supported as of now, but will change in the future -- 
     199;encryption_method=0 
     200; 
     201;# BIND TO ADDRESS 
     202;  Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname. 
     203;  Leaving this blank will bind to "one" local interface. 
     204; -- not supported as of now -- 
     205;bind_to_address= 
     206; 
     207;# NAGIOS SERVER ADDRESS 
     208;  The address to the nagios server to submit results to. 
     209;nsca_host=192.168.0.1 
     210; 
     211;# NAGIOS SERVER PORT 
     212;  The port to the nagios server to submit results to. 
     213;nsca_port=5667 
     214 
     215; The checks to run everytime we submit results back to nagios 
     216; 
     217[NSCA Commands] 
     218my_cpu_check=checkCPU warn=80 crit=90 time=20m time=10s time=4 
     219my_mem_check=checkMem MaxWarn=80% MaxCrit=90% ShowAll type=page 
     220my_svc_check=checkServiceState CheckAll 
  • NSClient++-2005.sln

    r5ca3931 r3f69109  
    33Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NSClient++", "NSClient++-2005.vcproj", "{2286162D-7571-4735-BAC8-4A8D33A4F42D}" 
    44  ProjectSection(ProjectDependencies) = postProject 
     5    {BBFF8362-C626-4838-B0A2-F695D638AD24} = {BBFF8362-C626-4838-B0A2-F695D638AD24} 
     6    {E6E588AB-EFEF-481C-9AF7-DCDCB95CFF45} = {E6E588AB-EFEF-481C-9AF7-DCDCB95CFF45} 
     7    {BA246C01-063A-4548-8957-32D5CC76171B} = {BA246C01-063A-4548-8957-32D5CC76171B} 
     8    {05DE66AC-E55C-43B3-849F-7EC695D8B8D0} = {05DE66AC-E55C-43B3-849F-7EC695D8B8D0} 
     9    {2FF60AF6-09AA-49AB-B414-2E8FD01655C6} = {2FF60AF6-09AA-49AB-B414-2E8FD01655C6} 
     10    {62B685D7-3A2E-4F3E-B2B8-B17F20C0217F} = {62B685D7-3A2E-4F3E-B2B8-B17F20C0217F} 
     11    {08D6246D-1B4A-47A3-965D-296DCC54A4E8} = {08D6246D-1B4A-47A3-965D-296DCC54A4E8} 
     12    {2FCAF54B-AAD3-4F59-895A-8F9CEAFDC65D} = {2FCAF54B-AAD3-4F59-895A-8F9CEAFDC65D} 
     13    {8F1C3E39-D6C6-4414-AAD2-FE03C9A8655F} = {8F1C3E39-D6C6-4414-AAD2-FE03C9A8655F} 
    514    {626EB00E-A4D2-4B02-9BF4-4C655CA2B7E4} = {626EB00E-A4D2-4B02-9BF4-4C655CA2B7E4} 
    6     {8F1C3E39-D6C6-4414-AAD2-FE03C9A8655F} = {8F1C3E39-D6C6-4414-AAD2-FE03C9A8655F} 
    7     {2FCAF54B-AAD3-4F59-895A-8F9CEAFDC65D} = {2FCAF54B-AAD3-4F59-895A-8F9CEAFDC65D} 
    8     {08D6246D-1B4A-47A3-965D-296DCC54A4E8} = {08D6246D-1B4A-47A3-965D-296DCC54A4E8} 
    9     {62B685D7-3A2E-4F3E-B2B8-B17F20C0217F} = {62B685D7-3A2E-4F3E-B2B8-B17F20C0217F} 
    10     {2FF60AF6-09AA-49AB-B414-2E8FD01655C6} = {2FF60AF6-09AA-49AB-B414-2E8FD01655C6} 
    11     {05DE66AC-E55C-43B3-849F-7EC695D8B8D0} = {05DE66AC-E55C-43B3-849F-7EC695D8B8D0} 
    12     {BA246C01-063A-4548-8957-32D5CC76171B} = {BA246C01-063A-4548-8957-32D5CC76171B} 
    13     {E6E588AB-EFEF-481C-9AF7-DCDCB95CFF45} = {E6E588AB-EFEF-481C-9AF7-DCDCB95CFF45} 
    14     {BBFF8362-C626-4838-B0A2-F695D638AD24} = {BBFF8362-C626-4838-B0A2-F695D638AD24} 
    1515  EndProjectSection 
    1616EndProject 
     
    3838EndProject 
    3939Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NSCAAgent", "modules\NSCAAgent\NSCAAgent-2005.vcproj", "{6F55C9BF-57F6-4A15-A058-C83A52F539EE}" 
     40EndProject 
     41Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LUAScript", "modules\LUAScript\LUAScript-2005.vcproj", "{26B84883-BE52-40E6-9BEE-55AD056D5751}" 
     42  ProjectSection(ProjectDependencies) = postProject 
     43    {B6D08289-B8AE-4391-9D07-93B22618BE58} = {B6D08289-B8AE-4391-9D07-93B22618BE58} 
     44  EndProjectSection 
     45EndProject 
     46Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LUA", "..\..\LUA\LUA\LUA.vcproj", "{B6D08289-B8AE-4391-9D07-93B22618BE58}" 
    4047EndProject 
    4148Global 
     
    556563    {6F55C9BF-57F6-4A15-A058-C83A52F539EE}.Release|x64.ActiveCfg = Release|x64 
    557564    {6F55C9BF-57F6-4A15-A058-C83A52F539EE}.Release|x64.Build.0 = Release|x64 
     565    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug|Any CPU.ActiveCfg = Debug|x64 
     566    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug|Itanium.ActiveCfg = Debug|x64 
     567    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 
     568    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug|Mixed Platforms.Build.0 = Debug|x64 
     569    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug|Win32.ActiveCfg = Debug|Win32 
     570    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug|Win32.Build.0 = Debug|Win32 
     571    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug|x64.ActiveCfg = Debug|x64 
     572    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug|x64.Build.0 = Debug|x64 
     573    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug-MemCheck|Any CPU.ActiveCfg = Debug-MemCheck|x64 
     574    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug-MemCheck|Itanium.ActiveCfg = Debug-MemCheck|x64 
     575    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug-MemCheck|Mixed Platforms.ActiveCfg = Debug-MemCheck|x64 
     576    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug-MemCheck|Mixed Platforms.Build.0 = Debug-MemCheck|x64 
     577    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug-MemCheck|Win32.ActiveCfg = Debug-MemCheck|Win32 
     578    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug-MemCheck|Win32.Build.0 = Debug-MemCheck|Win32 
     579    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug-MemCheck|x64.ActiveCfg = Debug-MemCheck|x64 
     580    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Debug-MemCheck|x64.Build.0 = Debug-MemCheck|x64 
     581    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Distribution|Any CPU.ActiveCfg = Distribution|x64 
     582    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Distribution|Itanium.ActiveCfg = Distribution|x64 
     583    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Distribution|Mixed Platforms.ActiveCfg = Distribution|x64 
     584    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Distribution|Mixed Platforms.Build.0 = Distribution|x64 
     585    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Distribution|Win32.ActiveCfg = Distribution|Win32 
     586    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Distribution|Win32.Build.0 = Distribution|Win32 
     587    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Distribution|x64.ActiveCfg = Distribution|x64 
     588    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Distribution|x64.Build.0 = Distribution|x64 
     589    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Nightly|Any CPU.ActiveCfg = Nightly|x64 
     590    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Nightly|Itanium.ActiveCfg = Nightly|x64 
     591    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Nightly|Mixed Platforms.ActiveCfg = Nightly|x64 
     592    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Nightly|Mixed Platforms.Build.0 = Nightly|x64 
     593    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Nightly|Win32.ActiveCfg = Nightly|Win32 
     594    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Nightly|Win32.Build.0 = Nightly|Win32 
     595    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Nightly|x64.ActiveCfg = Nightly|x64 
     596    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Nightly|x64.Build.0 = Nightly|x64 
     597    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Release|Any CPU.ActiveCfg = Release|x64 
     598    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Release|Itanium.ActiveCfg = Release|x64 
     599    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Release|Mixed Platforms.ActiveCfg = Release|x64 
     600    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Release|Mixed Platforms.Build.0 = Release|x64 
     601    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Release|Win32.ActiveCfg = Release|Win32 
     602    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Release|Win32.Build.0 = Release|Win32 
     603    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Release|x64.ActiveCfg = Release|x64 
     604    {26B84883-BE52-40E6-9BEE-55AD056D5751}.Release|x64.Build.0 = Release|x64 
     605    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug|Any CPU.ActiveCfg = Debug|Win32 
     606    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug|Itanium.ActiveCfg = Debug|Win32 
     607    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 
     608    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug|Mixed Platforms.Build.0 = Debug|Win32 
     609    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug|Win32.ActiveCfg = Debug|Win32 
     610    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug|Win32.Build.0 = Debug|Win32 
     611    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug|x64.ActiveCfg = Debug|Win32 
     612    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug-MemCheck|Any CPU.ActiveCfg = Debug|Win32 
     613    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug-MemCheck|Itanium.ActiveCfg = Debug|Win32 
     614    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug-MemCheck|Mixed Platforms.ActiveCfg = Debug|Win32 
     615    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug-MemCheck|Mixed Platforms.Build.0 = Debug|Win32 
     616    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug-MemCheck|Win32.ActiveCfg = Debug|Win32 
     617    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug-MemCheck|Win32.Build.0 = Debug|Win32 
     618    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Debug-MemCheck|x64.ActiveCfg = Debug|Win32 
     619    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Distribution|Any CPU.ActiveCfg = Debug|Win32 
     620    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Distribution|Itanium.ActiveCfg = Debug|Win32 
     621    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Distribution|Mixed Platforms.ActiveCfg = Debug|Win32 
     622    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Distribution|Mixed Platforms.Build.0 = Debug|Win32 
     623    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Distribution|Win32.ActiveCfg = Debug|Win32 
     624    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Distribution|Win32.Build.0 = Debug|Win32 
     625    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Distribution|x64.ActiveCfg = Debug|Win32 
     626    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Nightly|Any CPU.ActiveCfg = Release|Win32 
     627    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Nightly|Itanium.ActiveCfg = Release|Win32 
     628    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Nightly|Mixed Platforms.ActiveCfg = Release|Win32 
     629    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Nightly|Mixed Platforms.Build.0 = Release|Win32 
     630    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Nightly|Win32.ActiveCfg = Release|Win32 
     631    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Nightly|Win32.Build.0 = Release|Win32 
     632    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Nightly|x64.ActiveCfg = Release|Win32 
     633    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Release|Any CPU.ActiveCfg = Release|Win32 
     634    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Release|Itanium.ActiveCfg = Release|Win32 
     635    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Release|Mixed Platforms.ActiveCfg = Release|Win32 
     636    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Release|Mixed Platforms.Build.0 = Release|Win32 
     637    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Release|Win32.ActiveCfg = Release|Win32 
     638    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Release|Win32.Build.0 = Release|Win32 
     639    {B6D08289-B8AE-4391-9D07-93B22618BE58}.Release|x64.ActiveCfg = Release|Win32 
    558640  EndGlobalSection 
    559641  GlobalSection(SolutionProperties) = preSolution 
  • changelog

    r5ca3931 r3f69109  
    55 * Add module for relaying events 
    66 * Add API for rehashing the daemon (or implement it the API is there but does nothing) 
     7 
     82007-12-11 MickeM 
     9 + Added support for index-lookups of PDH counters (hopefully *all* local problems are now fixed (yeah right)) 
     10 
     112007-12-10 MickeM 
     12 + Added intial draft for LUA module 
    713 
    8142007-12-09 MickeM 
  • include/PDHCounter.cpp

    rdc65e35 r3f69109  
    2121#include "stdafx.h" 
    2222#include "pdhcounter.h" 
     23 
     24PDH::PDHResolver::fpPdhLookupPerfNameByIndex PDH::PDHResolver::pPdhLookupPerfNameByIndex = NULL; 
     25HMODULE PDH::PDHResolver::PDH_ = NULL; 
  • include/PDHCounter.h

    r5ca3931 r3f69109  
    2828 
    2929namespace PDH { 
     30 
     31 
     32 
    3033  class PDHException { 
    3134  private: 
     
    4548        ret += _T(": ") + error::format::from_module(_T("PDH.DLL"), pdhStatus_); 
    4649      } 
     50      return ret; 
     51    } 
     52  }; 
     53 
     54  class PDHResolver { 
     55  public: 
     56    //typedef PDH_FUNCTION (*fpPdhLookupPerfNameByIndex)(IN LPCWSTR szMachineName,IN DWORD dwNameIndex,IN LPWSTR szNameBuffer,IN LPDWORD pcchNameBufferSize); 
     57    typedef PDH_STATUS (WINAPI *fpPdhLookupPerfNameByIndex)(LPCWSTR,DWORD,LPWSTR,LPDWORD); 
     58    static fpPdhLookupPerfNameByIndex pPdhLookupPerfNameByIndex; 
     59    static HMODULE PDH_; 
     60  private: 
     61    static void lookup_function() { 
     62      if (pPdhLookupPerfNameByIndex != NULL) 
     63        return; 
     64      PDH_ = ::LoadLibrary(_TEXT("PDH")); 
     65       
     66      if (PDH_ == NULL) { 
     67        throw PDHException(_T("LoadLibrary for PDH failed: ")+ error::lookup::last_error()); 
     68      } 
     69#ifdef UNICODE 
     70      //*(FARPROC *)&pPdhLookupPerfNameByIndex 
     71      pPdhLookupPerfNameByIndex = (fpPdhLookupPerfNameByIndex)::GetProcAddress(PDH_, "PdhLookupPerfNameByIndexW"); 
     72#else 
     73      pPdhLookupPerfNameByIndex = (fpPdhLookupPerfNameByIndex)::GetProcAddress(PDH_, "PdhLookupPerfNameByIndexA"); 
     74#endif 
     75      if (pPdhLookupPerfNameByIndex == NULL) { 
     76        throw PDHException(_T("Failed to find function: PdhLookupPerfNameByIndex!")+ error::lookup::last_error()); 
     77      } 
     78    } 
     79  public: 
     80    static PDH_STATUS PdhLookupPerfNameByIndex(LPCTSTR szMachineName,DWORD dwNameIndex,LPTSTR szNameBuffer,LPDWORD pcchNameBufferSize) { 
     81      PDHResolver::lookup_function(); 
     82      if (pPdhLookupPerfNameByIndex == NULL) 
     83        throw PDHException(_T("Failed to initalize PdhLookupPerfNameByIndex :(")); 
     84      return pPdhLookupPerfNameByIndex(szMachineName,dwNameIndex,szNameBuffer,pcchNameBufferSize); 
     85    } 
     86#define PDH_INDEX_BUF_LEN 2048 
     87    static std::wstring PdhLookupPerfNameByIndex(LPCTSTR szMachineName, DWORD dwNameIndex) { 
     88      TCHAR *buffer = new TCHAR[PDH_INDEX_BUF_LEN+1]; 
     89      DWORD bufLen = PDH_INDEX_BUF_LEN; 
     90      PDH_STATUS status = PDHResolver::PdhLookupPerfNameByIndex(szMachineName,dwNameIndex,buffer,&bufLen); 
     91      if (status != ERROR_SUCCESS) { 
     92        delete [] buffer; 
     93        throw PDHException(_T("RESOLVER"), _T("PdhLookupPerfNameByIndex: Could not find index: ") + strEx::itos(dwNameIndex), status); 
     94      } 
     95      std::wstring ret = buffer; 
     96      delete [] buffer; 
    4797      return ret; 
    4898    } 
     
    211261      return counter; 
    212262    } 
     263    std::wstring lookupIndex(DWORD index) { 
     264      return PDHResolver::PdhLookupPerfNameByIndex(NULL, index); 
     265    } 
    213266    PDHCounter* addCounter(std::wstring name) { 
    214267      PDHCounter *counter = new PDHCounter(name); 
  • modules/CheckSystem/PDHCollector.cpp

    r5ca3931 r3f69109  
    6666    settings.setFile(NSCModuleHelper::getBasePath(),  _T("counters.defs"), true); 
    6767    std::wstring section = NSCModuleHelper::getSettingsString(C_SYSTEM_SECTION_TITLE, C_SYSTEM_FORCE_LANGUAGE, C_SYSTEM_FORCE_LANGUAGE_DEFAULT); 
     68    bool bUseIndex = false; 
    6869 
    6970    try { 
     
    7980        NSC_DEBUG_MSG_STD(_T("Autodetected NT4, using NT4 PDH counters.")); 
    8081        prefix = _T("NT4"); 
     82        bUseIndex = false; 
    8183        langId = systemInfo::GetSystemDefaultLangID(); 
    8284      } else if (systemInfo::isAboveW2K(osVer)) { 
    8385        NSC_DEBUG_MSG_STD(_T("Autodetected w2k or later, using w2k PDH counters.")); 
     86        bUseIndex = true; 
    8487        prefix = _T("W2K"); 
    8588        langId = systemInfo::GetSystemDefaultUILanguage(); 
     
    107110      return -1; 
    108111    } 
    109     pdh.addCounter(settings.getString(section, prefix + _T("_") + C_SYSTEM_MEM_PAGE_LIMIT, C_SYSTEM_MEM_PAGE_LIMIT_DEFAULT), &memCmtLim); 
    110     pdh.addCounter(settings.getString(section, prefix + _T("_") + C_SYSTEM_MEM_PAGE, C_SYSTEM_MEM_PAGE_DEFAULT), &memCmt); 
    111     pdh.addCounter(settings.getString(section, prefix + _T("_") + C_SYSTEM_UPTIME, C_SYSTEM_UPTIME_DEFAULT), &upTime); 
    112     pdh.addCounter(settings.getString(section, prefix + _T("_") + C_SYSTEM_CPU, C_SYSTEM_MEM_CPU_DEFAULT), &cpu); 
    113     try { 
     112 
     113    try { 
     114      std::wstring proc; 
     115      std::wstring uptime; 
     116      std::wstring memCl; 
     117      std::wstring memCb; 
     118      if (bUseIndex) { 
     119        NSC_DEBUG_MSG_STD(_T("Using index to retrive counternames")); 
     120        proc = _T("\\") + pdh.lookupIndex(238) + _T("(_total)\\") + pdh.lookupIndex(6); 
     121        uptime = _T("\\") + pdh.lookupIndex(2) + _T("\\") + pdh.lookupIndex(674); 
     122        memCl = _T("\\") + pdh.lookupIndex(4) + _T("\\") + pdh.lookupIndex(30); 
     123        memCb = _T("\\") + pdh.lookupIndex(4) + _T("\\") + pdh.lookupIndex(26); 
     124      } else { 
     125        proc = settings.getString(section, prefix + _T("_") + C_SYSTEM_CPU, C_SYSTEM_MEM_CPU_DEFAULT); 
     126        uptime = settings.getString(section, prefix + _T("_") + C_SYSTEM_UPTIME, C_SYSTEM_UPTIME_DEFAULT); 
     127        memCl = settings.getString(section, prefix + _T("_") + C_SYSTEM_MEM_PAGE_LIMIT, C_SYSTEM_MEM_PAGE_LIMIT_DEFAULT); 
     128        memCb = settings.getString(section, prefix + _T("_") + C_SYSTEM_MEM_PAGE, C_SYSTEM_MEM_PAGE_DEFAULT); 
     129      } 
     130      NSC_DEBUG_MSG_STD(_T("Found counternames: CPU:    ") + proc); 
     131      NSC_DEBUG_MSG_STD(_T("Found counternames: UPTIME: ") + uptime); 
     132      NSC_DEBUG_MSG_STD(_T("Found counternames: MCL:    ") + memCl); 
     133      NSC_DEBUG_MSG_STD(_T("Found counternames: MCB:    ") + memCb); 
     134      pdh.addCounter(proc, &cpu); 
     135      pdh.addCounter(uptime, &upTime); 
     136      pdh.addCounter(memCl, &memCmtLim); 
     137      pdh.addCounter(memCb, &memCmt); 
    114138      pdh.open(); 
    115139    } catch (const PDH::PDHException &e) { 
    116140      NSC_LOG_ERROR_STD(_T("Failed to open performance counters: ") + e.getError()); 
     141      pdh.removeAllCounters(); 
    117142      NSC_LOG_ERROR_STD(_T("Trying to use default (English) counters")); 
    118       pdh.removeAllCounters(); 
     143      SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT)); 
    119144      pdh.addCounter(C_SYSTEM_MEM_PAGE_LIMIT_DEFAULT, &memCmtLim); 
    120145      pdh.addCounter(C_SYSTEM_MEM_PAGE_DEFAULT, &memCmt); 
  • modules/NRPEListener/NRPEListener-2005.vcproj

    r3f569d3 r3f69109  
    517517      Name="Nightly|Win32" 
    518518      OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\modules" 
    519       IntermediateDirectory="$(ConfigurationName)" 
     519      IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" 
    520520      ConfigurationType="2" 
    521521      InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 
  • modules/NSCAAgent/NSCAAgent-2005.vcproj

    r5ca3931 r3f69109  
    7070        Name="VCLinkerTool" 
    7171        AdditionalDependencies="ws2_32.lib" 
    72         OutputFile="../../Debug/modules/$(ProjectName).dll" 
     72        OutputFile="$(OutDir)\$(ProjectName).dll" 
    7373        LinkIncremental="2" 
    7474        ModuleDefinitionFile="NSCAAgent.def" 
     
    110110      ConfigurationType="2" 
    111111      InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 
    112       CharacterSet="2" 
     112      CharacterSet="1" 
    113113      > 
    114114      <Tool 
     
    152152      <Tool 
    153153        Name="VCLinkerTool" 
    154         AdditionalDependencies="Pdh.lib" 
    155         OutputFile="../../Debug/modules/$(ProjectName).dll" 
     154        AdditionalDependencies="ws2_32.lib" 
     155        OutputFile="$(OutDir)\$(ProjectName).dll" 
    156156        LinkIncremental="2" 
    157157        ModuleDefinitionFile="NSCAAgent.def" 
     
    193193      ConfigurationType="2" 
    194194      InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 
    195       CharacterSet="2" 
     195      CharacterSet="1" 
    196196      > 
    197197      <Tool 
     
    231231      <Tool 
    232232        Name="VCLinkerTool" 
    233         AdditionalDependencies="Pdh.lib" 
    234         OutputFile="../../Release/modules/$(ProjectName).dll" 
     233        AdditionalDependencies="ws2_32.lib" 
     234        OutputFile="$(OutDir)\$(ProjectName).dll" 
    235235        LinkIncremental="1" 
    236236        ModuleDefinitionFile="NSCAAgent.def" 
     
    273273      ConfigurationType="2" 
    274274      InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 
    275       CharacterSet="2" 
     275      CharacterSet="1" 
    276276      > 
    277277      <Tool 
     
    312312      <Tool 
    313313        Name="VCLinkerTool" 
    314         AdditionalDependencies="Pdh.lib" 
    315         OutputFile="../../Release/modules/$(ProjectName).dll" 
     314        AdditionalDependencies="ws2_32.lib" 
     315        OutputFile="$(OutDir)\$(ProjectName).dll" 
    316316        LinkIncremental="1" 
    317317        ModuleDefinitionFile="NSCAAgent.def" 
     
    354354      ConfigurationType="2" 
    355355      InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 
    356       CharacterSet="2" 
     356      CharacterSet="1" 
    357357      > 
    358358      <Tool 
     
    392392      <Tool 
    393393        Name="VCLinkerTool" 
    394         AdditionalDependencies="Pdh.lib" 
    395         OutputFile="../../Dist/modules/$(ProjectName).dll" 
     394        AdditionalDependencies="ws2_32.lib" 
     395        OutputFile="$(OutDir)\$(ProjectName).dll" 
    396396        LinkIncremental="1" 
    397397        ModuleDefinitionFile="NSCAAgent.def" 
     
    434434      ConfigurationType="2" 
    435435      InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 
    436       CharacterSet="2" 
     436      CharacterSet="1" 
    437437      > 
    438438      <Tool 
     
    473473      <Tool 
    474474        Name="VCLinkerTool" 
    475         AdditionalDependencies="Pdh.lib" 
    476         OutputFile="../../Dist/modules/$(ProjectName).dll" 
     475        AdditionalDependencies="ws2_32.lib" 
     476        OutputFile="$(OutDir)\$(ProjectName).dll" 
    477477        LinkIncremental="1" 
    478478        ModuleDefinitionFile="NSCAAgent.def" 
     
    511511    <Configuration 
    512512      Name="Nightly|Win32" 
    513       OutputDirectory="$(ConfigurationName)" 
    514       IntermediateDirectory="$(ConfigurationName)" 
     513      OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\modules" 
     514      IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" 
    515515      ConfigurationType="2" 
    516516      InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 
    517       CharacterSet="2" 
     517      CharacterSet="1" 
    518518      > 
    519519      <Tool 
     
    553553      <Tool 
    554554        Name="VCLinkerTool" 
    555         AdditionalDependencies="Pdh.lib" 
    556         OutputFile="../../Dist/modules/$(ProjectName).dll" 
     555        AdditionalDependencies="ws2_32.lib" 
     556        OutputFile="$(OutDir)\$(ProjectName).dll" 
    557557        LinkIncremental="1" 
    558558        ModuleDefinitionFile="NSCAAgent.def" 
    559         GenerateDebugInformation="true" 
     559        GenerateDebugInformation="false" 
    560560        SubSystem="2" 
    561561        OptimizeReferences="2" 
     
    591591    <Configuration 
    592592      Name="Nightly|x64" 
    593       OutputDirectory="$(PlatformName)\$(ConfigurationName)" 
     593      OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\modules" 
    594594      IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" 
    595595      ConfigurationType="2" 
    596596      InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 
    597       CharacterSet="2" 
     597      CharacterSet="1" 
    598598      > 
    599599      <Tool 
     
    634634      <Tool 
    635635        Name="VCLinkerTool" 
    636         AdditionalDependencies="Pdh.lib" 
    637         OutputFile="../../Dist/modules/$(ProjectName).dll" 
     636        AdditionalDependencies="ws2_32.lib" 
     637        OutputFile="$(OutDir)\$(ProjectName).dll" 
    638638        LinkIncremental="1" 
    639639        ModuleDefinitionFile="NSCAAgent.def" 
    640         GenerateDebugInformation="true" 
     640        GenerateDebugInformation="false" 
    641641        SubSystem="2" 
    642642        OptimizeReferences="2" 
     
    676676      ConfigurationType="2" 
    677677      InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 
    678       CharacterSet="2" 
     678      CharacterSet="1" 
    679679      > 
    680680      <Tool 
     
    717717      <Tool 
    718718        Name="VCLinkerTool" 
    719         AdditionalDependencies="Pdh.lib" 
    720         OutputFile="../../Debug/modules/$(ProjectName).dll" 
     719        AdditionalDependencies="ws2_32.lib" 
     720        OutputFile="$(OutDir)\$(ProjectName).dll" 
    721721        LinkIncremental="2" 
    722722        ModuleDefinitionFile="NSCAAgent.def" 
     
    758758      ConfigurationType="2" 
    759759      InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 
    760       CharacterSet="2" 
     760      CharacterSet="1" 
    761761      > 
    762762      <Tool 
     
    800800      <Tool 
    801801        Name="VCLinkerTool" 
    802         AdditionalDependencies="Pdh.lib" 
    803         OutputFile="../../Debug/modules/$(ProjectName).dll" 
     802        AdditionalDependencies="ws2_32.lib" 
     803        OutputFile="$(OutDir)\$(ProjectName).dll" 
    804804        LinkIncremental="2" 
    805805        ModuleDefinitionFile="NSCAAgent.def" 
     
    15431543        <FileConfiguration 
    15441544          Name="Debug|Win32" 
     1545          > 
     1546          <Tool 
     1547            Name="VCCLCompilerTool" 
     1548            UsePrecompiledHeader="0" 
     1549          /> 
     1550        </FileConfiguration> 
     1551        <FileConfiguration 
     1552          Name="Debug|x64" 
     1553          > 
     1554          <Tool 
     1555            Name="VCCLCompilerTool" 
     1556            UsePrecompiledHeader="0" 
     1557          /> 
     1558        </FileConfiguration> 
     1559        <FileConfiguration 
     1560          Name="Release|Win32" 
     1561          > 
     1562          <Tool 
     1563            Name="VCCLCompilerTool" 
     1564            UsePrecompiledHeader="0" 
     1565          /> 
     1566        </FileConfiguration> 
     1567        <FileConfiguration 
     1568          Name="Release|x64" 
     1569          > 
     1570          <Tool 
     1571            Name="VCCLCompilerTool" 
     1572            UsePrecompiledHeader="0" 
     1573          /> 
     1574        </FileConfiguration> 
     1575        <FileConfiguration 
     1576          Name="Distribution|Win32" 
     1577          > 
     1578          <Tool 
     1579            Name="VCCLCompilerTool" 
     1580            UsePrecompiledHeader="0" 
     1581          /> 
     1582        </FileConfiguration> 
     1583        <FileConfiguration 
     1584          Name="Distribution|x64" 
     1585          > 
     1586          <Tool 
     1587            Name="VCCLCompilerTool" 
     1588            UsePrecompiledHeader="0" 
     1589          /> 
     1590        </FileConfiguration> 
     1591        <FileConfiguration 
     1592          Name="Nightly|Win32" 
     1593          > 
     1594          <Tool 
     1595            Name="VCCLCompilerTool" 
     1596            UsePrecompiledHeader="0" 
     1597          /> 
     1598        </FileConfiguration> 
     1599        <FileConfiguration 
     1600          Name="Nightly|x64" 
     1601          > 
     1602          <Tool 
     1603            Name="VCCLCompilerTool" 
     1604            UsePrecompiledHeader="0" 
     1605          /> 
     1606        </FileConfiguration> 
     1607        <FileConfiguration 
     1608          Name="Debug-MemCheck|Win32" 
     1609          > 
     1610          <Tool 
     1611            Name="VCCLCompilerTool" 
     1612            UsePrecompiledHeader="0" 
     1613          /> 
     1614        </FileConfiguration> 
     1615        <FileConfiguration 
     1616          Name="Debug-MemCheck|x64" 
    15451617          > 
    15461618          <Tool 
Note: See TracChangeset for help on using the changeset viewer.