Changeset 7443b58 in nscp


Ignore:
Timestamp:
03/24/11 21:38:31 (2 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
2d69ab6
Parents:
569a179
Message:

0.4.x a lot of tweaks and fixes (now works as a replacement for 0.3.x in many ways)

Files:
2 added
1 deleted
35 edited

Legend:

Unmodified
Added
Removed
  • helpers/installers/installer/CMakeLists.txt

    r197b263 r7443b58  
    4141 
    4242ADD_DEPENDENCIES(${TARGET} ${MAIN_NSCP_TARGET} ${ALL_MODULE_NAMES} ${ALL_TOOL_NAMES} ${ALL_INSTALLERS_DLLS_NAMES}) 
     43 
     44SET_TARGET_PROPERTIES(${TARGET} PROPERTIES FOLDER "installers") 
  • include/checkHelpers.hpp

    r1ecd26f r7443b58  
    2323#include <string> 
    2424#include <strEx.h> 
     25#include <math.h> 
    2526 
    2627#define MAKE_PERFDATA_SIMPLE(alias, value, unit) _T("'") + alias + _T("'=") + value + unit 
    27 #define MAKE_PERFDATA(alias, value, unit, warn, crit) _T("'") + alias + _T("'=") + value + unit + _T(";") + warn + _T(";") + crit + _T("; ") 
    28 #define MAKE_PERFDATA_EX(alias, value, unit, warn, crit, xmin, xmax) _T("'") + alias + _T("'=") + value + unit + _T(";") + warn + _T(";") + crit + _T(";") + xmin + _T(";") + xmax + _T("; ") 
     28#define MAKE_PERFDATA(alias, value, unit, warn, crit) _T("'") + alias + _T("'=") + value + unit + _T(";") + warn + _T(";") + crit  
     29#define MAKE_PERFDATA_EX(alias, value, unit, warn, crit, xmin, xmax) _T("'") + alias + _T("'=") + value + unit + _T(";") + warn + _T(";") + crit + _T(";") + xmin + _T(";") + xmax 
    2930 
    3031namespace checkHolders { 
     
    109110    {} 
    110111    CheckContainer(std::wstring data_, TContents warn_, TContents crit_)  
    111       : data(data_), warn(warn_), crit(crit_), show(showUnknown)  
     112      : data(data_), warn(warn_), crit(crit_), show(showUnknown), perfData(true) 
    112113    {} 
    113     CheckContainer(std::wstring name_, std::wstring alias_, TContents warn_, TContents crit_)  
    114       : data(data_), alias(alias_), warn(warn_), crit(crit_), show(showUnknown)  
     114    CheckContainer(std::wstring data_, std::wstring alias_, TContents warn_, TContents crit_)  
     115      : data(data_), alias(alias_), warn(warn_), crit(crit_), show(showUnknown), perfData(true) 
    115116    {} 
    116117    CheckContainer(const TThisType &other)  
    117       : data(other.data), alias(other.alias), warn(other.warn), crit(other.crit), show(other.show)  
     118      : data(other.data), alias(other.alias), warn(other.warn), crit(other.crit), show(other.show), perfData(other.perfData) 
     119 
    118120    {} 
     121    CheckContainer<TContents>& operator =(const CheckContainer<TContents> &other) { 
     122      warn = other.warn; 
     123      crit = other.crit; 
     124      data = other.data; 
     125      alias = other.alias; 
     126      show = other.show; 
     127      perfData = other.perfData; 
     128      return *this; 
     129    } 
    119130    std::wstring getAlias() { 
    120131      if (alias.empty()) 
     
    174185  }; 
    175186 
     187  template <class TContents> 
     188  struct MagicCheckContainer : public CheckContainer<TContents> { 
     189    typedef CheckContainer<TContents> tParent; 
     190 
     191    MagicCheckContainer() : tParent() {} 
     192    MagicCheckContainer(std::wstring data_, TContents warn_, TContents crit_) : tParent(data_, warn_, crit_) {} 
     193    MagicCheckContainer(std::wstring data_, std::wstring alias_, TContents warn_, TContents crit_) : tParent(data_, alias_, warn_, crit_) {} 
     194    MagicCheckContainer(const TThisType &other) : tParent(other) {} 
     195 
     196    MagicCheckContainer<TContents>& operator =(const MagicCheckContainer<TContents> &other) { 
     197      tParent::operator =(other); 
     198      return *this; 
     199    } 
     200 
     201 
     202    void set_magic(double magic) { 
     203      warn.max_.set_magic(magic); 
     204      warn.min_.set_magic(magic); 
     205      crit.max_.set_magic(magic); 
     206      crit.min_.set_magic(magic); 
     207    } 
     208 
     209  }; 
    176210 
    177211  template <class value_type> 
     
    625659      return (value*100)/total; 
    626660    } 
     661 
     662    TTypeValue adjust_upper_magic(TTypeValue percentage, double normal, double magic) { 
     663      if (magic == 0) 
     664        return percentage; 
     665      return 100 - ( (100 - percentage) * pow(total / normal, magic) / (value / normal) ); 
     666    } 
     667    TTypeValue adjust_lower_magic(TTypeValue percentage, double normal, double magic) { 
     668      if (magic == 0) 
     669        return percentage; 
     670      return ( (percentage) * pow(total / normal, magic) / (value / normal) ); 
     671    } 
     672 
     673 
    627674  }; 
    628675 
     
    651698        if (p != std::wstring::npos) { 
    652699          if (isUpper_) 
    653             pParent_->setPercentageUpper(value); 
     700            pParent_->setPercentageUpper(value.substr(0, p)); 
    654701          else 
    655             pParent_->setPercentageLower(value); 
     702            pParent_->setPercentageLower(value.substr(0, p)); 
    656703        } else { 
    657704          if (isUpper_) 
     
    672719    InternalValue upper; 
    673720    InternalValue lower; 
    674  
    675     NumericPercentageBounds() : type_(none), upper(true), lower(false) { 
     721    double normal_size; 
     722    double magic; 
     723 
     724    NumericPercentageBounds() : type_(none), upper(true), lower(false), magic(0), normal_size(20*1024*1024) { 
    676725      upper.setParent(this); 
    677726      lower.setParent(this); 
    678727    } 
    679728 
    680     NumericPercentageBounds(const NumericPercentageBounds &other) { 
     729    NumericPercentageBounds(const NumericPercentageBounds &other)  
     730      : type_(other.type_) 
     731      , value_(other.value_) 
     732      , magic(other.magic) 
     733      , normal_size(other.normal_size) 
     734      , upper(other.upper) 
     735      , lower(other.lower) 
     736    { 
     737      upper.setParent(this); 
     738      lower.setParent(this); 
     739 
     740    } 
     741 
     742    NumericPercentageBounds& operator =(const NumericPercentageBounds &other) { 
    681743      type_ = other.type_; 
    682744      value_ = other.value_; 
     745      magic = other.magic; 
     746      normal_size = other.normal_size; 
     747      upper = other.upper; 
     748      lower = other.lower; 
     749      upper.setParent(this); 
     750      lower.setParent(this); 
     751      return *this; 
    683752    } 
    684753    checkResultType check(TType value) const { 
    685754      if (type_ == percentage_lower) { 
    686         if (value.getLowerPercentage() == value_) 
     755        if (value.getLowerPercentage() == value.adjust_lower_magic(value_, normal_size, magic)) 
    687756          return same; 
    688         else if (value.getLowerPercentage() > value_) 
     757        else if (value.getLowerPercentage() > value.adjust_lower_magic(value_, normal_size, magic)) 
    689758          return above; 
    690759      } else if (type_ == percentage_upper) { 
    691         if (value.getUpperPercentage() == value_) 
     760        if (value.getUpperPercentage() == value.adjust_upper_magic(value_, normal_size, magic)) 
    692761          return same; 
    693         else if (value.getUpperPercentage() > value_) 
     762        else if (value.getUpperPercentage() > value.adjust_upper_magic(value_, normal_size, magic)) 
    694763          return above; 
    695764      } else if (type_ == value_lower) { 
     
    727796      return value_; 
    728797    } 
     798    void set_magic(double magic_) { 
     799      magic = magic_; 
     800    } 
     801 
    729802    std::wstring gatherPerfData(std::wstring alias, TType &value, typename TType::TValueType warn, typename TType::TValueType crit) { 
    730803      unsigned int value_p, warn_p, crit_p; 
    731       TType::TValueType value_v, warn_v, crit_v; 
     804      TType::TValueType warn_v, crit_v; 
    732805      if (type_ == percentage_upper) { 
    733         value_p = value.getUpperPercentage(); 
    734         warn_p = warn; 
    735         crit_p = crit; 
    736         warn_v = static_cast<double>(value.total)*static_cast<double>(warn)/100.0; 
    737         crit_v = value.total*(double(crit)/100);; 
     806        value_p = static_cast<unsigned int>(value.getUpperPercentage()); 
     807        warn_p = static_cast<unsigned int>(warn); 
     808        crit_p = static_cast<unsigned int>(crit); 
     809        warn_v = static_cast<unsigned int>(static_cast<double>(value.total)*static_cast<double>(warn)/100.0); 
     810        crit_v = static_cast<unsigned int>(value.total*(double(crit)/100)); 
    738811      } else if (type_ == percentage_lower) { 
    739         value_p = value.getLowerPercentage(); 
    740         warn_p = warn; 
    741         crit_p = crit; 
    742         warn_v = static_cast<double>(value.total)*static_cast<double>(warn)/100.0; 
    743         crit_v = value.total*(double(crit)/100); 
     812        value_p = static_cast<unsigned int>(value.getLowerPercentage()); 
     813        warn_p = static_cast<unsigned int>(warn); 
     814        crit_p = static_cast<unsigned int>(crit); 
     815        warn_v = static_cast<unsigned int>(static_cast<double>(value.total)*static_cast<double>(warn)/100.0); 
     816        crit_v = static_cast<unsigned int>(value.total*(double(crit)/100)); 
    744817      } else if (type_ == value_upper) { 
    745         value_p = value.getUpperPercentage(); 
    746         warn_p = 100-(warn*100/value.total); 
    747         crit_p = 100-(crit*100/value.total); 
    748         warn_v = warn; 
    749         crit_v = crit; 
     818        value_p = static_cast<unsigned int>(value.getUpperPercentage()); 
     819        warn_p = static_cast<unsigned int>(100-(warn*100/value.total)); 
     820        crit_p = static_cast<unsigned int>(100-(crit*100/value.total)); 
     821        warn_v = static_cast<unsigned int>(warn); 
     822        crit_v = static_cast<unsigned int>(crit); 
    750823      } else { 
    751         value_p = value.getLowerPercentage(); 
    752         warn_p = 100-(warn*100/value.total); 
    753         crit_p = 100-(crit*100/value.total); 
    754         warn_v = warn; 
    755         crit_v = crit; 
     824        value_p = static_cast<unsigned int>(value.getLowerPercentage()); 
     825        warn_p = static_cast<unsigned int>(100-(warn*100/value.total)); 
     826        crit_p = static_cast<unsigned int>(100-(crit*100/value.total)); 
     827        warn_v = static_cast<unsigned int>(warn); 
     828        crit_v = static_cast<unsigned int>(crit); 
    756829      } 
    757830      std::wstring unit = THandler::get_perf_unit(min(warn_v, min(crit_v, value.value))); 
     
    765838    std::wstring gatherPerfData(std::wstring alias, TType &value) { 
    766839      unsigned int value_p; 
    767       TType::TValueType value_v; 
    768840      if (type_ == percentage_upper) { 
    769         value_p = value.getUpperPercentage(); 
     841        value_p = static_cast<unsigned int>(value.getUpperPercentage()); 
    770842      } else if (type_ == percentage_lower) { 
    771         value_p = value.getLowerPercentage(); 
     843        value_p = static_cast<unsigned int>(value.getLowerPercentage()); 
    772844      } else if (type_ == value_upper) { 
    773         value_p = value.getUpperPercentage(); 
     845        value_p = static_cast<unsigned int>(value.getUpperPercentage()); 
    774846      } else { 
    775         value_p = value.getLowerPercentage(); 
     847        value_p = static_cast<unsigned int>(value.getLowerPercentage()); 
    776848      } 
    777849      std::wstring unit = THandler::get_perf_unit(value.value); 
     
    853925  class MaxMinStateBounds { 
    854926  public: 
    855     TNumericHolder max; 
    856     TNumericHolder min; 
     927    TNumericHolder max_; 
     928    TNumericHolder min_; 
    857929    TStateHolder state; 
    858930    typedef MaxMinStateBounds<TValueType, TNumericHolder, TStateHolder > TMyType; 
     
    861933 
    862934    MaxMinStateBounds() {} 
    863     MaxMinStateBounds(const MaxMinStateBounds &other) { 
     935    MaxMinStateBounds(const MaxMinStateBounds &other) : state(other.state), max_(other.max_), min_(other.min_) {} 
     936    MaxMinStateBounds & operator =(const MaxMinStateBounds &other) { 
    864937      state = other.state; 
    865       max = other.max; 
    866       min = other.min; 
     938      max_ = other.max_; 
     939      min_ = other.min_; 
     940      return *this; 
    867941    } 
    868942    bool hasBounds() { 
    869       return state.hasBounds() ||  max.hasBounds() || min.hasBounds(); 
     943      return state.hasBounds() ||  max_.hasBounds() || min_.hasBounds(); 
    870944    } 
    871945 
     
    889963      if (state.hasBounds()) { 
    890964        // @todo 
    891       } else if (max.hasBounds()) { 
    892         return max.gatherPerfData(alias, value.count, warn.max.getPerfBound(value.count), crit.max.getPerfBound(value.count)); 
    893       } else if (min.hasBounds()) { 
    894         return min.gatherPerfData(alias, value.count, warn.min.getPerfBound(value.count), crit.min.getPerfBound(value.count)); 
     965      } else if (max_.hasBounds()) { 
     966        return max_.gatherPerfData(alias, value.count, warn.max_.getPerfBound(value.count), crit.max_.getPerfBound(value.count)); 
     967      } else if (min_.hasBounds()) { 
     968        return min_.gatherPerfData(alias, value.count, warn.min_.getPerfBound(value.count), crit.min_.getPerfBound(value.count)); 
    895969      } 
    896970      return _T(""); 
     
    903977        message = lable + _T(": ") + formatState(TStateHolder::toStringShort(value.state), type); 
    904978        return true; 
    905       } else if ((max.hasBounds())&&(max.check(value.count) != below)) { 
     979      } else if ((max_.hasBounds())&&(max_.check(value.count) != below)) { 
    906980        message = lable + _T(": ") + formatAbove(TNumericHolder::toStringShort(value.count), type); 
    907981        return true; 
    908       } else if ((min.hasBounds())&&(min.check(value.count) != above)) { 
     982      } else if ((min_.hasBounds())&&(min_.check(value.count) != above)) { 
    909983        message = lable + _T(": ") + formatBelow(TNumericHolder::toStringShort(value.count), type); 
    910984        return true; 
    911985      } else { 
    912         NSC_DEBUG_MSG_STD(_T("Missing bounds for check: ") + lable); 
     986        NSC_LOG_MESSAGE_STD(_T("Missing bounds for check: ") + lable); 
    913987        //std::cout << "No bounds specified..." << std::endl; 
    914988      } 
     
    10121086  class MaxMinBounds { 
    10131087  public: 
    1014     THolder max; 
    1015     THolder min; 
     1088    THolder max_; 
     1089    THolder min_; 
    10161090    typedef MaxMinBounds<THolder > TMyType; 
    10171091 
     
    10201094 
    10211095    MaxMinBounds() {} 
    1022     MaxMinBounds(const MaxMinBounds &other) { 
    1023       max = other.max; 
    1024       min = other.min; 
     1096    MaxMinBounds(const MaxMinBounds &other) : max_(other.max_), min_(other.min_) {} 
     1097    MaxMinBounds& operator=(const MaxMinBounds &other) { 
     1098      max_ = other.max_; 
     1099      min_ = other.min_; 
     1100      return *this; 
    10251101    } 
    10261102    bool hasBounds() { 
    1027       return max.hasBounds() || min.hasBounds(); 
     1103      return max_.hasBounds() || min_.hasBounds(); 
    10281104    } 
    10291105    static std::wstring toStringLong(typename THolder::TValueType &value) { 
     
    10341110    } 
    10351111    std::wstring gatherPerfData(std::wstring alias, typename THolder::TValueType &value, TMyType &warn, TMyType &crit) { 
    1036       if (max.hasBounds()) { 
    1037         return max.gatherPerfData(alias, value, warn.max.getPerfBound(value), crit.max.getPerfBound(value)); 
    1038       } else if (min.hasBounds()) { 
    1039         return min.gatherPerfData(alias, value, warn.min.getPerfBound(value), crit.min.getPerfBound(value)); 
     1112      if (max_.hasBounds()) { 
     1113        return max_.gatherPerfData(alias, value, warn.max_.getPerfBound(value), crit.max_.getPerfBound(value)); 
     1114      } else if (min_.hasBounds()) { 
     1115        return min_.gatherPerfData(alias, value, warn.min_.getPerfBound(value), crit.min_.getPerfBound(value)); 
    10401116      } else { 
    10411117        NSC_LOG_MESSAGE_STD(_T("Missing bounds for maxmin-bounds check: ") + alias); 
    1042         return min.gatherPerfData(alias, value, 0, 0); 
     1118        return min_.gatherPerfData(alias, value, 0, 0); 
    10431119      } 
    10441120      return _T(""); 
     
    10491125    } 
    10501126    bool check(typename THolder::TValueType &value, std::wstring lable, std::wstring &message, ResultType type) { 
    1051       if ((max.hasBounds())&&(max.check(value) != below)) { 
     1127      if ((max_.hasBounds())&&(max_.check(value) != below)) { 
    10521128        message = lable + _T(": ") + formatAbove(THolder::toStringLong(value), type); 
    10531129        return true; 
    1054       } else if ((min.hasBounds())&&(min.check(value) != above)) { 
     1130      } else if ((min_.hasBounds())&&(min_.check(value) != above)) { 
    10551131        message = lable + _T(": ") + formatBelow(THolder::toStringLong(value), type); 
    10561132        return true; 
     
    11411217        return eq.gatherPerfData(alias, value, warn.eq.getPerfBound(value), crit.eq.getPerfBound(value)); 
    11421218      } else { 
    1143         NSC_DEBUG_MSG_STD(_T("Missing bounds for: ") + alias); 
     1219        NSC_LOG_MESSAGE_STD(_T("Missing bounds for: ") + alias); 
    11441220        return _T(""); 
    11451221      } 
  • include/nscapi/macros.hpp

    r1ecd26f r7443b58  
    2828////////////////////////////////////////////////////////////////////////// 
    2929// Logging calls for the core wrapper  
    30  
     30/* 
    3131#define NSC_LOG_ERROR_STD(msg) NSC_LOG_ERROR(((std::wstring)msg).c_str()) 
    3232#define NSC_LOG_ERROR(msg) NSC_ANY_MSG(msg,NSCAPI::error) 
     
    4242 
    4343#define NSC_ANY_MSG(msg, type) GET_CORE()->Message(type, __FILE__, __LINE__, msg) 
     44*/ 
     45#define NSC_LOG_ERROR_STD(msg)  
     46#define NSC_LOG_ERROR(msg)  
     47 
     48#define NSC_LOG_CRITICAL_STD(msg)  
     49#define NSC_LOG_CRITICAL(msg)  
     50 
     51#define NSC_LOG_MESSAGE_STD(msg)  
     52#define NSC_LOG_MESSAGE(msg)  
     53 
     54#define NSC_DEBUG_MSG_STD(msg) 
     55#define NSC_DEBUG_MSG(msg) 
     56 
     57#define NSC_ANY_MSG(msg, type) 
     58 
    4459 
    4560////////////////////////////////////////////////////////////////////////// 
  • include/nscapi/nscapi_core_wrapper.cpp

    r1ecd26f r7443b58  
    246246  if (!fNSAPIInject) 
    247247    throw nscapi::nscapi_exception(_T("NSCore has not been initiated...")); 
    248   boost::tokenizer<boost::escaped_list_separator<wchar_t>, std::wstring::const_iterator, std::wstring > tok(buffer, boost::escaped_list_separator<wchar_t>(L'\\', spliwchar_t, L'\"')); 
     248  std::list<std::wstring> arglist; 
     249  if (escape) { 
     250    boost::tokenizer<boost::escaped_list_separator<wchar_t>, std::wstring::const_iterator, std::wstring > tok(buffer, boost::escaped_list_separator<wchar_t>(L'\\', spliwchar_t, L'\"')); 
     251    BOOST_FOREACH(std::wstring s, tok) 
     252      arglist.push_back(s); 
     253  } else { 
     254    std::wstring split; 
     255    split.push_back(spliwchar_t); 
     256    boost::tokenizer<boost::escaped_list_separator<wchar_t>, std::wstring::const_iterator, std::wstring > tok(buffer, boost::escaped_list_separator<wchar_t>(_T(""), split, _T("\""))); 
     257    BOOST_FOREACH(std::wstring s, tok) 
     258      arglist.push_back(s); 
     259  } 
     260  return InjectSimpleCommand(command.c_str(), arglist, message, perf); 
     261} 
     262 
     263NSCAPI::nagiosReturn nscapi::core_wrapper::InjectNRPECommand(const std::wstring command, const std::wstring buffer, std::wstring & message, std::wstring & perf) { 
     264  if (!fNSAPIInject) 
     265    throw nscapi::nscapi_exception(_T("NSCore has not been initiated...")); 
     266  boost::tokenizer<boost::char_separator<wchar_t>, std::wstring::const_iterator, std::wstring > tok(buffer, boost::char_separator<wchar_t>(_T("!"))); 
    249267  std::list<std::wstring> arglist; 
    250268  BOOST_FOREACH(std::wstring s, tok) 
     
    252270  return InjectSimpleCommand(command.c_str(), arglist, message, perf); 
    253271} 
     272 
     273 
    254274/** 
    255275 * Ask the core to shutdown (only works when run as a service, o/w does nothing ? 
  • include/nscapi/nscapi_core_wrapper.hpp

    r1ecd26f r7443b58  
    139139    NSCAPI::nagiosReturn InjectSplitAndCommand(const wchar_t* command, wchar_t* buffer, wchar_t splitChar, std::wstring & message, std::wstring & perf); 
    140140    NSCAPI::nagiosReturn InjectSplitAndCommand(const std::wstring command, const std::wstring buffer, wchar_t splitChar, std::wstring & message, std::wstring & perf, bool escape = false); 
     141    NSCAPI::nagiosReturn InjectNRPECommand(const std::wstring command, const std::wstring buffer, std::wstring & message, std::wstring & perf); 
    141142    void StopService(void); 
    142143    void Exit(void); 
  • include/nscapi/nscapi_plugin_wrapper.hpp

    rc760fc9 r7443b58  
    232232        } 
    233233        std::wstring msg, perf; 
    234         NSCAPI::nagiosReturn ret = handleCommand(command.c_str(), args, msg, perf); 
     234        NSCAPI::nagiosReturn ret = handleCommand(command, args, msg, perf); 
    235235 
    236236        PluginCommand::ResponseMessage response_message; 
     
    251251      } 
    252252 
    253       virtual NSCAPI::nagiosReturn handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &msg, std::wstring &perf) = 0; 
     253      virtual NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &msg, std::wstring &perf) = 0; 
    254254    }; 
    255255 
  • include/settings/settings_old.hpp

    r569a179 r7443b58  
    8282    key_map keys_; 
    8383    void add_mapping(std::wstring path_new, std::wstring path_old) { 
    84       get_core()->get_logger()->debug(__FILE__, __LINE__, _T("Mapping: ") + path_new + _T(" to ") + path_old); 
    8584      sections_[path_new] = path_old; 
    8685    } 
     
    127126    virtual std::wstring get_real_string(settings_core::key_path_type key) { 
    128127      key = map_key(key); 
    129       get_core()->get_logger()->quick_debug(key.first + _T("//") + key.second); 
    130128      return internal_get_value(key.first, key.second); 
    131129    } 
     
    133131 
    134132    std::wstring internal_get_value(std::wstring path, std::wstring key, int bufferSize = 1024) { 
    135       get_core()->get_logger()->quick_debug(path + _T("//") + key); 
    136133      if (!has_key_int(path, key)) 
    137134        throw KeyNotFoundException(key); 
     
    192189      if (buffer == NULL) 
    193190        throw settings_exception(_T("internal_read_keys_from_section:: Failed to allocate memory for buffer!")); 
    194       unsigned int count = ::GetPrivateProfileSection(section.c_str(), buffer, bufferLength-2, get_file_name().c_str()); 
     191      unsigned int count = ::GetPrivateProfileSection(section.c_str(), buffer, bufferLength, get_file_name().c_str()); 
    195192      if (count == bufferLength-2) { 
    196193        delete [] buffer; 
     
    234231      try { 
    235232        key = map_key(key); 
    236         get_core()->get_logger()->quick_debug(key.first + _T("//") + key.second + _T("//") + value.get_string()); 
    237233        WritePrivateProfileString(key.first.c_str(), key.second.c_str(), value.get_string().c_str(), get_file_name().c_str()); 
    238234      } catch (settings_exception e) { 
     
    257253    /// @author mickem 
    258254    virtual void get_real_sections(std::wstring path, string_list &list) { 
    259       get_core()->get_logger()->debug(__FILE__, __LINE__, std::wstring(_T("Get sections for: ")) + path); 
    260  
    261255      unsigned int path_length = path.length(); 
    262256      //string_list lst = get_mapped_sections(path); 
     
    276270          if (pos != std::wstring::npos) 
    277271            key.first.first = key.first.first.substr(0,pos); 
    278           get_core()->get_logger()->debug(__FILE__, __LINE__, std::wstring(_T("Found: ")) + key.first.first); 
    279272          list.push_back(key.first.first); 
    280273        } else if (key.first.first.length() > path_length && path == key.first.first.substr(0, path_length)) { 
     
    333326          if (has_key_int(key.second.first, key.second.second)) 
    334327            list.push_back(key.first.second); 
    335         } else { 
    336           //get_core()->get_logger()->debug(__FILE__, __LINE__, std::wstring(_T("Found: TODO FOO fix sub sections")) + key.first.first); 
    337328        } 
    338329      } 
     
    341332        if (key.first == path) { 
    342333          section_cache_type::const_iterator it = section_cache_.find(key.second); 
    343           get_core()->get_logger()->debug(__FILE__, __LINE__, std::wstring(_T("=============>>>>>>>>>>>")) + key.first + _T(" >>>> ") + key.second); 
    344334          if (it == section_cache_.end()) { 
    345335            std::set<std::wstring> list = internal_read_keys_from_section(key.second); 
     
    355345 
    356346    void int_read_section(std::wstring section, string_list &list, unsigned int bufferLength = BUFF_LEN) { 
    357       //get_core()->get_logger()->debug(__FILE__, __LINE__, _T("Reading (OLD) section: ") + section); 
    358       // @TODO this is not correct! 
    359347      TCHAR* buffer = new TCHAR[bufferLength+1]; 
    360348      if (buffer == NULL) 
  • include/utils.h

    rf0e6036 r7443b58  
    3838 
    3939#define MAP_OPTIONS_DISK_ALL(obj, postfix, pfUpper, pfLower) \ 
    40       else if (p__.first == _T("MaxWarn") pfUpper) { obj.warn.max.upper = p__.second; } \ 
    41       else if (p__.first == _T("MaxCrit") pfUpper) { obj.crit.max.upper = p__.second; } \ 
    42       else if (p__.first == _T("MinWarn") pfUpper) { obj.warn.min.upper = p__.second; } \ 
    43       else if (p__.first == _T("MinCrit") pfUpper) { obj.crit.min.upper = p__.second; } \ 
    44       else if (p__.first == _T("MaxWarn") pfLower) { obj.warn.max.lower = p__.second; } \ 
    45       else if (p__.first == _T("MaxCrit") pfLower) { obj.crit.max.lower = p__.second; } \ 
    46       else if (p__.first == _T("MinWarn") pfLower) { obj.warn.min.lower = p__.second; } \ 
    47       else if (p__.first == _T("MinCrit") pfLower) { obj.crit.min.lower = p__.second; } \ 
    48       else if (p__.first == _T("MaxWarn") postfix) { obj.warn.max.lower = p__.second; } \ 
    49       else if (p__.first == _T("MaxCrit") postfix) { obj.crit.max.lower = p__.second; } \ 
    50       else if (p__.first == _T("MinWarn") postfix) { obj.warn.min.upper = p__.second; } \ 
    51       else if (p__.first == _T("MinCrit") postfix) { obj.crit.min.upper = p__.second; }  
     40      else if (p__.first == _T("MaxWarn") pfUpper) { obj.warn.max_.upper = p__.second; } \ 
     41      else if (p__.first == _T("MaxCrit") pfUpper) { obj.crit.max_.upper = p__.second; } \ 
     42      else if (p__.first == _T("MinWarn") pfUpper) { obj.warn.min_.upper = p__.second; } \ 
     43      else if (p__.first == _T("MinCrit") pfUpper) { obj.crit.min_.upper = p__.second; } \ 
     44      else if (p__.first == _T("MaxWarn") pfLower) { obj.warn.max_.lower = p__.second; } \ 
     45      else if (p__.first == _T("MaxCrit") pfLower) { obj.crit.max_.lower = p__.second; } \ 
     46      else if (p__.first == _T("MinWarn") pfLower) { obj.warn.min_.lower = p__.second; } \ 
     47      else if (p__.first == _T("MinCrit") pfLower) { obj.crit.min_.lower = p__.second; } \ 
     48      else if (p__.first == _T("MaxWarn") postfix) { obj.warn.max_.lower = p__.second; } \ 
     49      else if (p__.first == _T("MaxCrit") postfix) { obj.crit.max_.lower = p__.second; } \ 
     50      else if (p__.first == _T("MinWarn") postfix) { obj.warn.min_.upper = p__.second; } \ 
     51      else if (p__.first == _T("MinCrit") postfix) { obj.crit.min_.upper = p__.second; }  
    5252 
    5353#define MAP_OPTIONS_NUMERIC_ALL(obj, postfix) \ 
    54       else if (p__.first == (_T("MaxWarn") postfix)) { obj.warn.max = p__.second; } \ 
    55       else if (p__.first == (_T("MaxCrit") postfix)) { obj.crit.max = p__.second; } \ 
    56       else if (p__.first == (_T("MinWarn") postfix)) { obj.warn.min = p__.second; } \ 
    57       else if (p__.first == (_T("MinCrit") postfix)) { obj.crit.min = p__.second; } 
     54      else if (p__.first == (_T("MaxWarn") postfix)) { obj.warn.max_ = p__.second; } \ 
     55      else if (p__.first == (_T("MaxCrit") postfix)) { obj.crit.max_ = p__.second; } \ 
     56      else if (p__.first == (_T("MinWarn") postfix)) { obj.warn.min_ = p__.second; } \ 
     57      else if (p__.first == (_T("MinCrit") postfix)) { obj.crit.min_ = p__.second; } 
    5858 
    5959#define MAP_OPTIONS_EXACT_NUMERIC_ALL(obj, postfix) \ 
     
    7575#define MAP_OPTIONS_STR(value, obj) \ 
    7676      else if (p__.first == value) { obj = p__.second; } 
     77#define MAP_OPTIONS_DOUBLE(value, obj) \ 
     78      else if (p__.first == value) { obj = strEx::stod(p__.second); } 
     79 
    7780#define MAP_OPTIONS_STR2INT(value, obj) \ 
    7881      else if (p__.first == value) { obj = _wtoi(p__.second.c_str()); } 
  • modules/CheckDisk/CheckDisk.cpp

    r1f24a1c r7443b58  
    3131#include "file_finder.hpp" 
    3232#include "filter.hpp" 
     33#include <char_buffer.hpp> 
    3334 
    3435namespace sh = nscapi::settings_helper; 
     
    5051    get_core()->registerCommand(_T("CheckFileSize"), _T("Check or directory a file and verify its size.")); 
    5152    get_core()->registerCommand(_T("CheckDriveSize"), _T("Check the size (free-space) of a drive or volume.")); 
    52     get_core()->registerCommand(_T("CheckFile2"), _T("Check various aspects of a file and/or folder.")); 
     53    get_core()->registerCommand(_T("CheckFile2"), _T("(deprecated) Check various aspects of a file and/or folder.")); 
     54    get_core()->registerCommand(_T("CheckFiles"), _T("Check various aspects of a file and/or folder.")); 
    5355 
    5456    sh::settings_registry settings(get_settings_proxy()); 
     
    8890 
    8991 
     92class volume_helper { 
     93 
     94  typedef HANDLE (WINAPI *typeFindFirstVolumeW)( __out_ecount(cchBufferLength) LPWSTR lpszVolumeName, __in DWORD cchBufferLength); 
     95  typedef BOOL (WINAPI *typeFindNextVolumeW)( __inout HANDLE hFindVolume, __out_ecount(cchBufferLength) LPWSTR lpszVolumeName, __in DWORD cchBufferLength); 
     96  typedef HANDLE (WINAPI *typeFindFirstVolumeMountPointW)( __in LPCWSTR lpszRootPathName, __out_ecount(cchBufferLength) LPWSTR lpszVolumeMountPoint, __in DWORD cchBufferLength ); 
     97  typedef BOOL (WINAPI *typeGetVolumeNameForVolumeMountPointW)( __in LPCWSTR lpszVolumeMountPoint, __out_ecount(cchBufferLength) LPWSTR lpszVolumeName, __in DWORD cchBufferLength ); 
     98  typeFindFirstVolumeW ptrFindFirstVolumeW; 
     99  typeFindNextVolumeW ptrFindNextVolumeW; 
     100  typeFindFirstVolumeMountPointW ptrFindFirstVolumeMountPointW; 
     101  typeGetVolumeNameForVolumeMountPointW ptrGetVolumeNameForVolumeMountPointW; 
     102  HMODULE hLib; 
     103 
     104public: 
     105  typedef std::map<std::wstring,std::wstring> map_type; 
     106 
     107public: 
     108  volume_helper() : ptrFindFirstVolumeW(NULL) { 
     109    hLib = ::LoadLibrary(_TEXT("KERNEL32")); 
     110    if (hLib) { 
     111      // Find PSAPI functions 
     112      ptrFindFirstVolumeW = (typeFindFirstVolumeW)::GetProcAddress(hLib, "FindFirstVolumeW"); 
     113      ptrFindNextVolumeW = (typeFindNextVolumeW)::GetProcAddress(hLib, "FindNextVolumeW"); 
     114      ptrFindFirstVolumeMountPointW = (typeFindFirstVolumeMountPointW)::GetProcAddress(hLib, "FindFirstVolumeMountPointW"); 
     115      ptrGetVolumeNameForVolumeMountPointW = (typeGetVolumeNameForVolumeMountPointW)::GetProcAddress(hLib, "GetVolumeNameForVolumeMountPointW"); 
     116    } 
     117  } 
     118 
     119  ~volume_helper() { 
     120 
     121  } 
     122 
     123  HANDLE FindFirstVolume(std::wstring &volume) { 
     124    if (ptrFindFirstVolumeW == NULL) 
     125      return INVALID_HANDLE_VALUE; 
     126    char_buffer  buffer(1024); 
     127    HANDLE h = ptrFindFirstVolumeW(buffer.unsafe_get_buffer(), buffer.length()); 
     128    if (h != INVALID_HANDLE_VALUE) 
     129      volume = buffer.unsafe_get_buffer(); 
     130    return h; 
     131  } 
     132  BOOL FindNextVolume(HANDLE hVolume, std::wstring &volume) { 
     133    if (ptrFindFirstVolumeW == NULL || hVolume == INVALID_HANDLE_VALUE) 
     134      return FALSE; 
     135    char_buffer  buffer(1024); 
     136    BOOL r = ptrFindNextVolumeW(hVolume, buffer.unsafe_get_buffer(), buffer.length()); 
     137    if (r) 
     138      volume = buffer.unsafe_get_buffer(); 
     139    return r; 
     140  } 
     141 
     142  void getVolumeInformation(std::wstring volume, std::wstring &name) { 
     143    char_buffer volumeName(1024); 
     144    char_buffer fileSysName(1024); 
     145    DWORD maximumComponentLength, fileSystemFlags; 
     146 
     147    if (!GetVolumeInformation(volume.c_str(), volumeName.unsafe_get_buffer(), volumeName.length(),  
     148      NULL, &maximumComponentLength, &fileSystemFlags, fileSysName.unsafe_get_buffer(), fileSysName.length())) { 
     149        NSC_LOG_ERROR_STD(_T("Failed to get volume information: ") + volume); 
     150    } else { 
     151      name = volumeName.unsafe_get_buffer(); 
     152    } 
     153  } 
     154 
     155 
     156  bool GetVolumeNameForVolumeMountPoint(std::wstring volumeMountPoint, std::wstring &volumeName) { 
     157    char_buffer buffer(1024); 
     158    if (ptrGetVolumeNameForVolumeMountPointW(volumeMountPoint.c_str(), buffer.unsafe_get_buffer(), buffer.length())) { 
     159      volumeName = buffer; 
     160      return true; 
     161    } 
     162    return false; 
     163  } 
     164  std::wstring GetVolumeNameForVolumeMountPoint(std::wstring volumeMountPoint) { 
     165    std::wstring volumeName; 
     166    GetVolumeNameForVolumeMountPoint(volumeMountPoint, volumeName); 
     167    return volumeName; 
     168  } 
     169 
     170  map_type get_volumes(map_type alias) { 
     171    map_type ret; 
     172    std::wstring volume; 
     173    HANDLE hVol = FindFirstVolume(volume); 
     174    if (hVol == INVALID_HANDLE_VALUE) { 
     175      NSC_LOG_ERROR_STD(_T("Failed to enumerate volumes")); 
     176      return ret; 
     177    } 
     178    BOOL bFlag = TRUE; 
     179    while (bFlag) { 
     180      map_type::iterator it = alias.find(volume); 
     181      if (it != alias.end()) 
     182        ret[volume] = (*it).second; 
     183      else 
     184        ret[volume] = get_title(volume); 
     185      bFlag = FindNextVolume(hVol, volume); 
     186    } 
     187    return ret; 
     188  } 
     189 
     190  std::wstring get_title(std::wstring volume) { 
     191    std::wstring title; 
     192    getVolumeInformation(volume, title); 
     193    return title; 
     194  } 
     195 
     196 
     197}; 
    90198 
    91199 
     
    112220  std::list<DriveContainer> drives; 
    113221  std::wstring strCheckAll; 
     222  bool ignore_unreadable = false; 
     223  float magic = 0; 
    114224 
    115225  MAP_OPTIONS_BEGIN(args) 
     
    122232    MAP_OPTIONS_BOOL_VALUE(_T("FilterType"), bFilterRemote, _T("REMOTE")) 
    123233    MAP_OPTIONS_BOOL_VALUE(_T("FilterType"), bFilterNoRootDir, _T("NO_ROOT_DIR")) 
     234    MAP_OPTIONS_BOOL_TRUE(_T("ignore-unreadable"), ignore_unreadable) 
    124235    MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) 
    125236    MAP_OPTIONS_BOOL_TRUE(NSCLIENT, bNSClient) 
    126237    //MAP_OPTIONS_BOOL_TRUE(CHECK_ALL, bCheckAll) 
    127238    MAP_OPTIONS_STR(CHECK_ALL, strCheckAll) 
     239    MAP_OPTIONS_DOUBLE(_T("magic"), magic) 
    128240    MAP_OPTIONS_BOOL_TRUE(CHECK_ALL_OTHERS, bCheckAllOthers) 
    129241    MAP_OPTIONS_SECONDARY_BEGIN(_T(":"), p2) 
     
    143255 
    144256  if (strCheckAll == _T("volumes")) { 
     257    volume_helper helper; 
     258    volume_helper::map_type volume_alias; 
    145259 
    146260    DWORD bufSize = GetLogicalDriveStrings(0, NULL)+5; 
     
    149263      while (buffer[0] != 0) { 
    150264        std::wstring drv = buffer; 
    151  
    152         UINT drvType = GetDriveType(drv.c_str()); 
     265        volume_alias[helper.GetVolumeNameForVolumeMountPoint(drv)] = drv; 
     266        buffer = &buffer[drv.size()]; 
     267        buffer++; 
     268      } 
     269    } else { 
     270      NSC_LOG_ERROR_STD(_T("Failed to get buffer size: ") + error::lookup::last_error()); 
     271    } 
     272 
     273    volume_helper::map_type volumes = helper.get_volumes(volume_alias); 
     274    BOOST_FOREACH(volume_helper::map_type::value_type v, volumes) { 
     275      UINT drvType = GetDriveType(v.first.c_str()); 
    153276        if (  
    154277          ((!bFilter)&&(drvType == DRIVE_FIXED))  || 
     
    159282          ((bFilter)&&(bFilterNoRootDir)&&(drvType==DRIVE_NO_ROOT_DIR))  
    160283          ) 
    161           drives.push_back(DriveContainer(drv, tmpObject.warn, tmpObject.crit)); 
     284          drives.push_back(DriveContainer(v.first, v.second, tmpObject.warn, tmpObject.crit)); 
    162285        else 
    163           NSC_DEBUG_MSG_STD(_T("Ignoring drive: ") + drv); 
    164  
    165         buffer = &buffer[drv.size()]; 
    166         buffer++; 
    167       } 
    168     } else { 
    169       NSC_LOG_ERROR_STD(_T("Failed to get buffer size: ") + error::lookup::last_error()); 
     286        NSC_DEBUG_MSG_STD(_T("Ignoring drive: ") + v.second); 
    170287    } 
    171288  } 
     
    232349    drive.perfData = bPerfData; 
    233350    UINT drvType = GetDriveType(drive.data.c_str()); 
     351    std::wstring error; 
    234352 
    235353    if ((!bFilter)&&!((drvType == DRIVE_FIXED)||(drvType == DRIVE_NO_ROOT_DIR))) { 
     
    245363        message = _T("UNKNOWN: Drive does not match the current filter: ") + drive.getAlias() + _T(" (add FilterType=") + get_filter(drvType) + _T(" to check this drive)"); 
    246364        return NSCAPI::returnUNKNOWN; 
    247     } 
    248  
    249     ULARGE_INTEGER freeBytesAvailableToCaller; 
    250     ULARGE_INTEGER totalNumberOfBytes; 
    251     ULARGE_INTEGER totalNumberOfFreeBytes; 
    252     if (!GetDiskFreeSpaceEx(drive.data.c_str(), &freeBytesAvailableToCaller, &totalNumberOfBytes, &totalNumberOfFreeBytes)) { 
    253       message = _T("CRITICAL: Could not get free space for: ") + drive.getAlias() + _T(" ") + drive.data + _T(" reason: ") + error::lookup::last_error(); 
    254       return NSCAPI::returnCRIT; 
     365      } 
     366 
     367      ULARGE_INTEGER freeBytesAvailableToCaller; 
     368      ULARGE_INTEGER totalNumberOfBytes; 
     369      ULARGE_INTEGER totalNumberOfFreeBytes; 
     370      if (!GetDiskFreeSpaceEx(drive.data.c_str(), &freeBytesAvailableToCaller, &totalNumberOfBytes, &totalNumberOfFreeBytes)) { 
     371        DWORD err = GetLastError(); 
     372        if (!ignore_unreadable || err != ERROR_ACCESS_DENIED) { 
     373          message = _T("CRITICAL: Could not get free space for: ") + drive.getAlias() + _T(" ") + drive.data + _T(" reason: ") + error::lookup::last_error(err); 
     374        return NSCAPI::returnCRIT; 
     375      } 
     376      drive.setDefault(tmpObject); 
     377      error = drive.getAlias() + _T(": unreadable"); 
     378      freeBytesAvailableToCaller.QuadPart = 0; 
     379      totalNumberOfFreeBytes.QuadPart = 0; 
     380      totalNumberOfBytes.QuadPart = 0; 
    255381    } 
    256382 
     
    262388      message += strEx::itos(totalNumberOfBytes.QuadPart); 
    263389    } else { 
    264       checkHolders::PercentageValueType<checkHolders::disk_size_type, checkHolders::disk_size_type> value; 
    265       std::wstring tstr; 
    266       value.value = totalNumberOfBytes.QuadPart-totalNumberOfFreeBytes.QuadPart; 
    267       value.total = totalNumberOfBytes.QuadPart; 
    268       drive.setDefault(tmpObject); 
    269       drive.runCheck(value, returnCode, message, perf); 
     390      if (error.empty()) { 
     391        checkHolders::PercentageValueType<checkHolders::disk_size_type, checkHolders::disk_size_type> value; 
     392        std::wstring tstr; 
     393        value.value = totalNumberOfBytes.QuadPart-totalNumberOfFreeBytes.QuadPart; 
     394        value.total = totalNumberOfBytes.QuadPart; 
     395        drive.setDefault(tmpObject); 
     396        drive.set_magic(magic); 
     397        drive.runCheck(value, returnCode, message, perf); 
     398      } else { 
     399        strEx::append_list(message, error, _T(", ")); 
     400      } 
    270401    } 
    271402  } 
     
    308439    MAP_OPTIONS_STR_AND(_T("File"), tmpObject.data, paths.push_back(tmpObject)) 
    309440    MAP_OPTIONS_SHOWALL(tmpObject) 
    310     MAP_OPTIONS_STR(_T("MaxWarn"), tmpObject.warn.max) 
    311     MAP_OPTIONS_STR(_T("MinWarn"), tmpObject.warn.min) 
    312     MAP_OPTIONS_STR(_T("MaxCrit"), tmpObject.crit.max) 
    313     MAP_OPTIONS_STR(_T("MinCrit"), tmpObject.crit.min) 
     441    MAP_OPTIONS_STR(_T("MaxWarn"), tmpObject.warn.max_) 
     442    MAP_OPTIONS_STR(_T("MinWarn"), tmpObject.warn.min_) 
     443    MAP_OPTIONS_STR(_T("MaxCrit"), tmpObject.crit.max_) 
     444    MAP_OPTIONS_STR(_T("MinCrit"), tmpObject.crit.min_) 
    314445    MAP_OPTIONS_BOOL_TRUE(_T("debug"), debug) 
    315446    MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) 
     
    533664    return NSCAPI::returnUNKNOWN; 
    534665  } 
    535   //file_finder::file_filter_function_ex finder; 
    536666  file_finder::PathContainer tmpObject; 
    537667  std::list<std::wstring> paths; 
     
    634764 
    635765 
    636 NSCAPI::nagiosReturn CheckDisk::handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
    637   if (command == _T("CheckFileSize")) { 
     766NSCAPI::nagiosReturn CheckDisk::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
     767  if (command == _T("checkfilesize")) { 
    638768    return CheckFileSize(arguments, message, perf); 
    639   } else if (command == _T("CheckDriveSize")) { 
     769  } else if (command == _T("checkdrivesize")) { 
    640770    return CheckDriveSize(arguments, message, perf); 
    641   } else if (command == _T("CheckFiles")) { 
     771  } else if (command == _T("checkfiles")) { 
    642772    return CheckFiles(arguments, message, perf); 
    643   } else if (command == _T("CheckSingleFile")) { 
     773  } else if (command == _T("checksinglefile")) { 
    644774    return CheckSingleFile(arguments, message, perf); 
    645   } else if (command == _T("getFileAge")) { 
     775  } else if (command == _T("getfileage")) { 
    646776    return getFileAge(arguments, message, perf); 
    647777  }  
  • modules/CheckDisk/CheckDisk.h

    r1f24a1c r7443b58  
    5151  bool hasMessageHandler(); 
    5252  std::wstring get_filter(unsigned int drvType); 
    53   NSCAPI::nagiosReturn handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
     53  NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
    5454 
    5555  // Check commands 
     
    6161 
    6262private: 
    63   typedef checkHolders::CheckContainer<checkHolders::MaxMinPercentageBoundsDiskSize> DriveContainer; 
     63  typedef checkHolders::MagicCheckContainer<checkHolders::MaxMinPercentageBoundsDiskSize> DriveContainer; 
    6464}; 
  • modules/CheckEventLog/CheckEventLog.cpp

    r1f24a1c r7443b58  
    627627}; 
    628628 
    629 NSCAPI::nagiosReturn CheckEventLog::handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
    630   if (command != _T("CheckEventLog")) 
     629NSCAPI::nagiosReturn CheckEventLog::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
     630  if (command != _T("checkeventlog")) 
    631631    return NSCAPI::returnIgnored; 
    632632  simple_timer time; 
  • modules/CheckEventLog/CheckEventLog.h

    r5e12ba6 r7443b58  
    5757  bool hasCommandHandler(); 
    5858  bool hasMessageHandler(); 
    59   NSCAPI::nagiosReturn handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
     59  NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
    6060}; 
  • modules/CheckExternalScripts/CheckExternalScripts.cpp

    rc760fc9 r7443b58  
    136136 
    137137 
    138 NSCAPI::nagiosReturn CheckExternalScripts::handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
     138NSCAPI::nagiosReturn CheckExternalScripts::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
    139139  command_list::const_iterator cit = commands.find(command); 
    140140  bool isAlias = false; 
     
    151151    int i=1; 
    152152    BOOST_FOREACH(std::wstring str, arguments) { 
    153       if (isAlias || allowNasty_) { 
     153      if (!isAlias && !allowNasty_) { 
    154154        if (str.find_first_of(NASTY_METACHARS) != std::wstring::npos) { 
    155155          NSC_LOG_ERROR(_T("Request string contained illegal metachars!")); 
     
    157157        } 
    158158      } 
    159       strEx::replace(args, _T("$ARG") + strEx::itos(i) + _T("$"), str); 
     159      strEx::replace(args, _T("$ARG") + strEx::itos(i++) + _T("$"), str); 
    160160    } 
    161161  } 
    162162  if (isAlias) { 
    163     return GET_CORE()->InjectSplitAndCommand(cd.command, args, ' ', message, perf, true); 
     163    try { 
     164      return GET_CORE()->InjectSplitAndCommand(cd.command, args, ' ', message, perf, true); 
     165    } catch (boost::escaped_list_error &e) { 
     166      NSC_LOG_MESSAGE(_T("Failed to parse alias expression: ") + strEx::string_to_wstring(e.what())); 
     167      NSC_LOG_MESSAGE(_T("We will now try parsing the old syntax instead...")); 
     168      return GET_CORE()->InjectSplitAndCommand(cd.command, args, ' ', message, perf, false); 
     169    } 
    164170  } else { 
    165171    int result = process::executeProcess(process::exec_arguments(root_, cd.command + _T(" ") + args, timeout), message, perf); 
  • modules/CheckExternalScripts/CheckExternalScripts.h

    r497b779 r7443b58  
    3636    } 
    3737  }; 
    38   typedef std::map<strEx::wci_string, command_data> command_list; 
     38  typedef std::map<std::wstring, command_data> command_list; 
    3939  command_list commands; 
    4040  command_list alias; 
     
    6868  bool hasCommandHandler(); 
    6969  bool hasMessageHandler(); 
    70   NSCAPI::nagiosReturn handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
     70  NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
    7171  std::wstring getConfigurationMeta(); 
    7272 
  • modules/CheckHelpers/CheckHelpers.cpp

    r1ecd26f r7443b58  
    8282} 
    8383 
    84 NSCAPI::nagiosReturn CheckHelpers::handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
     84NSCAPI::nagiosReturn CheckHelpers::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
    8585  if (command == _T("checkversion")) { 
    8686    message = GET_CORE()->getApplicationVersionString(); 
  • modules/CheckHelpers/CheckHelpers.h

    r1ecd26f r7443b58  
    4848  bool hasCommandHandler(); 
    4949  bool hasMessageHandler(); 
    50   NSCAPI::nagiosReturn handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
     50  NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
    5151 
    5252  // Check commands 
  • modules/CheckNSCP/CheckNSCP.cpp

    rc760fc9 r7443b58  
    145145} 
    146146 
    147 NSCAPI::nagiosReturn CheckNSCP::handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
     147NSCAPI::nagiosReturn CheckNSCP::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
    148148  if (command == _T("check_nscp")) { 
    149149    return check_nscp(arguments, message, perf); 
  • modules/CheckNSCP/CheckNSCP.h

    rc760fc9 r7443b58  
    5151  bool hasMessageHandler(); 
    5252  void handleMessage(int msgType, const std::string file, int line, std::string message); 
    53   NSCAPI::nagiosReturn handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
     53  NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
    5454  std::string render(int msgType, const std::string file, int line, std::string message); 
    5555  NSCAPI::nagiosReturn check_nscp( std::list<std::wstring> arguments, std::wstring & msg, std::wstring & perf ); 
  • modules/CheckSystem/CheckSystem.cpp

    rc760fc9 r7443b58  
    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; 
    6869  try { 
     70    typedef std::map<std::wstring,std::wstring> counter_map_type; 
    6971    std::map<std::wstring,std::wstring> service_mappings; 
    70     bool default_counters; 
     72    std::map<std::wstring,std::wstring> counters; 
     73    bool default_counters = true; 
    7174 
    7275    sh::settings_registry settings(get_settings_proxy()); 
     
    8184      (_T("pdh"), _T("PDH COUNTER INFORMATION"), _T("")) 
    8285 
    83       //(_T("pdh/counter"), _T("PDH COUNTERS"), _T("")) 
     86      (_T("pdh/counters"), sh::wstring_map_path(&counters) 
     87      , _T("PDH COUNTERS"), _T("")) 
    8488 
    8589      ; 
     
    8791 
    8892    settings.alias().add_key_to_settings() 
    89       (_T("default"), sh::bool_key(&default_counters), 
     93      (_T("default"), sh::bool_key(&default_counters, true), 
    9094      _T("HOSTNAME"), _T("The host name of this host if set to blank (default) the windows name of the computer will be used.")) 
    9195//  
     
    113117    typedef PDHCollector::system_counter_data::counter cnt; 
    114118    if (default_counters) { 
    115       data->counters.push_back(cnt(_T("cpu load"), _T("\\238(_total)\\6"), cnt::type_int64, cnt::format_large, cnt::rrd)); 
    116       data->counters.push_back(cnt(_T("memory commit bytes"), _T("\\4\26"), cnt::type_int64, cnt::format_large, cnt::value)); 
    117       data->counters.push_back(cnt(_T("memory commit limit"), _T("\\4\\30"), cnt::type_int64, cnt::format_large, cnt::value)); 
    118       data->counters.push_back(cnt(_T("uptime"), _T("\\2\\674"), cnt::type_int64, cnt::format_large, cnt::value)); 
     119      data->counters.push_back(cnt(PDH_SYSTEM_KEY_CPU, _T("\\238(_total)\\6"), cnt::type_int64, cnt::format_large, cnt::rrd)); 
     120      data->counters.push_back(cnt(PDH_SYSTEM_KEY_MCB, _T("\\4\\26"), cnt::type_int64, cnt::format_large, cnt::value)); 
     121      data->counters.push_back(cnt(PDH_SYSTEM_KEY_MCL, _T("\\4\\30"), cnt::type_int64, cnt::format_large, cnt::value)); 
     122      data->counters.push_back(cnt(PDH_SYSTEM_KEY_UPT, _T("\\2\\674"), cnt::type_int64, cnt::format_large, cnt::value)); 
     123    } 
     124    BOOST_FOREACH(counter_map_type::value_type c, counters) { 
     125      data->counters.push_back(cnt(c.first, c.second, cnt::type_int64, cnt::format_large, cnt::value)); 
    119126    } 
    120127 
     
    388395 * @return  
    389396 */ 
    390 NSCAPI::nagiosReturn CheckSystem::handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &msg, std::wstring &perf) { 
     397NSCAPI::nagiosReturn CheckSystem::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &msg, std::wstring &perf) { 
    391398  CheckSystem::returnBundle rb; 
    392   if (command == _T("checkCPU")) { 
     399  if (command == _T("checkcpu")) { 
    393400    return checkCPU(arguments, msg, perf); 
    394   } else if (command == _T("checkUpTime")) { 
     401  } else if (command == _T("checkuptime")) { 
    395402    return checkUpTime(arguments, msg, perf); 
    396   } else if (command == _T("checkServiceState")) { 
     403  } else if (command == _T("checkservicestate")) { 
    397404    return checkServiceState(arguments, msg, perf); 
    398   } else if (command == _T("checkProcState")) { 
     405  } else if (command == _T("checkprocstate")) { 
    399406    return checkProcState(arguments, msg, perf); 
    400   } else if (command == _T("checkMem")) { 
     407  } else if (command == _T("checkmem")) { 
    401408    return checkMem(arguments, msg, perf); 
    402   } else if (command == _T("checkCounter")) { 
     409  } else if (command == _T("checkcounter")) { 
    403410    return checkCounter(arguments, msg, perf); 
    404   } else if (command == _T("listCounterInstances")) { 
     411  } else if (command == _T("listcounterinstances")) { 
    405412    return listCounterInstances(arguments, msg, perf); 
    406   } else if (command == _T("checkSingleRegEntry")) { 
     413  } else if (command == _T("checksingleregentry")) { 
    407414    return checkSingleRegEntry(arguments, msg, perf); 
    408415  } 
     
    459466  MAP_OPTIONS_BEGIN(arguments) 
    460467    MAP_OPTIONS_NUMERIC_ALL(tmpObject, _T("")) 
    461     MAP_OPTIONS_STR(_T("warn"), tmpObject.warn.max) 
    462     MAP_OPTIONS_STR(_T("crit"), tmpObject.crit.max) 
     468    MAP_OPTIONS_STR(_T("warn"), tmpObject.warn.max_) 
     469    MAP_OPTIONS_STR(_T("crit"), tmpObject.crit.max_) 
    463470    MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) 
    464471    MAP_OPTIONS_STR_AND(_T("time"), tmpObject.data, list.push_back(tmpObject)) 
     
    523530  MAP_OPTIONS_BEGIN(arguments) 
    524531    MAP_OPTIONS_NUMERIC_ALL(bounds, _T("")) 
    525     MAP_OPTIONS_STR(_T("warn"), bounds.warn.min) 
    526     MAP_OPTIONS_STR(_T("crit"), bounds.crit.min) 
     532    MAP_OPTIONS_STR(_T("warn"), bounds.warn.min_) 
     533    MAP_OPTIONS_STR(_T("crit"), bounds.crit.min_) 
    527534    MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) 
    528535    MAP_OPTIONS_STR(_T("Alias"), bounds.data) 
     
    891898      key = (*entry).command_line; 
    892899    else 
    893       key = (*entry).filename; 
     900      key = boost::to_lower_copy((*entry).filename); 
    894901    NSPROCLST::iterator it = ret.find(key); 
    895902    if (it == ret.end()) { 
     
    10981105    MAP_OPTIONS_STR(_T("InvalidStatus"), invalidStatus) 
    10991106    MAP_OPTIONS_STR_AND(_T("Counter"), tmpObject.data, counters.push_back(tmpObject)) 
    1100     MAP_OPTIONS_STR(_T("MaxWarn"), tmpObject.warn.max) 
    1101     MAP_OPTIONS_STR(_T("MinWarn"), tmpObject.warn.min) 
    1102     MAP_OPTIONS_STR(_T("MaxCrit"), tmpObject.crit.max) 
    1103     MAP_OPTIONS_STR(_T("MinCrit"), tmpObject.crit.min) 
     1107    MAP_OPTIONS_STR(_T("MaxWarn"), tmpObject.warn.max_) 
     1108    MAP_OPTIONS_STR(_T("MinWarn"), tmpObject.warn.min_) 
     1109    MAP_OPTIONS_STR(_T("MaxCrit"), tmpObject.crit.max_) 
     1110    MAP_OPTIONS_STR(_T("MinCrit"), tmpObject.crit.min_) 
    11041111    MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) 
    11051112    MAP_OPTIONS_STR(_T("Alias"), tmpObject.data) 
     
    11291136    CounterContainer counter = (*cit); 
    11301137    try { 
    1131       std::wstring tstr; 
    1132       if (bExpandIndex) { 
    1133         PDH::PDHResolver::expand_index(counter.data); 
    1134       } 
    1135       if (!PDH::PDHResolver::validate(counter.data, tstr, bForceReload)) { 
    1136         NSC_LOG_ERROR_STD(_T("ERROR: Counter not found: ") + counter.data + _T(": ") + tstr); 
    1137         if (bNSClient) { 
     1138 
     1139 
     1140      double value  = 0; 
     1141      if (counter.data.find('\\') == std::wstring::npos) { 
     1142        PDHCollector *pObject = pdhThread.getThread(); 
     1143        if (!pObject) { 
     1144          msg = _T("ERROR: PDH Collection thread not running."); 
     1145          return NSCAPI::returnUNKNOWN; 
     1146        } 
     1147        value = pObject->get_double(counter.data); 
     1148        if (value == -1) { 
     1149          msg = _T("ERROR: Failed to get counter value: ") + counter.data; 
     1150          return NSCAPI::returnUNKNOWN; 
     1151        } 
     1152      } else { 
     1153        std::wstring tstr; 
     1154        if (bExpandIndex) { 
     1155          PDH::PDHResolver::expand_index(counter.data); 
     1156        } 
     1157        if (!PDH::PDHResolver::validate(counter.data, tstr, bForceReload)) { 
    11381158          NSC_LOG_ERROR_STD(_T("ERROR: Counter not found: ") + counter.data + _T(": ") + tstr); 
    1139           //msg = _T("0"); 
    1140         } else { 
    1141           msg = _T("CRIT: Counter not found: ") + counter.data + _T(": ") + tstr; 
    1142           return NSCAPI::returnCRIT; 
     1159          if (bNSClient) { 
     1160            NSC_LOG_ERROR_STD(_T("ERROR: Counter not found: ") + counter.data + _T(": ") + tstr); 
     1161            //msg = _T("0"); 
     1162          } else { 
     1163            msg = _T("CRIT: Counter not found: ") + counter.data + _T(": ") + tstr; 
     1164            return NSCAPI::returnCRIT; 
     1165          } 
    11431166        } 
    1144       } 
    1145       PDH::PDHQuery pdh; 
    1146       typedef boost::shared_ptr<PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE> > ptr_lsnr_type; 
    1147       ptr_lsnr_type cDouble(new PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE>()); 
    1148       //boost::shared_ptr<PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE> > cDouble; 
    1149       pdh.addCounter(counter.data, cDouble); 
    1150       pdh.open(); 
    1151       if (bCheckAverages) { 
    1152         pdh.collect(); 
    1153         Sleep(1000); 
    1154       } 
    1155       pdh.gatherData(); 
    1156       pdh.close(); 
    1157       double value = cDouble->getValue(); 
     1167        PDH::PDHQuery pdh; 
     1168        typedef boost::shared_ptr<PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE> > ptr_lsnr_type; 
     1169        ptr_lsnr_type cDouble(new PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE>()); 
     1170        //boost::shared_ptr<PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE> > cDouble; 
     1171        pdh.addCounter(counter.data, cDouble); 
     1172        pdh.open(); 
     1173        if (bCheckAverages) { 
     1174          pdh.collect(); 
     1175          Sleep(1000); 
     1176        } 
     1177        pdh.gatherData(); 
     1178        pdh.close(); 
     1179        value = cDouble->getValue(); 
     1180      } 
     1181 
     1182 
    11581183      if (bNSClient) { 
    11591184        if (!msg.empty()) 
  • modules/CheckSystem/CheckSystem.h

    r5e12ba6 r7443b58  
    7676  bool hasCommandHandler(); 
    7777  bool hasMessageHandler(); 
    78   NSCAPI::nagiosReturn handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
     78  NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
    7979  int commandLineExec(const TCHAR* command,const unsigned int argLen,TCHAR** args); 
    8080 
  • modules/CheckSystem/PDHCollector.cpp

    r5e12ba6 r7443b58  
    2323 
    2424 
    25 PDHCollector::PDHCollector() : hStopEvent_(NULL), data_(NULL) { 
     25PDHCollector::PDHCollector() : hStopEvent_(NULL)/*, data_(NULL)*/ { 
    2626  std::wstring subsystem = SETTINGS_GET_STRING(check_system::PDH_SUBSYSTEM); 
    2727  if (subsystem == setting_keys::check_system::PDH_SUBSYSTEM_FAST) { 
     
    3737  if (hStopEvent_) 
    3838    CloseHandle(hStopEvent_); 
    39   delete data_; 
    40 } 
    41  
    42 boost::shared_ptr<PDHCollectors::PDHCollector> PDHCollector::system_counter_data::counter::get_counter(int check_intervall) { 
     39//  delete data_; 
     40} 
     41 
     42boost::shared_ptr<PDHCollectors::PDHCollector> PDHCollector::system_counter_data::counter::create(int check_intervall) { 
    4343  if (data_type == type_uint64 && data_format == format_large && collection_strategy == value) { 
    4444    return boost::shared_ptr<PDHCollectors::PDHCollector>(new PDHCollectors::StaticPDHCounterListener<unsigned __int64, PDHCollectors::format_large, PDHCollectors::PDHCounterNormalMutex>); 
     
    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_length(check_intervall))); 
     48    return boost::shared_ptr<PDHCollectors::PDHCollector>(new PDHCollectors::RoundINTPDHBufferListener<__int64, PDHCollectors::format_large, PDHCollectors::PDHCounterNormalMutex>(get_buffer_length(check_intervall))); 
    4949  } 
    5050  return boost::shared_ptr<PDHCollectors::PDHCollector>(); 
     
    7373  } 
    7474 
    75   data_ = reinterpret_cast<system_counter_data*>(lpParameter); 
    76  
     75  system_counter_data *data = reinterpret_cast<system_counter_data*>(lpParameter); 
     76 
     77  check_intervall_ = data->check_intervall; 
    7778  PDH::PDHQuery pdh; 
    7879  bool bInit = true; 
    7980 
    8081  { 
     82    SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT)); 
    8183    WriteLock lock(&mutex_, true, 5000); 
    8284    if (!lock.IsLocked()) { 
     
    8688      pdh.removeAllCounters(); 
    8789      NSC_DEBUG_MSG_STD(_T("Loading counters...")); 
    88       BOOST_FOREACH(system_counter_data::counter c, data_->counters) { 
    89         NSC_DEBUG_MSG_STD(_T("Loading counter: ") + c.alias + _T(" = ") + c.path); 
    90         collector_ptr collector = c.get_counter(data_->check_intervall); 
    91         if (collector) { 
    92           counters_[c.alias] = collector; 
    93           pdh.addCounter(c.path, collector); 
    94         } else { 
    95           NSC_LOG_ERROR_STD(_T("Failed to load counter: ") + c.alias + _T(" = ") + c.path); 
     90      BOOST_FOREACH(system_counter_data::counter c, data->counters) { 
     91        try { 
     92          NSC_DEBUG_MSG_STD(_T("Loading counter: ") + c.alias + _T(" = ") + c.path); 
     93          collector_ptr collector = c.create(check_intervall_); 
     94          if (collector) { 
     95            counters_[c.alias] = collector; 
     96            pdh.addCounter(c.path, collector); 
     97          } else { 
     98            NSC_LOG_ERROR_STD(_T("Failed to load counter: ") + c.alias + _T(" = ") + c.path); 
     99          } 
     100        } catch (...) { 
     101          NSC_LOG_ERROR_STD(_T("EXCEPTION: Failed to load counter: ") + c.alias + _T(" = ") + c.path); 
    96102        } 
    97103      } 
    98       //SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT)); 
    99 //      pdh.addCounter(SETTINGS_GET_STRING(check_system::PDH_MEM_CMT_LIM), &memCmtLim); 
    100 //      pdh.addCounter(SETTINGS_GET_STRING(check_system::PDH_MEM_CMT_BYT), &memCmt); 
    101 //      pdh.addCounter(SETTINGS_GET_STRING(check_system::PDH_SYSUP), &upTime); 
    102 //      pdh.addCounter(SETTINGS_GET_STRING(check_system::PDH_CPU), &cpu); 
    103104      try { 
    104105        pdh.open(); 
     
    109110    } 
    110111  } 
     112  data = NULL; 
     113  delete data; 
    111114 
    112115  DWORD waitStatus = 0; 
     
    137140        NSC_LOG_ERROR_STD(*cit); 
    138141      } 
    139     } while (((waitStatus = WaitForSingleObject(hStopEvent_, data_->check_intervall*100)) == WAIT_TIMEOUT)); 
     142    } while (((waitStatus = WaitForSingleObject(hStopEvent_, check_intervall_*100)) == WAIT_TIMEOUT)); 
    140143  } else { 
    141144    NSC_LOG_ERROR_STD(_T("No performance counters were found we will not wait for the end instead...")); 
     
    179182} 
    180183 
     184double PDHCollector::get_avg_value(std::wstring counter, unsigned int delta) { 
     185  ReadLock lock(&mutex_, true, 5000); 
     186  if (!lock.IsLocked())  { 
     187    NSC_LOG_ERROR(_T("Failed to get Mutex for: ") + counter); 
     188    return 0; 
     189  } 
     190 
     191  counter_map::iterator it = counters_.find(counter); 
     192  if (it == counters_.end()) 
     193    return 0; 
     194  collector_ptr ptr = (*it).second; 
     195  return ptr->get_average(delta); 
     196} 
     197 
    181198 
    182199/** 
     
    196213*/ 
    197214int PDHCollector::getCPUAvrage(std::wstring time) { 
    198   unsigned int mseconds = strEx::stoui_as_time(time, 100); 
    199   ReadLock lock(&mutex_, true, 5000); 
    200   if (!lock.IsLocked()) { 
    201     NSC_LOG_ERROR(_T("Failed to get Mutex!")); 
    202     return -1; 
    203   } 
    204   try { 
    205     return static_cast<int>(cpu.getAvrage(mseconds / (100))); 
     215  int frequency; 
     216  { 
     217    ReadLock lock(&mutex_, true, 5000); 
     218    if (!lock.IsLocked()) { 
     219      NSC_LOG_ERROR(_T("Failed to get Mutex!")); 
     220      return -1; 
     221    } 
     222    frequency = check_intervall_*100; 
     223 
     224  } 
     225  try { 
     226    unsigned int mseconds = strEx::stoui_as_time(time, frequency); 
     227    return static_cast<int>(get_avg_value(PDH_SYSTEM_KEY_CPU, mseconds/frequency)); 
    206228  } catch (PDHCollectors::PDHException &e) { 
    207229    NSC_LOG_ERROR(_T("Failed to get CPU value: ") + e.getError()); 
     
    219241*/ 
    220242long long PDHCollector::getUptime() { 
     243  try { 
     244    return get_int_value(PDH_SYSTEM_KEY_UPT); 
     245  } catch (PDHCollectors::PDHException &e) { 
     246    NSC_LOG_ERROR(_T("Failed to get UPTIME value: ") + e.getError()); 
     247    return -1; 
     248  } catch (...) { 
     249    NSC_LOG_ERROR(_T("Failed to get UPTIME value")); 
     250    return -1; 
     251  } 
     252} 
     253/** 
     254* Memory commit limit (your guess is as good as mine to what this is :) 
     255* @return Some form of memory check 
     256*/ 
     257unsigned long long PDHCollector::getMemCommitLimit() { 
     258  try { 
     259    return get_int_value(PDH_SYSTEM_KEY_MCL); 
     260  } catch (PDHCollectors::PDHException &e) { 
     261    NSC_LOG_ERROR(_T("Failed to get MEM_CMT_LIMIT value: ") + e.getError()); 
     262    return -1; 
     263  } catch (...) { 
     264    NSC_LOG_ERROR(_T("Failed to get MEM_CMT_LIMIT value")); 
     265    return -1; 
     266  } 
     267} 
     268/** 
     269* 
     270* Memory committed bytes (your guess is as good as mine to what this is :) 
     271* @return Some form of memory check 
     272*/ 
     273unsigned long long PDHCollector::getMemCommit() { 
     274  try { 
     275    return get_int_value(PDH_SYSTEM_KEY_MCB); 
     276  } catch (PDHCollectors::PDHException &e) { 
     277    NSC_LOG_ERROR(_T("Failed to get MEM_CMT value: ") + e.getError()); 
     278    return -1; 
     279  } catch (...) { 
     280    NSC_LOG_ERROR(_T("Failed to get MEM_CMT value")); 
     281    return -1; 
     282  } 
     283} 
     284 
     285double PDHCollector::get_double(std::wstring counter) { 
    221286  ReadLock lock(&mutex_, true, 5000); 
    222287  if (!lock.IsLocked()) { 
     
    225290  } 
    226291  try { 
    227     return upTime.getValue(); 
    228   } catch (PDHCollectors::PDHException &e) { 
    229     NSC_LOG_ERROR(_T("Failed to get UPTIME value: ") + e.getError()); 
    230     return -1; 
    231   } catch (...) { 
    232     NSC_LOG_ERROR(_T("Failed to get UPTIME value")); 
    233     return -1; 
    234   } 
    235 } 
    236 /** 
    237 * Memory commit limit (your guess is as good as mine to what this is :) 
    238 * @return Some form of memory check 
    239 */ 
    240 unsigned long long PDHCollector::getMemCommitLimit() { 
    241   ReadLock lock(&mutex_, true, 5000); 
    242   if (!lock.IsLocked()) { 
    243     NSC_LOG_ERROR(_T("Failed to get Mutex!")); 
    244     return -1; 
    245   } 
    246   try { 
    247     return memCmtLim.getValue(); 
    248   } catch (PDHCollectors::PDHException &e) { 
    249     NSC_LOG_ERROR(_T("Failed to get MEM_CMT_LIMIT value: ") + e.getError()); 
    250     return -1; 
    251   } catch (...) { 
    252     NSC_LOG_ERROR(_T("Failed to get MEM_CMT_LIMIT value")); 
    253     return -1; 
    254   } 
    255 } 
    256 /** 
    257 * 
    258 * Memory committed bytes (your guess is as good as mine to what this is :) 
    259 * @return Some form of memory check 
    260 */ 
    261 unsigned long long PDHCollector::getMemCommit() { 
    262   ReadLock lock(&mutex_, true, 5000); 
    263   if (!lock.IsLocked()) { 
    264     NSC_LOG_ERROR(_T("Failed to get Mutex!")); 
    265     return -1; 
    266   } 
    267   try { 
    268     return memCmt.getValue(); 
    269   } catch (PDHCollectors::PDHException &e) { 
    270     NSC_LOG_ERROR(_T("Failed to get MEM_CMT value: ") + e.getError()); 
    271     return -1; 
    272   } catch (...) { 
    273     NSC_LOG_ERROR(_T("Failed to get MEM_CMT value")); 
    274     return -1; 
    275   } 
    276 } 
     292    counter_map::iterator it = counters_.find(counter); 
     293    if (it == counters_.end()) { 
     294      NSC_LOG_ERROR(_T("COunter not found: ") + counter); 
     295      return -1; 
     296    } 
     297    return (*it).second->get_double(); 
     298  } catch (PDHCollectors::PDHException &e) { 
     299    NSC_LOG_ERROR(_T("Failed to get double value: ") + e.getError()); 
     300    return -1; 
     301  } catch (...) { 
     302    NSC_LOG_ERROR(_T("Failed to get double value")); 
     303    return -1; 
     304  } 
     305} 
  • modules/CheckSystem/PDHCollector.h

    r5e12ba6 r7443b58  
    2626#include <boost/unordered_map.hpp> 
    2727#include <boost/shared_ptr.hpp> 
     28 
     29 
     30#define PDH_SYSTEM_KEY_CPU _T("cpu") 
     31#define PDH_SYSTEM_KEY_MCB _T("memory commit bytes") 
     32#define PDH_SYSTEM_KEY_MCL _T("memory commit limit") 
     33#define PDH_SYSTEM_KEY_UPT _T("uptime") 
     34 
    2835 
    2936/** 
     
    7380      std::wstring alias; 
    7481      std::wstring path; 
     82      std::wstring buffer_size; 
    7583      collection_strategy_struct collection_strategy; 
    76       std::wstring buffer_size; 
    7784 
    78       boost::shared_ptr<PDHCollectors::PDHCollector> get_counter(int check_intervall); 
     85      boost::shared_ptr<PDHCollectors::PDHCollector> create(int check_intervall); 
    7986 
    80       int get_length(int check_intervall) { 
    81         unsigned int i = strEx::stoui_as_time(buffer_size, check_intervall*100); 
    82         if (check_intervall == 0) 
     87      int get_buffer_length(int check_intervall) { 
     88        try { 
     89          unsigned int i = strEx::stoui_as_time(buffer_size, check_intervall*100); 
     90          if (check_intervall == 0) 
     91            return 100; // TODO fix this! 
     92          return i/(check_intervall*100)+10; 
     93        } catch (...) { 
    8394          return 100; // TODO fix this! 
    84         return i/(check_intervall*100)+10; 
     95        } 
     96 
    8597      } 
    8698 
    87       //      PDHCollectors::StaticPDHCounterListener<unsigned __int64, PDHCollectors::format_large, PDHCollectors::PDHCounterNormalMutex> memCmtLim; 
    88       //      PDHCollectors::StaticPDHCounterListener<unsigned __int64, PDHCollectors::format_large, PDHCollectors::PDHCounterNormalMutex> memCmt; 
    89       //      PDHCollectors::StaticPDHCounterListener<__int64, PDHCollectors::format_large, PDHCollectors::PDHCounterNormalMutex> upTime; 
    90       //      PDHCollectors::RoundINTPDHBufferListener<__int64, PDHCollectors::format_large, PDHCollectors::PDHCounterNormalMutex> cpu; 
    9199 
    92100    }; 
     
    99107private: 
    100108 
    101   system_counter_data *data_; 
     109  //system_counter_data *data_; 
    102110  MutexRW mutex_; 
    103111  HANDLE hStopEvent_; 
     
    105113  typedef boost::unordered_map<std::wstring,collector_ptr > counter_map; 
    106114  counter_map counters_; 
    107 //  int checkIntervall_; 
    108 //  bool dontCollect_; 
    109  
    110   PDHCollectors::StaticPDHCounterListener<unsigned __int64, PDHCollectors::format_large, PDHCollectors::PDHCounterNormalMutex> memCmtLim; 
    111   PDHCollectors::StaticPDHCounterListener<unsigned __int64, PDHCollectors::format_large, PDHCollectors::PDHCounterNormalMutex> memCmt; 
    112   PDHCollectors::StaticPDHCounterListener<__int64, PDHCollectors::format_large, PDHCollectors::PDHCounterNormalMutex> upTime; 
    113   PDHCollectors::RoundINTPDHBufferListener<__int64, PDHCollectors::format_large, PDHCollectors::PDHCounterNormalMutex> cpu; 
     115  int check_intervall_; 
    114116 
    115117public: 
     
    127129 
    128130  __int64 get_int_value(std::wstring counter); 
    129  
    130  
    131 private: 
    132 //  bool isRunning(void); 
    133 //  void startRunning(void); 
    134 //  void stopRunning(void); 
    135  
     131  double get_avg_value(std::wstring counter, unsigned int delta); 
     132  double get_double(std::wstring counter); 
    136133}; 
    137134 
  • modules/CheckTaskSched/CheckTaskSched.cpp

    r1f24a1c r7443b58  
    141141} 
    142142 
    143 NSCAPI::nagiosReturn CheckTaskSched::handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
    144   if (command == _T("CheckTaskSched")) 
     143NSCAPI::nagiosReturn CheckTaskSched::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
     144  if (command == _T("checktasksched")) 
    145145    return TaskSchedule(arguments, message, perf); 
    146146  return NSCAPI::returnIgnored; 
  • modules/CheckTaskSched/CheckTaskSched.h

    r1ecd26f r7443b58  
    5151  bool hasCommandHandler(); 
    5252  bool hasMessageHandler(); 
    53   NSCAPI::nagiosReturn handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
     53  NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
    5454  int CheckTaskSched::commandLineExec(const TCHAR* command,const unsigned int argLen,TCHAR** args); 
    5555 
  • modules/CheckTaskSched2/CheckTaskSched2.cpp

    r4c18192 r7443b58  
    141141} 
    142142 
    143 NSCAPI::nagiosReturn CheckTaskSched2::handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
    144   if (command == _T("CheckTaskSched")) 
     143NSCAPI::nagiosReturn CheckTaskSched2::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
     144  if (command == _T("checktasksched")) 
    145145    return TaskSchedule(arguments, message, perf); 
    146146  return NSCAPI::returnIgnored; 
  • modules/CheckTaskSched2/CheckTaskSched2.h

    r4c18192 r7443b58  
    5151  bool hasCommandHandler(); 
    5252  bool hasMessageHandler(); 
    53   NSCAPI::nagiosReturn handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
     53  NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
    5454  int commandLineExec(const TCHAR* command,const unsigned int argLen,TCHAR** args); 
    5555 
  • modules/CheckWMI/CheckWMI.cpp

    r1ecd26f r7443b58  
    264264 
    265265 
    266 NSCAPI::nagiosReturn CheckWMI::handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
    267   if (command == _T("CheckWMI")) { 
     266NSCAPI::nagiosReturn CheckWMI::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
     267  if (command == _T("checkwmi")) { 
    268268    return CheckSimpleWMI(arguments, message, perf); 
    269   } else if (command == _T("CheckWMIValue")) { 
     269  } else if (command == _T("checkwmivalue")) { 
    270270    return CheckSimpleWMIValue(arguments, message, perf); 
    271271  }  
  • modules/CheckWMI/CheckWMI.h

    r1ecd26f r7443b58  
    5050  bool hasCommandHandler(); 
    5151  bool hasMessageHandler(); 
    52   NSCAPI::nagiosReturn handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
     52  NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
    5353  int CheckWMI::commandLineExec(const TCHAR* command,const unsigned int argLen,TCHAR** args); 
    5454 
  • modules/LUAScript/LUAScript.cpp

    rc760fc9 r7443b58  
    8080void LUAScript::register_command(script_wrapper::lua_script* script, std::wstring command, std::wstring function) { 
    8181  NSC_LOG_MESSAGE(_T("Script loading: ") + script->get_script() + _T(": ") + command); 
    82   strEx::wci_string bstr = command.c_str(); 
    83   commands_[bstr] = lua_func(script, function); 
     82  commands_[command] = lua_func(script, function); 
    8483} 
    8584 
     
    148147 
    149148 
    150 NSCAPI::nagiosReturn LUAScript::handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
    151   if (command == _T("LuaReload")) { 
     149NSCAPI::nagiosReturn LUAScript::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) { 
     150  if (command == _T("luareload")) { 
    152151    return reload(message)?NSCAPI::returnOK:NSCAPI::returnCRIT; 
    153152  } 
  • modules/LUAScript/LUAScript.h

    r87cf3c4 r7443b58  
    4141  }; 
    4242 
    43   typedef std::map<strEx::wci_string,lua_func> cmd_list; 
     43  typedef std::map<std::wstring,lua_func> cmd_list; 
    4444  typedef std::list<script_wrapper::lua_script*> script_list; 
    4545 
     
    7272  bool hasMessageHandler(); 
    7373  bool loadScript(const std::wstring script); 
    74   NSCAPI::nagiosReturn handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
     74  NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
    7575  //NSCAPI::nagiosReturn RunLUA(const unsigned int argLen, TCHAR **char_args, std::wstring &message, std::wstring &perf); 
    7676  //NSCAPI::nagiosReturn extract_return(Lua_State &L, int arg_count,  std::wstring &message, std::wstring &perf); 
  • modules/NRPEClient/NRPEClient.cpp

    rc760fc9 r7443b58  
    153153  return false; 
    154154} 
    155 NSCAPI::nagiosReturn NRPEClient::handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) 
     155NSCAPI::nagiosReturn NRPEClient::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) 
    156156{ 
    157157  command_list::const_iterator cit = commands.find(strEx::blindstr(command.c_str())); 
  • modules/NRPEClient/NRPEClient.h

    rc760fc9 r7443b58  
    122122  bool hasCommandHandler(); 
    123123  bool hasMessageHandler(); 
    124   NSCAPI::nagiosReturn handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
     124  NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf); 
    125125  int commandLineExec(const unsigned int argLen,TCHAR** args); 
    126126  std::wstring getConfigurationMeta(); 
  • modules/NRPEServer/handler_impl.cpp

    r294b37b r7443b58  
    1111  std::wstring msg, perf; 
    1212 
    13   if (allowArgs_) { 
     13  if (!allowArgs_) { 
    1414    if (!cmd.second.empty()) { 
    1515      NSC_LOG_ERROR(_T("Request contained arguments (not currently allowed, check the allow_arguments option).")); 
     
    1717    } 
    1818  } 
    19   if (allowNasty_) { 
     19  if (!allowNasty_) { 
    2020    if (cmd.first.find_first_of(NASTY_METACHARS) != std::wstring::npos) { 
    2121      NSC_LOG_ERROR(_T("Request command contained illegal metachars!")); 
     
    3333  try { 
    3434    NSC_DEBUG_MSG_STD(_T("Running command: ") + cmd.first); 
    35     ret = nscapi::plugin_singleton->get_core()->InjectSplitAndCommand(cmd.first, cmd.second, '!', msg, perf); 
     35    ret = nscapi::plugin_singleton->get_core()->InjectNRPECommand(cmd.first, cmd.second, msg, perf); 
    3636    NSC_DEBUG_MSG_STD(_T("Running command: ") + cmd.first + _T(" = ") + msg); 
    3737  } catch (...) { 
  • scripts/lib/NagiosPlugins.vbs

    r9661f81 r7443b58  
    114114  Public Function get_threshold (threshold) 
    115115    ' Simple function to return the warning and critical threshold 
    116     If threshold = LCase("warning") Then 
     116    If LCase(threshold) = "warning" Then 
    117117      get_threshold = threshold_warning 
    118118    End IF 
    119119     
    120     If threshold = LCase("critical") Then 
     120    If LCase(threshold) = "critical" Then 
    121121      get_threshold = threshold_critical 
    122122    End If 
     
    136136  End Function 
    137137 
    138    
     138 
     139 
     140  Public Function get_threshold_perfdat(string) 
     141 
     142    Dim cintw0 
     143    Dim cintw 
     144    Dim x 
     145    Dim colon 
     146     
     147    cintw0=get_threshold(string) 
     148    x=Replace(cintw0,"~","") 
     149    cintw0=Replace(x,"@","") 
     150     
     151    colon=Instr(cintw0,":") 
     152     
     153    If (colon > 1) Then 
     154      cintw=Left(cintw0,colon-1) 
     155    Else 
     156      If (colon=1) Then 
     157        cintw=Mid(cintw0,2) 
     158      Else 
     159        cintw=cintw0 
     160      End If 
     161    End If 
     162     
     163    get_threshold_perfdat=cintw 
     164   
     165  End Function 
     166   
     167 
    139168  Public Function check_threshold (value) 
    140169    ' Verify the thresholds for warning and critical 
     
    152181    check_threshold = 0 
    153182     
     183    value = CDbl(value) 
     184     
    154185    Set re = New RegExp 
    155186    re.IgnoreCase = True 
     
    232263        Set threshold = re.Execute(threshold) 
    233264         
    234         If threshold(0) < 0 Or threshold(0) > value Then 
     265        If value < 0 Or value > CDbl(threshold(0)) Then 
     266          parse_range = 1 
     267        Else 
    235268          parse_range = 0 
    236         Else 
    237           parse_range = 1 
    238269        End If 
    239270 
     
    242273        re.Pattern = "^([0-9]+):$" 
    243274        Set threshold = re.Execute(threshold) 
    244         If value > threshold(0) Then 
    245           parse_range = 0 
    246         Else 
    247           parse_range = 1 
    248         End If 
    249  
    250       Case 3 
    251         ' outside the range infinity <- value 
    252         re.Pattern = "^~:([0-9]+)$" 
    253         Set threshold = re.Execute(threshold) 
    254         If value < threshold(0) Then 
    255           parse_range = 0 
    256         Else 
    257           parse_range = 1 
    258         End If 
    259  
    260       Case 4 
    261         ' outside the range of value:value 
    262         re.Pattern = "^([0-9]+):([0-9]+)$" 
    263         Set threshold = re.Execute(threshold) 
     275 
    264276         
    265277        For Each thres In threshold 
    266           If value < thres.SubMatches(0) Or value > thres.SubMatches(1) Then 
     278                                        'Wscript.Echo "SubMatches(0): " & thres.SubMatches(0) & " val: " & value 
     279          If value < CDbl(thres.SubMatches(0)) Then 
    267280            parse_range = 1 
    268281          Else 
     
    271284        Next 
    272285         
     286 
     287 
     288      Case 3 
     289        ' outside the range infinity <- value 
     290        re.Pattern = "^~:([0-9]+)$" 
     291        Set threshold = re.Execute(threshold) 
     292 
     293        For Each thres In threshold 
     294          If value > CDbl(thres.SubMatches(0)) Then 
     295            parse_range = 1 
     296          Else 
     297            parse_range = 0 
     298          End If 
     299        Next 
     300 
     301 
     302      Case 4 
     303        ' outside the range of value:value 
     304        re.Pattern = "^([0-9]+):([0-9]+)$" 
     305        Set threshold = re.Execute(threshold) 
     306         
     307        For Each thres In threshold 
     308          If value < CDbl(thres.SubMatches(0)) Or value > CDbl(thres.SubMatches(1)) Then 
     309            parse_range = 1 
     310          Else 
     311            parse_range = 0 
     312          End If 
     313        Next 
     314         
    273315      Case 5 
    274316        re.Pattern = "^@([0-9]+):([0-9]+)$" 
     
    276318         
    277319        For Each thres In threshold 
    278           If value > thres.SubMatches(0) And value < thres.SubMatches(1) Then 
    279             Wscript.Echo "Bigger than " & thres.SubMatches(0) & " and smaller than " & thres.SubMatches(1) 
     320          If value >= CDbl(thres.SubMatches(0)) And value <= CDbl(thres.SubMatches(1)) Then 
     321            'Wscript.Echo "Bigger than " & thres.SubMatches(0) & " and smaller than " & thres.SubMatches(1) 
    280322            parse_range = 1 
    281323          Else 
  • service/CMakeLists.txt

    r1f24a1c r7443b58  
    8282  ) 
    8383  SET(service_SRCS ${service_SRCS} 
    84     ${NSCP_INCLUDEDIR}/service/unix_service.hpp 
     84    ${CMAKE_CURRENT_SOURCE_DIR}/NSClient++.manifest 
    8585  ) 
    8686   
    8787  ADD_DEFINITIONS(-D_WIN32_DCOM) 
     88 
     89   
     90# SET( 
     91#   CMAKE_LINKER_FLAGS  
     92#   /MANIFEST  
     93#   /MANIFESTFILE:"${CMAKE_CURRENT_SOURCE_DIR}/NSClient++.manifest" 
     94# ) 
     95# SET( 
     96#   CMAKE_MODULE_LINKER_FLAG  
     97#   /MANIFEST  
     98#   /MANIFESTFILE:"${CMAKE_CURRENT_SOURCE_DIR}/NSClient++.manifest" 
     99# ) 
    88100 
    89101ENDIF(WIN32) 
     
    96108  ADD_DEFINITIONS(-DUSE_BREAKPAD) 
    97109ENDIF(BREAKPAD_FOUND) 
    98  
    99110 
    100111configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../files/old-settings.map ${CMAKE_CURRENT_BINARY_DIR}/old-settings.map COPYONLY) 
     
    114125SET_TARGET_PROPERTIES(${TARGET} PROPERTIES FOLDER "core") 
    115126SET_TARGET_PROPERTIES(${TARGET}_VERSION PROPERTIES FOLDER "core") 
     127#IF(WIN32) 
     128# SET_TARGET_PROPERTIES(${TARGET} PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" /SUBSYSTEM:WINDOWS") 
     129#ENDIF(WIN32) 
    116130 
    117131SOURCE_GROUP("Common Files" REGULAR_EXPRESSION .*include/.*) 
Note: See TracChangeset for help on using the changeset viewer.