Changeset c391984 in nscp


Ignore:
Timestamp:
04/03/11 23:05:52 (2 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
b7d17f8
Parents:
2d69ab6
Message:

0.4.x:

  • tweaks to the build environment to make the installer work
  • fixed Unicode issue
  • fixed performance data
  • improved so alias doesn't re-process the data so much
Files:
3 added
24 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r197b263 rc391984  
    390390 
    391391ADD_SUBDIRECTORY("scripts") 
     392ADD_SUBDIRECTORY("files") 
     393ADD_SUBDIRECTORY("docs") 
    392394 
    393395LOAD_SECTIONS(ALL_MODULE_NAMES "modules/*/module.cmake" "Modules") 
  • files/old-settings.map

    r569a179 rc391984  
    3434log/file=/settings/log/file 
    3535log/date_mask=/settings/log/date mask 
     36log/debug=/settings/log/level 
    3637# log/debug 
    3738# log/root_folder 
     
    4849NRPE/command_timeout=/settings/NRPE/server/command timeout 
    4950NRPE/allow_arguments=/settings/NRPE/server/allow arguments 
    50 NRPE/allow_nasty_meta_chars=/settings/NRPE/server/allow nasty meta chars 
     51NRPE/allow_nasty_meta_chars=/settings/NRPE/server/allow nasty characters 
    5152NRPE/use_ssl=/settings/NRPE/server/ssl 
    5253# NRPE/script_dir 
     
    6263External Script/command_timeout=/settings/external scripts/command timeout 
    6364External Script/allow_arguments=/settings/external scripts/allow arguments 
    64 External Script/allow_nasty_meta_chars=/settings/external scripts/allow_nasty_meta_chars 
     65External Script/allow_nasty_meta_chars=/settings/external scripts/allow nasty characters 
    6566External Script/script_dir=/settings/external scripts/script folder 
    6667 
  • helpers/installers/installer/Product.wxs

    r2d69ab6 rc391984  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<Wix xmlns="http://schemas.microsoft.com/wix/2003/01/wi"> 
    3   <!-- 
    4   <?define boost = "false" ?> 
    5    --> 
    6   <?ifdef var.boost ?> 
    7     <?define PlatForm = "$(var.arch)" ?> 
    8     <?define Mode = "Nightly" ?> 
    9     <?define SysTray.ConfigurationName = "BOOST BUILD" ?> 
    10   <?else?> 
    11     <?if "$(var.SysTray.ConfigurationName)" = "Debug|Win32"?> 
    12       <?define PlatForm = "Win32" ?> 
    13       <?define Mode = "Debug" ?> 
    14     <?elseif "$(var.SysTray.ConfigurationName)" = "Debug|x64"?> 
    15       <?define PlatForm = "x64" ?> 
    16       <?define Mode = "Debug" ?> 
    17     <?elseif "$(var.SysTray.ConfigurationName)" = "Nightly|Win32"?> 
    18       <?define PlatForm = "Win32" ?> 
    19       <?define Mode = "Nightly" ?> 
    20     <?elseif "$(var.SysTray.ConfigurationName)" = "Nightly|x64"?> 
    21       <?define PlatForm = "x64" ?> 
    22       <?define Mode = "Nightly" ?> 
    23     <?else?> 
    24       <?define PlatForm = "Unknown: plattform" ?> 
    25     <?endif?> 
    26   <?endif?> 
     3  <?define PlatForm = "$(var.arch)" ?> 
     4  <?define Mode = "Nightly" ?> 
     5  <?define SysTray.ConfigurationName = "BOOST BUILD" ?> 
    276 
    287  <?if "$(var.PlatForm)" = "x64"?> 
     
    4625    <?define Source = "../../$(var.PlatForm)/$(var.Mode)/" ?> 
    4726  <?endif?> 
    48   <!-- 
    49   <?ifndef var.Helpers ?> 
    50     <?define Helpers = "../../$(var.PlatForm)/$(var.Mode)-helpers/" ?> 
    51   <?endif?> 
    52      --> 
    5327 
    5428  <?define Version.String = "$(var.Version.Major).$(var.Version.Minor).$(var.Version.Revision).$(var.Version.Build)" ?> 
     
    10579              <!-- 
    10680              <File Id="NSClientINI" Name="NSC.ini" LongName="NSC.ini" DiskId="1" Source="$(var.Path.ini)/NSC.ini" Vital="yes"/> 
    107               <?ifdef var.boost ?> 
    108                 <File Id="Changelog" Name="change.log" LongName="changelog.txt" DiskId="1" Source="$(var.Source)/changelog.txt" Vital="no"/> 
    109               <?else?> 
    110                 <File Id="Changelog" Name="change.log" LongName="changelog.txt" DiskId="1" Source="$(var.Source)/changelog" Vital="no"/> 
    111               <?endif?> 
     81              --> 
     82              <File Id="Changelog" Name="change.log" LongName="changelog.txt" DiskId="1" Source="$(var.Source)/changelog" Vital="no"/> 
    11283              <File Id="Counters" Name="counters.def" LongName="counters.defs" DiskId="1" Source="$(var.Source)/counters.defs" Vital="no"/> 
    11384              <File Id="License" Name="license.txt" LongName="license.txt" DiskId="1" Source="$(var.Source)/license.txt" Vital="no"/> 
    114               --> 
     85               
    11586              <RemoveFile Id="LogFile1" Name="nsclient.log" On="uninstall" /> 
    11687              <RemoveFile Id="LogFile2" Name="nsc.log" On="uninstall" /> 
     
    12192            <Component Id="ServiceRegistration" Guid="F6636DB0-A0B9-4dA2-B74C-$(var.Postfix.GUID)" Win64="$(var.Win64)" /> 
    12293            <Component Id="Documentation" Guid="9B490E67-5472-4267-889C-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 
    123               <!-- 
    124               <File Id="doc.usage.nagios" Name="nagios.pdf" LongName="Nagios Usage Guide.pdf" DiskId="1" Source="$(var.Source)/Nagios Usage Guide.pdf" Vital="no" > 
     94              <File Id="doc.usage.nagios" Name="nagios.pdf" LongName="Nagios Usage Guide.pdf" DiskId="1" Source="$(var.Source)/docs/Nagios Usage Guide.pdf" Vital="no" > 
    12595                <Shortcut Id="Startmenu.doc.nagios" Directory="ProgramMenuDir" Name="nagios" 
    12696                          LongName="Nagios Usage Guide" WorkingDirectory="INSTALLDIR" Description="Nagios Usage Guide"/> 
    12797              </File> 
    128               <File Id="doc.reference" Name="nsclient.pdf" LongName="NSClient++ Reference Manual.pdf" DiskId="1" Source="$(var.Source)/NSClient++ Reference Manual.pdf" Vital="no" > 
     98              <File Id="doc.reference" Name="nsclient.pdf" LongName="NSClient++ Reference Manual.pdf" DiskId="1" Source="$(var.Source)/docs/NSClient++ Reference Manual.pdf" Vital="no" > 
    12999                <Shortcut Id="Startmenu.doc.ref" Directory="ProgramMenuDir" Name="refman" 
    130100                          LongName="NSClient++ Reference Manual" WorkingDirectory="INSTALLDIR" Description="NSClient++ Reference Manual"/> 
    131101              </File> 
    132               --> 
    133102            </Component> 
     103            <Directory Id="INSTALLLOCATION_SECURITY" Name="security"> 
     104              <Component Id="NRPEServerCert" Guid="5A0246F8-5167-45db-2E46-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 
     105                <File Id="NRPECert" Name="nrpe_dh.pem" LongName="nrpe_dh_512.pem" DiskId="1" Source="$(var.Source)/security/nrpe_dh_512.pem" Vital="no"/> 
     106              </Component> 
     107            </Directory> 
    134108            <Directory Id="INSTALLLOCATION_MODS" Name="modules"> 
    135               <Component Id="NRPEListener" Guid="5A0246F8-5167-45db-B246-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 
    136                            <!-- 
    137                 <File Id="NRPEListenerDLL" Name="NRPELsnr.dll" LongName="NRPEListener.dll" DiskId="1" Source="$(var.Source)/modules/NRPEListener.dll" Vital="no" /> 
     109              <Component Id="NRPEServer" Guid="5A0246F8-5167-45db-B246-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 
     110                <File Id="NRPEListenerDLL" Name="NRPELsnr.dll" LongName="NRPEListener.dll" DiskId="1" Source="$(var.Source)/modules/NRPEServer.dll" Vital="no" /> 
    138111                <File Id="NRPEClientDLL" Name="NRPEClnt.dll" LongName="NRPEClient.dll" DiskId="1" Source="$(var.Source)/modules/NRPEClient.dll" Vital="no" /> 
    139                             --> 
    140112              </Component> 
    141113              <Component Id="NSCListener" Guid="6DAF8BB9-9A56-48f5-B2C5-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 
    142                            <!-- 
    143                 <File Id="NSCListenerDLL" Name="NSCLsnr.dll" LongName="NSClientListener.dll" DiskId="1" Source="$(var.Source)/modules/NSClientListener.dll" Vital="no" /> 
    144                             --> 
     114                <File Id="NSCListenerDLL" Name="NSCLsnr.dll" LongName="NSClientListener.dll" DiskId="1" Source="$(var.Source)/modules/NSClientServer.dll" Vital="no" /> 
    145115              </Component> 
    146116              <Component Id="NSCA" Guid="8820A304-C596-4393-A72F-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 
    147                            <!-- 
    148117                <File Id="NSCAAgentDLL" Name="NSCAAgnt.dll" LongName="NSCAAgent.dll" DiskId="1" Source="$(var.Source)/modules/NSCAAgent.dll" Vital="no" /> 
    149                             --> 
     118                <File Id="SchedulerDLL" Name="Sched.dll" LongName="Scheduler.dll" DiskId="1" Source="$(var.Source)/modules/Scheduler.dll" Vital="no" /> 
    150119              </Component> 
    151120              <Component Id="Plugins" Guid="9B490E67-5472-4266-96DC-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 
     
    160129                <File Id="ModFileLogger.dll" Name="Logger.dll" LongName="FileLogger.dll" DiskId="1" Source="$(var.Source)/modules/FileLogger.dll" Vital="no" /> 
    161130                <File Id="ModLUAScript.dll" Name="LUAScr.dll" LongName="LUAScript.dll" DiskId="1" Source="$(var.Source)/modules/LUAScript.dll" Vital="no" /> 
     131                <File Id="ModCheckNSCP.dll" Name="CNSCP.dll" LongName="CheckNSCP.dll" DiskId="1" Source="$(var.Source)/modules/CheckNSCP.dll" Vital="no" /> 
    162132                <!-- 
    163133                <File Id="ModRemoteConfiguration.dll" Name="RmtCfg.dll" LongName="RemoteConfiguration.dll" DiskId="1" Source="$(var.Source)/modules/RemoteConfiguration.dll" Vital="no" /> 
     
    167137                <File Id="ModCheckTaskSched.dll" Name="TaskSch.dll" LongName="CheckTaskSched.dll" DiskId="1" Source="$(var.Source)/modules/CheckTaskSched.dll" Vital="no" /> 
    168138                <File Id="ModCheckTaskSched2.dll" Name="TaskSch2.dll" LongName="CheckTaskSched2.dll" DiskId="1" Source="$(var.Source)/modules/CheckTaskSched2.dll" Vital="no" /> 
    169                 <File Id="ModCheckNSCP.dll" Name="CNSCP.dll" LongName="CheckNSCP.dll" DiskId="1" Source="$(var.Source)/modules/CheckNSCP.dll" Vital="no" /> 
    170139              </Component> 
    171140            </Directory> 
    172141            <Directory Id="INSTALLLOCATION_SCRIPTS" Name="scripts"> 
    173142              <Component Id="Scripts" Guid="9B490E67-5472-4268-96DF-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 
    174           <!-- 
    175143                <File Id="script001" Name="c_60s.bat" LongName="check_60s.bat" DiskId="1" Source="$(var.Source)/scripts/check_60s.bat" Vital="no" /> 
    176144                <File Id="script002" Name="c_btry.vbs" LongName="check_battery.vbs" DiskId="1" Source="$(var.Source)/scripts/check_battery.vbs" Vital="no" /> 
     
    182150                <File Id="sample002" Name="c_test.ps1" LongName="check_test.ps1" DiskId="1" Source="$(var.Source)/scripts/check_test.ps1" Vital="no" /> 
    183151                <File Id="sample003" Name="c_test.vbs" LongName="check_test.vbs" DiskId="1" Source="$(var.Source)/scripts/check_test.vbs" Vital="no" /> 
     152          <!-- 
    184153                <File Id="lua001" Name="test.lua" LongName="test.lua" DiskId="1" Source="$(var.Source)/scripts/test.lua" Vital="no" /> 
    185154        --> 
     
    187156              <Directory Id="INSTALLLOCATION_SCRIPTS_LIB" Name="lib"> 
    188157                <Component Id="ScriptLibs" Guid="9B490E67-5472-4267-96DF-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 
    189           <!-- 
    190158                  <File Id="lib001" Name="nagplug.vbs" LongName="NagiosPlugins.vbs" DiskId="1" Source="$(var.Source)/scripts/lib/NagiosPlugins.vbs" Vital="no" /> 
    191159                  <File Id="lib002" Name="wrapper.vbs" LongName="wrapper.vbs" DiskId="1" Source="$(var.Source)/scripts/lib/wrapper.vbs" Vital="no" /> 
    192           --> 
    193160                </Component> 
    194161              </Directory> 
     
    223190        </Feature> 
    224191        <Feature Id="NRPEPlugins" Title="NRPE Support" Description="NRPE Listener Plugin. Support for the more vercitile NRPE protocol (check_nrpe)" Level="1" Absent="disallow"> 
    225           <ComponentRef Id="NRPEListener" /> 
     192          <ComponentRef Id="NRPEServer" /> 
     193          <ComponentRef Id="NRPEServerCert" /> 
    226194        </Feature> 
    227195        <Feature Id="NSCPlugins" Title="NSClient support" Description="NSClient Listener Plugin. Support for the old NSClient protocol (check_nt)" Level="1" Absent="disallow"> 
     
    274242      <Row> 
    275243        <Data Column="Id">SVC</Data> 
    276         <Data Column="ShortName">NSClientpp</Data> 
     244        <Data Column="ShortName">nscp</Data> 
    277245        <Data Column="LongName">$(var.App.Title) ($(var.PlatForm))</Data> 
    278246        <Data Column="Description">Monitoring agent for nagios (and others) used to respond to status queries.</Data> 
    279247        <Data Column="Component_">ServiceRegistration</Data> 
    280         <Data Column="Program">[#NSClientEXE]</Data> 
     248        <Data Column="Program">[#NSClientEXE] --service --run --name nscp</Data> 
    281249        <Data Column="Dependencies"></Data> 
    282250      </Row> 
  • include/config.h.in

    r1f24a1c rc391984  
    3333#endif 
    3434 
    35 #define SZAPPNAME WSTR("NSClient++") 
     35#define APPLICATION_NAME WSTR("NSClient++") 
    3636 
    3737// Version 
     
    4040//#define SZBETATAG " BETA " 
    4141#define _SZVERSION WSTR(STRPRODUCTVER) WSTR(SZBETATAG) WSTR(STRPRODUCTDATE) 
    42 #define SZVERSION _SZVERSION 
     42#define CURRENT_SERVICE_VERSION _SZVERSION 
    4343//STRPRODUCTVER SZBETATAG STRPRODUCTDATE 
    4444//FILEVER[0] 
     
    5555 
    5656// internal name of the service 
    57 #define SZSERVICENAME        WSTR("NSClientpp") 
     57#define DEFAULT_SERVICE_NAME        WSTR("NSClientpp") 
    5858 
    5959// Description of service 
    60 #define SZSERVICEDESCRIPTION WSTR("Nagios Windows Agent (Provides performance data for Nagios server)") 
     60#define DEFAULT_SERVICE_DESC WSTR("Windows Monitoring Agent (Provides performance data for monitoring solutions like Nagios)") 
    6161 
    6262// displayed name of the service 
    63 #define SZSERVICEDISPLAYNAME SZSERVICENAME WSTR(" (Nagios) ") SZVERSION WSTR(" ") SZARCH 
     63#define SERVICE_NAME SZAPPNAME WSTR(" ") CURRENT_SERVICE_VERSION WSTR(" ") SZARCH 
    6464 
    6565// list of service dependencies - "dep1\0dep2\0\0" 
    66 #define SZDEPENDENCIES       _T("") 
     66#define DEFAULT_SERVICE_DEPS       _T("") 
    6767 
    6868// Buffer size of incoming data (notice this is the maximum request length!) 
  • include/nrpe/server/connection.cpp

    r1ecd26f rc391984  
    5959 
    6060    void connection::handle_read_request(const boost::system::error_code& e, std::size_t bytes_transferred) { 
    61       handler_->log_debug(__FILE__, __LINE__, _T("handle_read data connection")); 
    6261      if (!e) { 
    6362        bool result; 
     
    9998 
    10099    void connection::handle_write_response(const boost::system::error_code& e) { 
    101       handler_->log_debug(__FILE__, __LINE__, _T("Written data")); 
    102100      if (!e) { 
    103101        // Initiate graceful connection closure. 
  • include/nrpe/server/ssl_connection.cpp

    r1ecd26f rc391984  
    2222 
    2323    void ssl_connection::stop() { 
    24       handler_->log_debug(__FILE__, __LINE__, _T("stopped data connection")); 
    2524    } 
    2625 
    2726    void ssl_connection::start() { 
    28       handler_->log_debug(__FILE__, __LINE__, _T("starting ssl_connection")); 
    2927      socket_.async_handshake(boost::asio::ssl::stream_base::server, 
    3028        strand_.wrap( 
     
    3230          ) 
    3331        ); 
    34       handler_->log_debug(__FILE__, __LINE__, _T("starting ssl_connection (started)")); 
    3532    } 
    3633 
    3734    void ssl_connection::handle_handshake(const boost::system::error_code& error) { 
    38       handler_->log_debug(__FILE__, __LINE__, _T("handle_handshake ssl_connection")); 
    3935      if (!error) 
    4036        connection::start(); 
  • include/nscapi/nscapi_core_wrapper.cpp

    r7443b58 rc391984  
    149149    } 
    150150    ::PluginCommand::Response payload = rsp_msg.payload(0); 
    151     msg = to_wstring(payload.message()); 
    152     CORE_LOG_ERROR_STD(_T("Attempting to parse perf data")); 
    153     perf = to_wstring(::nscapi::functions::build_performance_data(payload)); 
    154     CORE_LOG_ERROR_STD(_T("Attempting to parse perf data: '") + perf + _T("'")); 
     151    msg = utf8::cvt<std::wstring>(payload.message()); 
     152    perf = utf8::cvt<std::wstring>(::nscapi::functions::build_performance_data(payload)); 
    155153  } 
    156154  return ret; 
  • include/nscapi/nscapi_plugin_wrapper.hpp

    r7443b58 rc391984  
    3333#include <strEx.h> 
    3434#include <nscapi/settings_proxy.hpp> 
     35#include <nscapi/functions.hpp> 
    3536 
    3637#include "../libs/protobuf/plugin.proto.h" 
     
    3839 
    3940using namespace nscp::helpers; 
    40  
    41 #ifdef WIN32 
    42 //#include <windows.h> 
    43 #endif 
    44  
    4541 
    4642namespace nscapi { 
     
    9692  extern helper_singleton* plugin_singleton; 
    9793 
    98   class functions { 
    99   public: 
    100     static PluginCommand::Response_Code nagios_to_gpb(int ret) { 
    101       if (ret == NSCAPI::returnOK) 
    102         return PluginCommand::Response_Code_OK; 
    103       if (ret == NSCAPI::returnWARN) 
    104         return PluginCommand::Response_Code_WARNING; 
    105       if (ret == NSCAPI::returnCRIT) 
    106         return PluginCommand::Response_Code_CRITCAL; 
    107       return PluginCommand::Response_Code_UNKNOWN; 
    108     } 
    109  
    110     static double trim_to_double(std::wstring s) { 
    111       std::wstring::size_type pend = s.find_first_not_of(_T("0123456789,.")); 
    112       if (pend != std::wstring::npos) 
    113         s = s.substr(0,pend); 
    114       strEx::replace(s, _T(","), _T(".")); 
    115       return strEx::stod(s); 
    116     } 
    117  
    118     static void parse_performance_data(PluginCommand::Response *resp, std::wstring &perf) { 
    119       strEx::splitList items = strEx::splitEx(perf, _T(" ")); 
    120       for (strEx::splitList::const_iterator cit = items.begin(); cit != items.end(); ++cit) { 
    121         strEx::splitVector items = strEx::splitV(*cit, _T(";")); 
    122         if (items.size() < 3) 
    123           break; 
    124  
    125         ::PluginCommand::PerformanceData* perfData = resp->add_perf(); 
    126         perfData->set_type(PluginCommand::PerformanceData_Type_FLOAT); 
    127         std::pair<std::wstring,std::wstring> fitem = strEx::split(items[0], _T("=")); 
    128         perfData->set_alias(to_string(fitem.first)); 
    129         ::PluginCommand::PerformanceData_FloatValue* floatPerfData = perfData->mutable_float_value(); 
    130  
    131         std::wstring::size_type pend = fitem.second.find_first_not_of(_T("0123456789,.")); 
    132         if (pend == std::wstring::npos) { 
    133           floatPerfData->set_value(trim_to_double(fitem.second.c_str())); 
    134         } else { 
    135           floatPerfData->set_value(trim_to_double(fitem.second.substr(0,pend).c_str())); 
    136           floatPerfData->set_unit(to_string(fitem.second.substr(pend))); 
    137         } 
    138         floatPerfData->set_warning(trim_to_double(items[1])); 
    139         floatPerfData->set_critical(trim_to_double(items[2])); 
    140         if (items.size() >= 5) { 
    141           floatPerfData->set_minimum(trim_to_double(items[3])); 
    142           floatPerfData->set_maximum(trim_to_double(items[4])); 
    143         } 
    144       } 
    145     } 
    146     static std::string build_performance_data(::PluginCommand::Response &payload) { 
    147       std::string ret; 
    148       for (int i=0;i<payload.perf_size();i++) { 
    149         ::PluginCommand::PerformanceData perfData = payload.perf(i); 
    150         if (!ret.empty()) 
    151           ret += " "; 
    152         ret += perfData.alias() + "="; 
    153         if (perfData.has_float_value()) { 
    154           ::PluginCommand::PerformanceData_FloatValue fval = perfData.float_value(); 
    155           ret += to_string(fval.value()); 
    156           if (fval.has_unit()) 
    157             ret += fval.unit(); 
    158           if (!fval.has_warning())  continue; 
    159           ret += ";" + to_string(fval.warning()); 
    160           if (!fval.has_critical()) continue; 
    161           ret += ";" + to_string(fval.critical()); 
    162           if (!fval.has_minimum())  continue; 
    163           ret += ";" + to_string(fval.minimum()); 
    164           if (!fval.has_maximum())  continue; 
    165           ret += ";" + to_string(fval.maximum()); 
    166         } 
    167       } 
    168       return ret; 
    169     } 
    170   }; 
     94 
    17195 
    17296  namespace impl { 
     
    218142    public: 
    219143      NSCAPI::nagiosReturn handleRAWCommand(const wchar_t* char_command, const std::string &request, std::string &response) { 
    220  
    221         std::wstring command = char_command; 
    222         PluginCommand::RequestMessage request_message; 
    223         request_message.ParseFromString(request); 
    224  
    225         if (request_message.payload_size() != 1) { 
    226           return NSCAPI::returnIgnored; 
    227         } 
    228         ::PluginCommand::Request payload = request_message.payload().Get(0); 
    229         std::list<std::wstring> args; 
    230         for (int i=0;i<payload.arguments_size();i++) { 
    231           args.push_back(to_wstring(payload.arguments(i))); 
    232         } 
     144        nscapi::functions::decoded_simple_command_data data = nscapi::functions::process_simple_command_request(char_command, request); 
    233145        std::wstring msg, perf; 
    234         NSCAPI::nagiosReturn ret = handleCommand(command, args, msg, perf); 
    235  
    236         PluginCommand::ResponseMessage response_message; 
    237         ::PluginCommand::Header* hdr = response_message.mutable_header(); 
    238  
    239         hdr->set_type(PluginCommand::Header_Type_RESPONSE); 
    240         hdr->set_version(PluginCommand::Header_Version_VERSION_1); 
    241  
    242         PluginCommand::Response *resp = response_message.add_payload(); 
    243         resp->set_command(to_string(command)); 
    244         resp->set_message(to_string(msg)); 
    245         ::nscapi::functions::parse_performance_data(resp, perf); 
    246  
    247         resp->set_version(PluginCommand::Response_Version_VERSION_1); 
    248         resp->set_result(nscapi::functions::nagios_to_gpb(ret)); 
    249         response_message.SerializeToString(&response); 
    250         return ret; 
     146        NSCAPI::nagiosReturn ret = handleCommand(data.command, data.args, msg, perf); 
     147        return nscapi::functions::process_simple_command_result(data.command, ret, msg, perf, response); 
    251148      } 
    252149 
  • include/pdh/collectors.hpp

    r1ecd26f rc391984  
    283283  public: 
    284284    RoundINTPDHBufferListenerImpl() : buffer(NULL), length(0), current(0), hasValue_(false), parent_(NULL) {} 
    285     RoundINTPDHBufferListenerImpl(int length_) : length(length_), current(0), hasValue_(false), parent_(NULL) { 
    286       PDHCounterMutexHandler mutex(&mutex_); 
    287       if (!mutex.hasLock()) 
    288         return; 
    289       buffer = new TType[length]; 
    290       for (unsigned int i=0; i<length;i++) 
    291         buffer[i] = 0; 
     285    RoundINTPDHBufferListenerImpl(int length_) : buffer(NULL), length(0), current(0), hasValue_(false), parent_(NULL) { 
     286      resize(length_); 
    292287    } 
    293288    virtual ~RoundINTPDHBufferListenerImpl() { 
     
    343338      if (!hasValue_) 
    344339        throw PDHException(get_name(), _T("No value has been collected yet")); 
    345       if ((backItems == 0) || (backItems >= length)) 
    346         throw PDHException(get_name(), _T("Strange error buffer pointers are f*cked up")); 
     340      if (backItems == 0) 
     341        throw PDHException(get_name(), _T("No timeframe given on command line (ie. time=0)")); 
     342      if (backItems >= length) 
     343        throw PDHException(get_name(), _T("Length given larger then interval: ") + strEx::itos(backItems) + _T(" >= ") + strEx::itos(length)); 
    347344      double ret = 0; 
    348345      if (current >= backItems) { 
  • include/strEx.h

    r1f24a1c rc391984  
    850850} 
    851851 
    852  
     852namespace utf8 { 
     853  /** Converts a std::wstring into a std::string with UTF-8 encoding. */ 
     854  template<typename StringT> 
     855  StringT cvt(std::wstring const & string); 
     856 
     857  /** Converts a std::String with UTF-8 encoding into a std::wstring. */ 
     858  template<typename StringT> 
     859  StringT cvt(std::string const & string ); 
     860 
     861  /** Nop specialization for std::string. */ 
     862  template <> 
     863  inline std::string cvt(std::string const & string) { 
     864    return string; 
     865  } 
     866 
     867  /** Nop specialization for std::wstring. */ 
     868  template<> 
     869  inline std::wstring cvt(std::wstring const & rc_string) { 
     870    return rc_string; 
     871  } 
     872 
     873  template<> 
     874  inline std::string cvt(std::wstring const & str) { 
     875    // figure out how many narrow characters we are going to get  
     876    int nChars = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.length(), NULL, 0, NULL, NULL); 
     877    if (nChars == 0) 
     878      return ""; 
     879 
     880    // convert the wide string to a narrow string 
     881    // nb: slightly naughty to write directly into the string like this 
     882    std::string buf; 
     883    buf.resize(nChars); 
     884    WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.length(), const_cast<char*>(buf.c_str()), nChars, NULL, NULL); 
     885    return buf ;  
     886  } 
     887 
     888  template<> 
     889  inline std::wstring cvt(std::string const & str) { 
     890    // figure out how many wide characters we are going to get  
     891    int nChars = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), NULL, 0); 
     892    if (nChars == 0) 
     893      return L""; 
     894 
     895    // convert the narrow string to a wide string  
     896    // nb: slightly naughty to write directly into the string like this 
     897    std::wstring buf; 
     898    buf.resize(nChars); 
     899    MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), const_cast<wchar_t*>(buf.c_str()), nChars); 
     900    return buf; 
     901  } 
     902} 
  • include/unicode_char.hpp

    r7f9c823 rc391984  
    1010 
    1111#endif 
     12 
     13#include <unicode/ustring.h> 
  • libs/lua/CMakeLists.txt

    r1f24a1c rc391984  
    99    SET(HAVE_LUA TRUE) 
    1010    SET(LUA_SOURCE_DIR ${LUA_INCLUE_DIR}) 
    11   ELSE (LUA_SOURCE_DIR) 
     11  ELSE (LUA_INCLUE_DIR) 
    1212    message(STATUS "Lua was not found in ${LUA_SOURCE_DIR} (LUA_SOURCE_DIR)") 
    13   ENDIF (LUA_SOURCE_DIR) 
     13  ENDIF (LUA_INCLUE_DIR) 
    1414ENDIF (HAVE_LUA) 
    1515 
  • libs/protobuf/CMakeLists.txt

    r1ecd26f rc391984  
    99 
    1010SET(SRCS 
     11  plugin.proto 
     12  log.proto 
     13   
    1114  ${PROTO_PLUGIN_SRC} 
    1215  ${PROTO_LOG_SRC} 
  • libs/protobuf/plugin.proto

    r8988f9e rc391984  
    8282  required Code result = 9; 
    8383  required string message = 10; 
    84   repeated PerformanceData perf = 11; 
     84  optional string legacyPerf = 11; 
     85  repeated PerformanceData perf = 12; 
    8586   
    8687} 
  • modules/CheckExternalScripts/CheckExternalScripts.cpp

    r7443b58 rc391984  
    135135} 
    136136 
    137  
    138 NSCAPI::nagiosReturn CheckExternalScripts::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
    139   command_list::const_iterator cit = commands.find(command); 
     137NSCAPI::nagiosReturn CheckExternalScripts::handleRAWCommand(const wchar_t* char_command, const std::string &request, std::string &response) { 
     138  nscapi::functions::decoded_simple_command_data data = nscapi::functions::process_simple_command_request(char_command, request); 
     139 
     140  command_list::const_iterator cit = commands.find(data.command); 
    140141  bool isAlias = false; 
    141142  if (cit == commands.end()) { 
    142     cit = alias.find(command); 
     143    cit = alias.find(data.command); 
    143144    if (cit == alias.end()) 
    144145      return NSCAPI::returnIgnored; 
     
    147148 
    148149  const command_data cd = (*cit).second; 
    149   std::wstring args = cd.arguments; 
     150  std::list<std::wstring> args = cd.arguments; 
     151  bool first = true; 
    150152  if (isAlias || allowArgs_) { 
    151     int i=1; 
    152     BOOST_FOREACH(std::wstring str, arguments) { 
    153       if (!isAlias && !allowNasty_) { 
    154         if (str.find_first_of(NASTY_METACHARS) != std::wstring::npos) { 
    155           NSC_LOG_ERROR(_T("Request string contained illegal metachars!")); 
    156           return NSCAPI::returnIgnored; 
     153    BOOST_FOREACH(std::wstring &arg, args) { 
     154      int i=1; 
     155      BOOST_FOREACH(std::wstring str, data.args) { 
     156        if (first && !isAlias && !allowNasty_) { 
     157          if (str.find_first_of(NASTY_METACHARS) != std::wstring::npos) { 
     158            return nscapi::functions::process_simple_command_result(data.command, NSCAPI::returnUNKNOWN, _T("Request contained illegal characters!"), _T(""), response); 
     159          } 
    157160        } 
     161        strEx::replace(arg, _T("$ARG") + strEx::itos(i++) + _T("$"), str); 
    158162      } 
    159       strEx::replace(args, _T("$ARG") + strEx::itos(i++) + _T("$"), str); 
    160     } 
    161   } 
     163    } 
     164  } 
     165 
     166 
     167  std::wstring xargs; 
     168  BOOST_FOREACH(std::wstring s, args) { 
     169    if (!xargs.empty()) 
     170      xargs += _T(" "); 
     171    xargs += s; 
     172  } 
     173 
     174  NSC_LOG_MESSAGE(_T("Arguments: ") + xargs); 
     175 
     176 
    162177  if (isAlias) { 
     178    std::wstring message; 
    163179    try { 
    164       return GET_CORE()->InjectSplitAndCommand(cd.command, args, ' ', message, perf, true); 
     180      return GET_CORE()->InjectCommand(cd.command, args, response); 
    165181    } catch (boost::escaped_list_error &e) { 
    166182      NSC_LOG_MESSAGE(_T("Failed to parse alias expression: ") + strEx::string_to_wstring(e.what())); 
    167183      NSC_LOG_MESSAGE(_T("We will now try parsing the old syntax instead...")); 
    168       return GET_CORE()->InjectSplitAndCommand(cd.command, args, ' ', message, perf, false); 
     184      return GET_CORE()->InjectCommand(cd.command, args, response); 
    169185    } 
    170186  } else { 
    171     int result = process::executeProcess(process::exec_arguments(root_, cd.command + _T(" ") + args, timeout), message, perf); 
     187    std::wstring message, perf; 
     188    int result = process::executeProcess(process::exec_arguments(root_, cd.command + _T(" ") + xargs, timeout), message, perf); 
    172189    if (!nscapi::plugin_helper::isNagiosReturnCode(result)) { 
    173       NSC_LOG_ERROR_STD(_T("The command (") + cd.command + _T(") returned an invalid return code: ") + strEx::itos(result)); 
    174       return NSCAPI::returnUNKNOWN; 
    175     } 
    176     return nscapi::plugin_helper::int2nagios(result); 
    177   } 
    178  
    179 } 
     190      return nscapi::functions::process_simple_command_result(data.command, NSCAPI::returnUNKNOWN, _T("The command (") + cd.command + _T(") returned an invalid return code: ") + strEx::itos(result), _T(""), response); 
     191    } 
     192    return nscapi::functions::process_simple_command_result(data.command, nscapi::plugin_helper::int2nagios(result), message, perf, response); 
     193  } 
     194} 
     195//  
     196//  
     197//  
     198//  std::wstring msg, perf; 
     199//  NSCAPI::nagiosReturn ret = handleCommand(data.command, data.args, msg, perf); 
     200//  return nscapi::functions::process_simple_command_result(data.command, ret, msg, perf); 
     201// } 
     202//  
     203// NSCAPI::nagiosReturn CheckExternalScripts::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
     204//  command_list::const_iterator cit = commands.find(command); 
     205//  bool isAlias = false; 
     206//  if (cit == commands.end()) { 
     207//    cit = alias.find(command); 
     208//    if (cit == alias.end()) 
     209//      return NSCAPI::returnIgnored; 
     210//    isAlias = true; 
     211//  } 
     212//  
     213//  const command_data cd = (*cit).second; 
     214//  std::wstring args = cd.arguments; 
     215//  if (isAlias || allowArgs_) { 
     216//    int i=1; 
     217//    BOOST_FOREACH(std::wstring str, arguments) { 
     218//      if (!isAlias && !allowNasty_) { 
     219//        if (str.find_first_of(NASTY_METACHARS) != std::wstring::npos) { 
     220//          NSC_LOG_ERROR(_T("Request string contained illegal metachars!")); 
     221//          return NSCAPI::returnIgnored; 
     222//        } 
     223//      } 
     224//      strEx::replace(args, _T("$ARG") + strEx::itos(i++) + _T("$"), str); 
     225//    } 
     226//  } 
     227//  if (isAlias) { 
     228//    try { 
     229//      return GET_CORE()->InjectSplitAndCommand(cd.command, args, ' ', message, perf, true); 
     230//    } catch (boost::escaped_list_error &e) { 
     231//      NSC_LOG_MESSAGE(_T("Failed to parse alias expression: ") + strEx::string_to_wstring(e.what())); 
     232//      NSC_LOG_MESSAGE(_T("We will now try parsing the old syntax instead...")); 
     233//      return GET_CORE()->InjectSplitAndCommand(cd.command, args, ' ', message, perf, false); 
     234//    } 
     235//  } else { 
     236//    int result = process::executeProcess(process::exec_arguments(root_, cd.command + _T(" ") + args, timeout), message, perf); 
     237//    if (!nscapi::plugin_helper::isNagiosReturnCode(result)) { 
     238//      NSC_LOG_ERROR_STD(_T("The command (") + cd.command + _T(") returned an invalid return code: ") + strEx::itos(result)); 
     239//      return NSCAPI::returnUNKNOWN; 
     240//    } 
     241//    return nscapi::plugin_helper::int2nagios(result); 
     242//  } 
     243//  
     244// } 
    180245 
    181246 
  • modules/CheckExternalScripts/CheckExternalScripts.h

    r7443b58 rc391984  
    2525#include <execute_process.hpp> 
    2626 
    27 class CheckExternalScripts : public nscapi::impl::SimpleCommand, nscapi::impl::simple_plugin { 
     27class CheckExternalScripts : public nscapi::impl::simple_plugin { 
    2828private: 
    2929  struct command_data { 
    3030    command_data() {} 
    31     command_data(std::wstring command_, std::wstring arguments_) : command(command_), arguments(arguments_) {} 
     31    command_data(std::wstring command_, std::wstring arguments_) : command(command_) { 
     32      parser_arguments(arguments_); 
     33    } 
     34    void parser_arguments(std::wstring args) { 
     35      boost::tokenizer<boost::escaped_list_separator<wchar_t>, std::wstring::const_iterator, std::wstring>  
     36        tok(args, boost::escaped_list_separator<wchar_t>(L'\\', L' ', L'\"')); 
     37      BOOST_FOREACH(std::wstring s, tok) { 
     38        arguments.push_back(s); 
     39      } 
     40    } 
     41    std::wstring get_argument() { 
     42      std::wstring args; 
     43      BOOST_FOREACH(std::wstring s, arguments) { 
     44        if (!args.empty()) 
     45          args += _T(" "); 
     46        args += s; 
     47      } 
     48      return args; 
     49    } 
     50 
    3251    std::wstring command; 
    33     std::wstring arguments; 
     52    std::list<std::wstring> arguments; 
    3453    std::wstring to_string() { 
    35       return command + _T("(") + arguments + _T(")"); 
     54      std::wstring args; 
     55      BOOST_FOREACH(std::wstring s, arguments) { 
     56        if (!args.empty()) 
     57          args += _T(" "); 
     58        args += s; 
     59      } 
     60      return command + _T("(") + get_argument() + _T(")"); 
    3661    } 
    3762  }; 
     
    6893  bool hasCommandHandler(); 
    6994  bool hasMessageHandler(); 
    70   NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
     95  NSCAPI::nagiosReturn handleRAWCommand(const wchar_t* char_command, const std::string &request, std::string &response); 
     96  //NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
    7197  std::wstring getConfigurationMeta(); 
    7298 
  • modules/CheckSystem/CheckSystem.cpp

    r7443b58 rc391984  
    6666bool CheckSystem::loadModuleEx(std::wstring alias, NSCAPI::moduleLoadMode mode) { 
    6767  PDHCollector::system_counter_data *data = new PDHCollector::system_counter_data; 
    68   data->check_intervall = 10; 
     68  data->check_intervall = 100; 
    6969  try { 
    7070    typedef std::map<std::wstring,std::wstring> counter_map_type; 
     
    9191 
    9292    settings.alias().add_key_to_settings() 
    93       (_T("default"), sh::bool_key(&default_counters, true), 
    94       _T("HOSTNAME"), _T("The host name of this host if set to blank (default) the windows name of the computer will be used.")) 
     93      (_T("default"), sh::bool_key(&default_counters, true), 
     94      _T("DEFAULT COUNTERS"), _T("Load the default counters: ") PDH_SYSTEM_KEY_CPU _T(", ") PDH_SYSTEM_KEY_MCB _T(", ") PDH_SYSTEM_KEY_MCL _T(" and ") PDH_SYSTEM_KEY_UPT _T(" If not you need to specify these manually. ") ) 
     95 
     96      (_T("default"), sh::bool_key(&default_counters, true), 
     97      _T("DEFAULT COUNTERS"), _T("Load the default counters: ") PDH_SYSTEM_KEY_CPU _T(", ") PDH_SYSTEM_KEY_MCB _T(", ") PDH_SYSTEM_KEY_MCL _T(" and ") PDH_SYSTEM_KEY_UPT _T(" If not you need to specify these manually. ") ) 
     98 
     99      (_T("default buffer length"), sh::wstring_key(&data->buffer_length, _T("1h")), 
     100      _T("DEFAULT INTERVALL"), _T("Used to define the default intervall for range buffer checks (ie. CPU).")) 
    95101//  
    96102//      (_T("hostname cache"), sh::bool_key(&cacheNscaHost_), 
  • modules/CheckSystem/PDHCollector.cpp

    r7443b58 rc391984  
    4646    return boost::shared_ptr<PDHCollectors::PDHCollector>(new PDHCollectors::StaticPDHCounterListener<__int64, PDHCollectors::format_large, PDHCollectors::PDHCounterNormalMutex>); 
    4747  } else if (data_type == type_int64 && data_format == format_large && collection_strategy == rrd) { 
    48     return boost::shared_ptr<PDHCollectors::PDHCollector>(new PDHCollectors::RoundINTPDHBufferListener<__int64, PDHCollectors::format_large, PDHCollectors::PDHCounterNormalMutex>(get_buffer_length(check_intervall))); 
     48    unsigned int buffer_size = get_buffer_length(check_intervall); 
     49    return boost::shared_ptr<PDHCollectors::PDHCollector>(new PDHCollectors::RoundINTPDHBufferListener<__int64, PDHCollectors::format_large, PDHCollectors::PDHCounterNormalMutex>(buffer_size)); 
    4950  } 
    5051  return boost::shared_ptr<PDHCollectors::PDHCollector>(); 
     
    7677 
    7778  check_intervall_ = data->check_intervall; 
     79  std::wstring default_buffer_length = data->buffer_length; 
    7880  PDH::PDHQuery pdh; 
    7981  bool bInit = true; 
     
    9193        try { 
    9294          NSC_DEBUG_MSG_STD(_T("Loading counter: ") + c.alias + _T(" = ") + c.path); 
     95          c.set_default_buffer_size(default_buffer_length); 
    9396          collector_ptr collector = c.create(check_intervall_); 
    9497          if (collector) { 
  • modules/CheckSystem/PDHCollector.h

    r7443b58 rc391984  
    8484 
    8585      boost::shared_ptr<PDHCollectors::PDHCollector> create(int check_intervall); 
     86      void set_default_buffer_size(std::wstring buffer_size_) { 
     87        buffer_size = buffer_size_; 
     88      } 
    8689 
    8790      int get_buffer_length(int check_intervall) { 
     
    100103    }; 
    101104 
    102     int check_intervall; 
     105    unsigned int check_intervall; 
     106    std::wstring buffer_length; 
    103107 
    104108    std::list<counter> counters; 
  • modules/NRPEServer/handler_impl.hpp

    r1ecd26f rc391984  
    3434  virtual void set_perf_data(bool v) { 
    3535    noPerfData_ = !v; 
     36    if (noPerfData_) 
     37      log_debug(__FILE__, __LINE__, _T("Performance data disabled!")); 
    3638  } 
    3739 
  • scripts/CMakeLists.txt

    r87cf3c4 rc391984  
    88SET(script_ALL ${scripts_BAT} ${scripts_VBS} ${scripts_PS1}) 
    99 
    10 INSTALL(FILES ${script_ALL} DESTINATION "scripts") 
    11 INSTALL(FILES ${scripts_LIB} DESTINATION "scripts/lib") 
     10MESSAGE(STATUS "Copying script:") 
     11FOREACH(file ${script_ALL}) 
     12  get_filename_component(filename ${file} NAME) 
     13  MESSAGE(STATUS " + ${filename}") 
     14  FILE(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/scripts) 
     15ENDFOREACH(file ${script_ALL}) 
    1216 
     17 
     18FOREACH(file ${scripts_LIB}) 
     19  get_filename_component(filename ${file} NAME) 
     20  MESSAGE(STATUS " + lib - ${filename}") 
     21  FILE(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/scripts/lib) 
     22ENDFOREACH(file ${scripts_LIB}) 
  • service/NSClient++.cpp

    r2d69ab6 rc391984  
    3939#include "service_manager.hpp" 
    4040#include <nscapi/nscapi_helper.hpp> 
     41#include <nscapi/functions.hpp> 
     42 
    4143#include <settings/client/settings_client.hpp> 
    4244#include "cli_parser.hpp" 
     
    238240{ 
    239241  srand( (unsigned)time( NULL ) ); 
    240  
    241242  cli_parser parser(&mainClient); 
    242  
    243   if (argc > 0) { 
    244     LOG_INFO_CORE(_T("Got arguments on command line")); 
    245     for (int i=0;i<argc;i++) { 
    246       LOG_INFO_CORE((std::wstring)_T("arg: ") + argv[i]); 
    247     } 
    248   } else { 
    249     LOG_INFO_CORE(_T("Got NO arguments on command line")); 
    250   } 
    251   parser.parse(argc, argv); 
    252  
    253   return -1; 
     243  return parser.parse(argc, argv); 
    254244 
    255245  int nRetCode = 0; 
     
    10431033      return NSCAPI::returnUNKNOWN; 
    10441034    } 
    1045     msg = to_wstring(rsp_msg.payload(0).message()); 
     1035    msg = utf8::cvt<std::wstring>(rsp_msg.payload(0).message()); 
     1036    perf = utf8::cvt<std::wstring>(nscapi::functions::build_performance_data(rsp_msg.payload(0))); 
    10461037    if ( (ret == NSCAPI::returnInvalidBufferLen) || (ret == NSCAPI::returnIgnored) ) { 
    10471038      return ret; 
     
    10661057  std::wstring cmd = nsclient::commands::make_key(raw_command); 
    10671058  if (logDebug()) { 
    1068     LOG_DEBUG_CORE_STD(_T("Injecting: ") + cmd + _T(": {{{") + strEx::strip_hex(to_wstring(request)) + _T("}}}")); 
     1059    LOG_DEBUG_CORE_STD(_T("Injecting: ") + cmd + _T("...")); 
    10691060  } 
    10701061  /*if (shared_client_.get() != NULL && shared_client_->hasMaster()) { 
     
    10961087      } 
    10971088      NSCAPI::nagiosReturn c = plugin->handleCommand(cmd.c_str(), request, response); 
    1098       LOG_DEBUG_CORE_STD(_T("Result ") + cmd + _T(": ") + nscapi::plugin_helper::translateReturn(c) + _T(" {{{") + strEx::strip_hex(to_wstring(response)) + _T("}}}")); 
     1089      LOG_DEBUG_CORE_STD(_T("Result ") + cmd + _T(": ") + nscapi::plugin_helper::translateReturn(c)); 
    10991090      return c; 
    11001091    } catch (nsclient::commands::command_exception &e) { 
  • service/logger.hpp

    r2d69ab6 rc391984  
    4949        msg->set_file(file); 
    5050        msg->set_line(line); 
    51         msg->set_message(to_string(logMessage)); 
     51        msg->set_message(utf8::cvt<std::string>(logMessage)); 
    5252        if (!message.SerializeToString(&str)) { 
    5353          return "Failed to generate message"; 
  • service/simple_client.hpp

    r2d69ab6 rc391984  
    88  public: 
    99    simple_client(NSClient *core) : core_(core) {} 
     10 
     11    void log(std::wstring msg) { 
     12      std::string s = nsclient::logger_helper::create_info(__FILE__, __LINE__, msg);  
     13      core_->reportMessage(s); 
     14    } 
    1015    void start() { 
    1116      core_->enableDebug(true); 
     
    6469          NSCAPI::nagiosReturn ret = core_->inject(t.first, t.second, msg, perf); 
    6570          if (ret == NSCAPI::returnIgnored) { 
    66             std::wcout << _T("No handler for command: ") << t.first << std::endl; 
     71            log(_T("No handler for command: ") + t.first); 
    6772          } else { 
    68             std::wcout << nscapi::plugin_helper::translateReturn(ret) << _T(":"); 
    69             std::wcout << msg; 
     73            log(nscapi::plugin_helper::translateReturn(ret) + _T(":") + msg); 
    7074            if (!perf.empty()) 
    71               std::cout << "|" << strEx::wstring_to_string(perf); 
    72             std::wcout << std::endl; 
     75              log(_T(" Perfoamcen data: ") + perf); 
    7376          } 
    7477        } 
Note: See TracChangeset for help on using the changeset viewer.