Changeset 367bf20 in nscp


Ignore:
Timestamp:
04/03/08 19:47:01 (5 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
9567d4b, eb30340
Parents:
b7ed6ac
Message:

2008-04-03 MickeM

  • Moved COM init to "core" (from WMI module) + Added new Check command: CheckTaskSched Use like so:

CheckTaskSched +filter-exit-code==1 ShowAll MaxWarn=1 MaxCrit=1

Files:
12 added
18 edited

Legend:

Unmodified
Added
Removed
  • AutoBuild.h

    rdd02c15 r367bf20  
    33// change the FALSE to TRUE for autoincrement of build number 
    44#define INCREMENT_VERSION TRUE 
    5 #define FILEVER        0,3,1,18 
    6 #define PRODUCTVER     0,3,1,18 
    7 #define STRFILEVER     _T("0.3.1.18") 
    8 #define STRPRODUCTVER  _T("0.3.1.18") 
    9 #define STRPRODUCTDATE  _T("2008-03-20") 
     5#define FILEVER        0,3,1,19 
     6#define PRODUCTVER     0,3,1,19 
     7#define STRFILEVER     _T("0.3.1.19") 
     8#define STRPRODUCTVER  _T("0.3.1.19") 
     9#define STRPRODUCTDATE  _T("2008-03-21") 
    1010#endif // AUTOBUILD_H 
  • NSClient++-2005.sln

    r6d3bbc1 r367bf20  
    175175  ProjectSection(ProjectDependencies) = postProject 
    176176    {2286162D-7571-4735-BAC8-4A8D33A4F42D} = {2286162D-7571-4735-BAC8-4A8D33A4F42D} 
     177  EndProjectSection 
     178EndProject 
     179Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LuaCom", "lib-source\LuaCom\LuaCom.vcproj", "{19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}" 
     180  ProjectSection(WebsiteProperties) = preProject 
     181    Debug.AspNetCompiler.Debug = "True" 
     182    Release.AspNetCompiler.Debug = "False" 
     183  EndProjectSection 
     184EndProject 
     185Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lua-modules", "lua-modules", "{45D4AD47-393C-4E67-9B68-FCA621CD3120}" 
     186  ProjectSection(WebsiteProperties) = preProject 
     187    Debug.AspNetCompiler.Debug = "True" 
     188    Release.AspNetCompiler.Debug = "False" 
     189  EndProjectSection 
     190EndProject 
     191Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CheckWMI", "modules\CheckTaskSched\CheckTaskSched-2005.vcproj", "{F3401E75-60FB-4A0E-A18C-6505587D5B1A}" 
     192  ProjectSection(WebsiteProperties) = preProject 
     193    Debug.AspNetCompiler.Debug = "True" 
     194    Release.AspNetCompiler.Debug = "False" 
    177195  EndProjectSection 
    178196EndProject 
     
    10211039    {D96F7075-F6CD-4921-B5D8-8488E2D24BDB}.Release|x64.ActiveCfg = Release|x64 
    10221040    {D96F7075-F6CD-4921-B5D8-8488E2D24BDB}.Release|x64.Build.0 = Release|x64 
     1041    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug|Any CPU.ActiveCfg = Debug|Win32 
     1042    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug|Itanium.ActiveCfg = Debug|Win32 
     1043    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 
     1044    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug|Mixed Platforms.Build.0 = Debug|Win32 
     1045    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug|Win32.ActiveCfg = Debug|Win32 
     1046    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug|Win32.Build.0 = Debug|Win32 
     1047    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug|x64.ActiveCfg = Debug|Win32 
     1048    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug-MemCheck|Any CPU.ActiveCfg = Debug|Win32 
     1049    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug-MemCheck|Itanium.ActiveCfg = Debug|Win32 
     1050    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug-MemCheck|Mixed Platforms.ActiveCfg = Debug|Win32 
     1051    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug-MemCheck|Mixed Platforms.Build.0 = Debug|Win32 
     1052    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug-MemCheck|Win32.ActiveCfg = Debug|Win32 
     1053    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug-MemCheck|Win32.Build.0 = Debug|Win32 
     1054    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Debug-MemCheck|x64.ActiveCfg = Debug|Win32 
     1055    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Distribution|Any CPU.ActiveCfg = Debug|Win32 
     1056    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Distribution|Itanium.ActiveCfg = Debug|Win32 
     1057    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Distribution|Mixed Platforms.ActiveCfg = Debug|Win32 
     1058    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Distribution|Mixed Platforms.Build.0 = Debug|Win32 
     1059    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Distribution|Win32.ActiveCfg = Debug|Win32 
     1060    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Distribution|Win32.Build.0 = Debug|Win32 
     1061    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Distribution|x64.ActiveCfg = Debug|Win32 
     1062    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Nightly|Any CPU.ActiveCfg = Release|Win32 
     1063    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Nightly|Itanium.ActiveCfg = Release|Win32 
     1064    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Nightly|Mixed Platforms.ActiveCfg = Release|Win32 
     1065    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Nightly|Mixed Platforms.Build.0 = Release|Win32 
     1066    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Nightly|Win32.ActiveCfg = Release|Win32 
     1067    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Nightly|Win32.Build.0 = Release|Win32 
     1068    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Nightly|x64.ActiveCfg = Release|Win32 
     1069    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Release|Any CPU.ActiveCfg = Release|Win32 
     1070    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Release|Itanium.ActiveCfg = Release|Win32 
     1071    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Release|Mixed Platforms.ActiveCfg = Release|Win32 
     1072    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Release|Mixed Platforms.Build.0 = Release|Win32 
     1073    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Release|Win32.ActiveCfg = Release|Win32 
     1074    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Release|Win32.Build.0 = Release|Win32 
     1075    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D}.Release|x64.ActiveCfg = Release|Win32 
     1076    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug|Any CPU.ActiveCfg = Debug|x64 
     1077    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug|Itanium.ActiveCfg = Debug|x64 
     1078    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 
     1079    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug|Mixed Platforms.Build.0 = Debug|x64 
     1080    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug|Win32.ActiveCfg = Debug|Win32 
     1081    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug|Win32.Build.0 = Debug|Win32 
     1082    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug|x64.ActiveCfg = Debug|x64 
     1083    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug|x64.Build.0 = Debug|x64 
     1084    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug-MemCheck|Any CPU.ActiveCfg = Debug-MemCheck|x64 
     1085    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug-MemCheck|Itanium.ActiveCfg = Debug-MemCheck|x64 
     1086    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug-MemCheck|Mixed Platforms.ActiveCfg = Debug-MemCheck|x64 
     1087    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug-MemCheck|Mixed Platforms.Build.0 = Debug-MemCheck|x64 
     1088    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug-MemCheck|Win32.ActiveCfg = Debug-MemCheck|Win32 
     1089    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug-MemCheck|Win32.Build.0 = Debug-MemCheck|Win32 
     1090    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug-MemCheck|x64.ActiveCfg = Debug-MemCheck|x64 
     1091    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Debug-MemCheck|x64.Build.0 = Debug-MemCheck|x64 
     1092    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Distribution|Any CPU.ActiveCfg = Distribution|x64 
     1093    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Distribution|Itanium.ActiveCfg = Distribution|x64 
     1094    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Distribution|Mixed Platforms.ActiveCfg = Distribution|x64 
     1095    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Distribution|Mixed Platforms.Build.0 = Distribution|x64 
     1096    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Distribution|Win32.ActiveCfg = Distribution|Win32 
     1097    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Distribution|Win32.Build.0 = Distribution|Win32 
     1098    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Distribution|x64.ActiveCfg = Distribution|x64 
     1099    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Distribution|x64.Build.0 = Distribution|x64 
     1100    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Nightly|Any CPU.ActiveCfg = Nightly|x64 
     1101    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Nightly|Itanium.ActiveCfg = Nightly|x64 
     1102    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Nightly|Mixed Platforms.ActiveCfg = Nightly|x64 
     1103    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Nightly|Mixed Platforms.Build.0 = Nightly|x64 
     1104    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Nightly|Win32.ActiveCfg = Nightly|Win32 
     1105    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Nightly|Win32.Build.0 = Nightly|Win32 
     1106    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Nightly|x64.ActiveCfg = Nightly|x64 
     1107    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Nightly|x64.Build.0 = Nightly|x64 
     1108    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Release|Any CPU.ActiveCfg = Release|x64 
     1109    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Release|Itanium.ActiveCfg = Release|x64 
     1110    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Release|Mixed Platforms.ActiveCfg = Release|x64 
     1111    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Release|Mixed Platforms.Build.0 = Release|x64 
     1112    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Release|Win32.ActiveCfg = Release|Win32 
     1113    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Release|Win32.Build.0 = Release|Win32 
     1114    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Release|x64.ActiveCfg = Release|x64 
     1115    {F3401E75-60FB-4A0E-A18C-6505587D5B1A}.Release|x64.Build.0 = Release|x64 
    10231116  EndGlobalSection 
    10241117  GlobalSection(SolutionProperties) = preSolution 
     
    10401133    {4241C6CF-EC01-4AD9-89B0-B75EBA8A5996} = {9757464B-C125-4307-A84A-F4181AE6A081} 
    10411134    {BBFF8362-C626-4838-B0A2-F695D638AD24} = {9757464B-C125-4307-A84A-F4181AE6A081} 
     1135    {F3401E75-60FB-4A0E-A18C-6505587D5B1A} = {9757464B-C125-4307-A84A-F4181AE6A081} 
    10421136    {0E2B21D9-F432-4127-8E92-7716B1072510} = {9A087442-7BB2-4CF0-9F58-5D1BC3C32CD2} 
    10431137    {A3CF4E23-1D1B-4D93-A16A-48C52D118560} = {9A087442-7BB2-4CF0-9F58-5D1BC3C32CD2} 
     
    10461140    {630857C0-6AD8-4CEE-B5F7-CA1DF620CA9A} = {C8DCE3D7-A802-4C5D-ABB1-B478F545B6E5} 
    10471141    {B6D08289-B8AE-4391-9D07-93B22618BE58} = {C8DCE3D7-A802-4C5D-ABB1-B478F545B6E5} 
     1142    {45D4AD47-393C-4E67-9B68-FCA621CD3120} = {C8DCE3D7-A802-4C5D-ABB1-B478F545B6E5} 
     1143    {19BF0AD8-0013-46C7-9E91-F60FE3B0A63D} = {45D4AD47-393C-4E67-9B68-FCA621CD3120} 
    10481144  EndGlobalSection 
    10491145  GlobalSection(DPCodeReviewSolutionGUID) = preSolution 
  • NSClient++-2005.vcproj

    r6d3bbc1 r367bf20  
    23652365      </File> 
    23662366      <File 
     2367        RelativePath=".\include\com_helpers.hpp" 
     2368        > 
     2369      </File> 
     2370      <File 
    23672371        RelativePath=".\include\config.h" 
     2372        > 
     2373      </File> 
     2374      <File 
     2375        RelativePath=".\include\error.hpp" 
    23682376        > 
    23692377      </File> 
  • NSClient++.cpp

    rd76af81 r367bf20  
    245245    simpleSocket::WSAStartup(); 
    246246  } catch (simpleSocket::SocketException e) { 
    247     LOG_ERROR_STD(_T("Uncaught exception: ") + e.getMessage()); 
     247    LOG_ERROR_STD(_T("Socket exception: ") + e.getMessage()); 
    248248    return false; 
    249249  } catch (...) { 
    250250    LOG_ERROR_STD(_T("Unknown exception iniating socket...")); 
     251    return false; 
     252  } 
     253 
     254  try { 
     255    com_helper_.initialize(); 
     256  } catch (com_helper::com_exception e) { 
     257    LOG_ERROR_STD(_T("COM exception: ") + e.getMessage()); 
     258    return false; 
     259  } catch (...) { 
     260    LOG_ERROR_STD(_T("Unknown exception iniating COM...")); 
    251261    return false; 
    252262  } 
     
    267277    } catch (SettingsException e) { 
    268278      NSC_LOG_ERROR_STD(_T("Failed to set settings file") + e.getMessage()); 
     279    } catch (...) { 
     280      LOG_ERROR_STD(_T("Unknown exception when loading settings")); 
     281      return false; 
    269282    } 
    270283    try { 
     
    285298    try { 
    286299      mainClient.unloadPlugins(); 
    287     } catch(NSPluginException &e) { 
     300    } catch(NSPluginException e) { 
    288301      std::wcout << _T("Exception raised: ") << e.error_ << _T(" in module: ") << e.file_ << std::endl;; 
    289     } 
     302    } catch(...) { 
     303      std::wcout << _T("UNknown exception raised: ") << std::endl;; 
     304    } 
     305  } 
     306  try { 
     307    com_helper_.unInitialize(); 
     308  } catch (com_helper::com_exception e) { 
     309    LOG_ERROR_STD(_T("COM exception: ") + e.getMessage()); 
     310  } catch (...) { 
     311    LOG_ERROR_STD(_T("Unknown exception uniniating COM...")); 
    290312  } 
    291313  try { 
    292314    simpleSocket::WSACleanup(); 
    293315  } catch (simpleSocket::SocketException e) { 
    294     LOG_ERROR_STD(_T("Uncaught exception: ") + e.getMessage()); 
     316    LOG_ERROR_STD(_T("Socket exception: ") + e.getMessage()); 
     317  } catch (...) { 
     318    LOG_ERROR_STD(_T("Unknown exception uniniating socket...")); 
    295319  } 
    296320  Settings::destroyInstance(); 
  • NSClient++.h

    r2f01f93 r367bf20  
    2929#include <MutexRW.h> 
    3030#include <map> 
     31#include <com_helpers.hpp> 
    3132 
    3233 
     
    7374  log_status debug_; 
    7475  bool boot_; 
     76  com_helper::initialize_com com_helper_; 
    7577 
    7678public: 
  • StdAfx.h

    rb0ae738 r367bf20  
    1919*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             * 
    2020***************************************************************************/ 
    21 #if !defined(AFX_STDAFX_H__6B96F953_C431_11D3_BCD2_00A0D21A1A22__INCLUDED_) 
    22 #define AFX_STDAFX_H__6B96F953_C431_11D3_BCD2_00A0D21A1A22__INCLUDED_ 
    23  
    24 #if _MSC_VER > 1000 
    2521#pragma once 
    26 #endif // _MSC_VER > 1000 
    2722 
    2823#define _WINSOCKAPI_ 
    2924//#include <WinSock2.h> 
    3025 
     26#define _WIN32_DCOM 
     27#include <objbase.h> 
     28 
    3129#define VC_EXTRALEAN    // Exclude rarely-used stuff from Windows headers 
    3230#include <windows.h> 
     31 
    3332 
    3433#define COMPILE_NEWAPIS_STUBS 
     
    5150#include <vld.h> 
    5251#endif 
    53  
    54  
    55 #endif // !defined(AFX_STDAFX_H__6B96F953_C431_11D3_BCD2_00A0D21A1A22__INCLUDED_) 
  • changelog

    rb7ed6ac r367bf20  
    66 * "The message is blocked by User Interface Privilege Isolation, Administrative applications that need to see it can allow it through by calling ChangeWindowMessageFilter after making sure the necessary security precautions are in place. " 
    77 
    8 2008-03-21 
     82008-04-03 MickeM 
     9 * Moved COM init to "core" (from WMI module) 
     10 + Added new Check command: CheckTaskSched Use like so: 
     11     CheckTaskSched +filter-exit-code==1 ShowAll MaxWarn=1 MaxCrit=1 
     12 
     132008-03-21 MickeM 
    914 + Added command line support for process checks 
    1015   New option: cmdLine will toggle so full command lines are used instead of just process names. 
     
    1520   This is *NOT* case blind so might be hard to use, plan to add case blindness to it in the future. 
    1621 : Sample command: check_nt ... -v PROCSTATE -l cmdLine,match=regexp,.*exp.* -d SHOWALL 
    17  * Ohh yeah... it is 2008 this year... not 2007, fixed a few entries in the changelog :) 
    18  - BREAKING CHANGE! -- Removed TOOLHELPER API as PSAPI is simpler and toolhel is really only usefull on w9x (which I dont oficcaly support) 
    19  
    20 2008-03-20 
     22 * Ohh yeah... it is 2008 this year... not 2007, fixed a few entries in the :) 
     23 - BREAKING CHANGE! -- Removed TOOLHELPER API as PSAPI is simpler and toolhelp is really only useful on w9x (which I don't officially support) 
     24 
     252008-03-20 MickeM 
    2126 + Added host-lookupos for NSCA server (#149) 
    2227 + Added option (cache_hostname=1|0) to cache the NSCA host name (Ie. only lookup once) 
     
    2530   Added option debug_skip_data_collection to simulate this (just for kicks) 
    2631 
    27 2008-03-18 
    28  * Added some more error mesages to the NSCA module 
    29  * Added support for srguments to LUA module. 
     322008-03-18 MickeM 
     33 * Added some more error messages to the NSCA module 
     34 * Added support for arguments to LUA module. 
    3035   syntax: function debug (command, args) -- args is a table with all arguments 
    3136 
     
    3439 
    35402008-03-08 MickeM 
    36  * Changed so log is now in unicode format 
     41 * Changed so log is now in Unicode format 
    3742   Hopefully this will make it simpler to diagnose PDH issues in "strange locales". 
    3843   If anyone hates this let me know and I will add an option to use "old ansi log". 
    39  * Fixed so the console is logged as ANSI (properly) and all unicodes are discarded. 
    40    This means "strangness" in unicode and non-us-ascii chars on the console, 
    41     so for details refer to the log-file which is proper unicode. 
     44 * Fixed so the console is logged as ANSI (properly) and all Unicode's are discarded. 
     45   This means "strangeness" in Unicode and non-us-ascii chars on the console, 
     46    so for details refer to the log-file which is proper Unicode. 
    4247 + Since log module is loaded "after" the client has booted I added a "hello" message that prints the current version 
    4348    (if you find this annoying let me know, I will make it optional :) 
     
    4853 
    49542008-03-05 MickeM 
    50  + Added debug to new section [Eventlog], when enabled it will (log) wat lines matched what, this is a pretty big performance overhead so dont run with this one. 
     55 + Added debug to new section [Eventlog], when enabled it will (log) what lines matched what, this is a pretty big performance overhead so don't run with this one. 
    5156 + Added syntax to new section [Eventlog] used as a shorthand for the syntax to use as "default" (when no syntax=... option is given) 
    5257 * Fixed an issue with eventlog and . matching. 
     
    5459 + Added <> (same as ! and !=) as NRPE breaks the use of ! (in "all" numeric filters (eventlog)) 
    5560   Try using: filter-eventType=<>warning to remove everything that is not a warning 
    56  * Fixed two spelling misstakes in the SysTray module. 
     61 * Fixed two spelling mistakes in the SysTray module. 
    5762 * Fixed 64-bit issues with installer 
    5863 * Fixed so installer uninstalls/installs the service 
  • include/config.h

    rdd02c15 r367bf20  
    188188#define C_SYSTEM_SVC_ALL_4_DEFAULT _T("stopped") 
    189189 
     190#define C_TASKSCHED_SECTION _T("Task Scheduler") 
     191#define C_TASKSCHED_SYNTAX _T("syntax") 
     192#define C_TASKSCHED_SYNTAX_DEFAULT _T("%title% last run: %most-recent-run-time% (%exit-code%)") 
     193 
    190194// Log to File Settings 
    191195#define LOG_SECTION_TITLE _T("log") 
  • include/filter_framework.hpp

    rb7ed6ac r367bf20  
    191191    std::wstring value_; 
    192192    filter_one() : hasFilter_(false) {} 
    193     filter_one(const filter_one &other) : hasFilter_(other.hasFilter_), filter(other.filter) { 
     193    filter_one(const filter_one &other) : hasFilter_(other.hasFilter_), filter(other.filter), value_(other.value_) { 
    194194    } 
    195195 
     
    262262      } else if (t.first == _T("regexp")) { 
    263263        regexp = t.second; 
     264#else 
     265      } else if (t.first == _T("regexp")) { 
     266        throw parse_exception(_T("Regular expression support not enabled!") + value); 
    264267#endif 
    265268      } else { 
     
    267270      } 
    268271      return *this; 
     272    } 
     273    std::wstring to_string() const { 
     274      if (sub.hasFilter()) 
     275        return _T("substring: '") + sub.getValue() + _T("'"); 
     276#ifndef NO_BOOST_DEP 
     277      if (regexp.hasFilter()) 
     278        return _T("regexp: '") + regexp.getValue() + _T("'"); 
     279#endif 
     280      if (exact.hasFilter()) 
     281        return _T("exact: '") + exact.getValue() + _T("'"); 
     282      return _T("MISSING VALUE"); 
    269283    } 
    270284  }; 
     
    325339      return *this; 
    326340    } 
     341#define NSCP_FF_DEBUG_NUM(key) if (key.hasFilter()) return _T( # key ) + key.value_; 
     342    std::wstring to_string() const { 
     343      NSCP_FF_DEBUG_NUM(max); 
     344      NSCP_FF_DEBUG_NUM(min); 
     345      NSCP_FF_DEBUG_NUM(eq); 
     346      NSCP_FF_DEBUG_NUM(neq); 
     347      //NSCP_FF_DEBUG_NUM(inList); 
     348      return _T(" MISSING! "); 
     349    } 
    327350    std::wstring getValue() const { 
    328351      return value_; 
     
    355378    } 
    356379 
    357     bool hasFilter() { 
     380    bool hasFilter() const { 
    358381      return !chain.empty(); 
    359382    } 
    360     bool get_inital_state() { 
     383    bool get_inital_state() const { 
    361384      return filterAll; 
    362385    } 
     
    381404      return matched; 
    382405    } 
     406    std::wstring mode_2_string(filter_mode mode) const { 
     407      if (mode == plus) 
     408        return _T("+"); 
     409      if (mode == minus) 
     410        return _T("-"); 
     411      if (mode == normal) 
     412        return _T("."); 
     413      return _T("?"); 
     414    } 
     415    std::wstring debug() const { 
     416      std::wstringstream ss; 
     417      ss << _T("Initial state: ") << get_inital_state() << std::endl; 
     418      ss << _T("filters: ") << std::endl; 
     419      for (filterlist_type::const_iterator cit = chain.begin(); cit != chain.end(); ++cit ) 
     420        ss << _T("  ") << mode_2_string((*cit).first) << _T(": ") << (*cit).second.to_string() << std::endl; 
     421      return ss.str(); 
     422    } 
    383423 
    384424  }; 
  • include/strEx.h

    r2f01f93 r367bf20  
    164164    return buf; 
    165165  } 
    166   inline std::wstring format_date(SYSTEMTIME &time, std::wstring format = _T("%Y-%m-%d %H:%M:%S")) { 
     166  inline std::wstring format_date(const SYSTEMTIME &time, std::wstring format = _T("%Y-%m-%d %H:%M:%S")) { 
    167167    TCHAR buf[51]; 
    168168 
     
    187187  static const __int64 SECS_BETWEEN_EPOCHS = 11644473600; 
    188188  static const __int64 SECS_TO_100NS = 10000000; 
    189   inline std::wstring format_filetime(unsigned long long filetime, std::wstring format) { 
     189  inline std::wstring format_filetime(unsigned long long filetime, std::wstring format = _T("%Y-%m-%d %H:%M:%S")) { 
    190190    filetime -= (SECS_BETWEEN_EPOCHS * SECS_TO_100NS); 
    191191    filetime /= SECS_TO_100NS; 
     
    292292    strEx::replace(format, key, _T("0")); 
    293293 
    294   inline std::wstring format_time_delta(std::wstring format, struct tm *mtm) { 
     294  inline std::wstring format_time_delta(struct tm *mtm, std::wstring format = _T("%Y years %m months %d days %H hours %M minutes")) { 
    295295    // "Date: %Y-%m-%d %H:%M:%S" 
    296296    MK_FORMAT_FTD(70, _T("%Y"), mtm->tm_year); 
  • modules/CheckDisk/CheckDisk.cpp

    r6b690bf r367bf20  
    503503  unsigned long long now = ((now_.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)now_.dwLowDateTime); 
    504504  time_t value = (now-finder.info.ullLastWriteTime)/10000000; 
    505   message = strEx::itos(value/60) + _T("&") + strEx::format_time_delta(format, gmtime(&value)); 
     505  message = strEx::itos(value/60) + _T("&") + strEx::format_time_delta(gmtime(&value), format); 
    506506  return NSCAPI::returnOK; 
    507507} 
  • modules/CheckEventLog/CheckEventLog-2005.vcproj

    r8c7d67f r367bf20  
    211211        Optimization="0" 
    212212        AdditionalIncludeDirectories="../include;../../include" 
    213         PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;NO_BOOST_DEP" 
     213        PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" 
    214214        MinimalRebuild="true" 
    215215        BasicRuntimeChecks="3" 
  • modules/CheckWMI/CheckWMI.cpp

    r6b690bf r367bf20  
    5151    NSC_LOG_ERROR_STD(_T("Failed to register command.")); 
    5252  } 
    53   return wmiQuery.initialize(); 
     53  return true; 
    5454} 
    5555bool CheckWMI::unloadModule() { 
    56   wmiQuery.unInitialize(); 
    5756  return true; 
    5857} 
     
    123122  WMIQuery::result_type rows; 
    124123  try { 
     124    WMIQuery wmiQuery; 
    125125    rows = wmiQuery.execute(query); 
    126126  } catch (WMIException e) { 
     
    191191  WMIQuery::result_type rows; 
    192192  try { 
     193    WMIQuery wmiQuery; 
    193194    rows = wmiQuery.execute(query); 
    194195  } catch (WMIException e) { 
     
    260261  WMIQuery::result_type rows; 
    261262  try { 
     263    WMIQuery wmiQuery; 
    262264    rows = wmiQuery.execute(query); 
    263265  } catch (WMIException e) { 
  • modules/CheckWMI/CheckWMI.h

    r99e4d8f r367bf20  
    2929 
    3030class CheckWMI { 
    31 private: 
    32   WMIQuery wmiQuery; 
    33  
    3431public: 
    3532  CheckWMI(); 
  • modules/CheckWMI/WMIQuery.cpp

    r99e4d8f r367bf20  
    2626#include <map> 
    2727 
    28 WMIQuery::WMIQuery(void) : bInitialized(false) 
    29 { 
    30 } 
    31  
    32 WMIQuery::~WMIQuery(void) 
    33 { 
    34   if (bInitialized) 
    35     unInitialize(); 
    36 } 
    37  
    38  
    39 bool WMIQuery::initialize() 
    40 { 
    41   HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED); 
    42   if (FAILED(hRes)) { 
    43     NSC_LOG_ERROR_STD(_T("CoInitialize failed: ") + error::format::from_system(hRes)); 
    44     return false; 
    45   } 
    46   bInitialized = true; 
    47   hRes = CoInitializeSecurity(NULL,-1,NULL,NULL,RPC_C_AUTHN_LEVEL_PKT,RPC_C_IMP_LEVEL_IMPERSONATE,NULL,EOAC_NONE,NULL); 
    48   if (FAILED(hRes)) { 
    49     NSC_LOG_ERROR_STD(_T("CoInitializeSecurity failed: ") + error::format::from_system(hRes)); 
    50     return false; 
    51   } 
    52   return true; 
    53 } 
    54 void WMIQuery::unInitialize() 
    55 { 
    56   CoUninitialize(); 
    57   bInitialized = false; 
    58 } 
    59  
    6028std::wstring WMIQuery::sanitize_string(LPTSTR in) { 
    6129  TCHAR *p = in; 
     
    7038WMIQuery::result_type WMIQuery::execute(std::wstring query) 
    7139{ 
    72   if (!bInitialized) { 
    73     initialize(); 
    74   } 
    7540  result_type ret; 
    7641 
  • modules/CheckWMI/WMIQuery.h

    r99e4d8f r367bf20  
    6161class WMIQuery 
    6262{ 
    63 private: 
    64   bool bInitialized; 
    65  
    6663public: 
    6764  struct WMIResult { 
     
    147144    } 
    148145  }; 
    149   WMIQuery(void); 
    150   ~WMIQuery(void); 
     146  WMIQuery(void) {}; 
     147  ~WMIQuery(void) {}; 
    151148 
    152149  result_type  execute(std::wstring query); 
    153150  std::wstring sanitize_string(LPTSTR in); 
    154  
    155   bool initialize(); 
    156   void unInitialize(); 
    157151}; 
  • modules/LUAScript/script_wrapper.hpp

    rb7ed6ac r367bf20  
    5757  } 
    5858  std::wstring extract_string(lua_State *L) { 
    59     return strEx::string_to_wstring(lua_tostring( L, lua_gettop( L ) )); 
     59    int top = lua_gettop(L); 
     60    if (lua_isstring(L, top)) 
     61      return strEx::string_to_wstring(lua_tostring( L, lua_gettop( L ) )); 
     62    return _T("<NOT_A_STRING>"); 
    6063  } 
    6164  std::wstring pop_string(lua_State *L) { 
    62     std::wstring ret = strEx::string_to_wstring(lua_tostring( L, lua_gettop( L ) )); 
     65    std::wstring ret; 
     66    int top = lua_gettop(L); 
     67    if (lua_isstring(L, top)) 
     68      ret = strEx::string_to_wstring(lua_tostring( L, top)); 
     69    else if (lua_isnil(L, top)) 
     70      ret = _T("<NIL>"); 
     71    else if (lua_istable(L, top)) 
     72      ret = _T("<TABLE>"); 
     73    else if (lua_isnumber(L, top)) 
     74      ret = _T("<NUMBER>"); 
     75    else if (lua_iscfunction(L, top)) 
     76      ret = _T("<C-FUNCTION>"); 
     77    else 
     78      ret = _T("<UNKNOWN>"); 
    6379    lua_pop(L, 1); 
    6480    return ret; 
  • scripts/test.lua

    r8b206ee r367bf20  
     1--require("luacom") 
     2--require("luacom") 
     3--require("luacom-lua5-13") 
    14 
    2 print('Loading test script...') 
     5nscp.print('Loading test script...') 
     6-- win = loadlib("win32.dll","luaopen_w32") 
     7-- print(win) -- nil 
     8require( 'w32' ) 
     9nscp.print(w32) 
     10nscp.print(w32.FindWindow) 
    311 
    4 register_command('check_something', 'something') 
     12nscp.execute('version') 
     13v = nscp.getSetting('NSCA Agent', 'interval', 'broken') 
     14nscp.print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') 
     15nscp.print('value: ' .. v) 
     16nscp.print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') 
     17 
     18nscp.register('check_something', 'something') 
     19nscp.register('lua_debug', 'debug') 
     20nscp.register('foo', 'something') 
    521 
    622function something (command) 
    7   print(command) 
    8   code, msg, perf = inject('CheckCPU','time=5','MaxCrit=5') 
     23  nscp.print(command) 
     24  --code, msg, perf = inject('CheckCPU','time=5','MaxCrit=5') 
     25  msg = 'hello' 
     26  perf = 'hello' 
     27  code = 'ok' 
    928  print(code .. ': ' .. msg .. ', ' .. perf) 
     29  collectgarbage () 
     30 
    1031  return code, 'hello from LUA: ' .. msg, perf 
    1132end 
     33 
     34 
     35function debug (command, args) 
     36    table.foreachi(args, print) 
     37    print ('Command was: ' .. command) 
     38    return 'ok', 'hello' 
     39end 
Note: See TracChangeset for help on using the changeset viewer.