Changeset 330af36 in nscp


Ignore:
Timestamp:
12/12/11 07:46:11 (19 months ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
53c1a6e
Parents:
f085f9b
Message:

nscp python --script test_w32_system.py --install
nscp client --query py_unittest
...
OK: 121 test(s) successfull|

Files:
8 added
10 edited

Legend:

Unmodified
Added
Removed
  • changelog

    rf085f9b r330af36  
    55 * Fixa dependonservice LanManWorkStation (old win) 
    66 * Fix RtlStringFromGUID problem on NT4 
     7 
     82011-12-08 MickeM 
     9 * Fixed so non custom installers gets configuration UI (meaning you can configure it) 
     10 * Added WarnCount/CritCount exact bounds to CheckProcState so: 
     11   CheckProcState CritCount=gt:50 WarnCount=ne:45 svchost.exe=started 
     12 * Added embryo for Graphite plugin (https://launchpad.net/graphite) 
     13 * Added WarnHungCount/CritHungCount exact bounds to CheckProcState so: 
     14   CheckProcState CritHungCount=gt:50 WarnHungCount=ne:45 svchost.exe 
     15 * Changed so Count takes presedence meaning if you specify: CheckProcState CritCount=gt:50 svchost.exe=stopped it will be treated  
     16   as (CheckProcState CritCount=gt:50 svchost.exe) hence the stopped/started is meaningless if you specify a count. 
     17 * Fixed so perfoamnce data parsin handled non escaped \:es (ie. using stupiud parsing) 
     18 * Added a lot of unittests to CheckProcState to verify that many features work properly. 
     19    nscp python --script test_w32_system.py --install 
     20    nscp client --query py_unittest 
     21    ... 
     22    OK: 121 test(s) successfull| 
    723 
    8242011-12-06 MickeM 
  • helpers/installers/ui/WixUI_MondoNSCP.wxs

    rb7d17f8 r330af36  
    3434 
    3535<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
    36     <Fragment> 
    37         <UI Id="WixUI_MondoNSCP"> 
    38             <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" /> 
    39             <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" /> 
    40             <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" /> 
     36  <Fragment> 
     37    <UI Id="WixUI_MondoNSCP"> 
     38      <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" /> 
     39      <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" /> 
     40      <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" /> 
    4141 
    42             <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" /> 
    43             <Property Id="WixUI_Mode" Value="Mondo" /> 
     42      <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" /> 
     43      <Property Id="WixUI_Mode" Value="Mondo" /> 
    4444 
    45             <DialogRef Id="ErrorDlg" /> 
    46             <DialogRef Id="FatalError" /> 
    47             <DialogRef Id="FilesInUse" /> 
    48             <DialogRef Id="MsiRMFilesInUse" /> 
    49             <DialogRef Id="PrepareDlg" /> 
    50             <DialogRef Id="ProgressDlg" /> 
    51             <DialogRef Id="ResumeDlg" /> 
    52             <DialogRef Id="UserExit" /> 
     45      <DialogRef Id="ErrorDlg" /> 
     46      <DialogRef Id="FatalError" /> 
     47      <DialogRef Id="FilesInUse" /> 
     48      <DialogRef Id="MsiRMFilesInUse" /> 
     49      <DialogRef Id="PrepareDlg" /> 
     50      <DialogRef Id="ProgressDlg" /> 
     51      <DialogRef Id="ResumeDlg" /> 
     52      <DialogRef Id="UserExit" /> 
    5353 
    54             <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish> 
     54      <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish> 
    5555 
    56             <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed AND NOT PATCH</Publish> 
    57             <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish> 
     56      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed AND NOT PATCH</Publish> 
     57      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish> 
    5858 
    59             <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish> 
    60       <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg">1</Publish> 
     59      <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish> 
     60      <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg">1</Publish> 
    6161 
    62       <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish> 
    63       <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 
    64             <Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeDlg">1</Publish> 
    65             <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 
    6662 
    67             <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish> 
    68             <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish> 
    69       <!-- BEGIN: Modified to handle configuration dialog --> 
    70       <!-- 
    71         // CONF_HAS_ERRORS=1  => Dont allow anything (inform of issue) 
    72         // CONF_CAN_CHANGE=1  => Allow change 
    73         // CONF_OLD_FOUND=0   => Allow setting boot.ini 
     63      <!-- 
     64        Custom Workflow 
     65        CONF_HAS_ERRORS=1:  Dont allow anything (inform of issue) 
     66              SetupTypeDlg -> InvalidConfigureationDlg -> VerifyReadyDlg 
     67 
     68        CONF_OLD_FOUND=0:   Allow setting boot.ini 
     69              SetupTypeDlg -> SelectConfigurationDlg -> ConfigureDlg -> VerifyReadyDlg 
     70 
     71        CONF_CAN_CHANGE=1: Allow change 
     72              SetupTypeDlg -> ConfigureDlg -> VerifyReadyDlg 
     73 
     74        UNKNOWN: Dont allow anything (dont tell anyone) 
     75              SetupTypeDlg -> VerifyReadyDlg 
     76               
     77        Backflows: 
     78          InvalidConfigureationDlg -> SetupTypeDlg<...> 
     79          SelectConfigurationDlg -> SetupTypeDlg<...> 
     80          ConfigureDlg [CONF_OLD_FOUND=0] -> SelectConfigurationDlg 
     81          ConfigureDlg [*] -> SetupTypeDlg<...> 
     82          VerifyReadyDlg [CONF_HAS_ERRORS=1] -> InvalidConfigureationDlg 
     83          VerifyReadyDlg [CONF_OLD_FOUND=0 OR CONF_CAN_CHANGE=1] -> ConfigureDlg 
     84          VerifyReadyDlg [*] -> SetupTypeDlg<...> 
    7485         --> 
    75       <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="InvalidConfigureationDlg" Order="1">CONF_HAS_ERRORS = "1"</Publish> 
    76       <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfigureDlg" Order="2">CONF_HAS_ERRORS = "0" AND CONF_CAN_CHANGE = "1"</Publish> 
    77       <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="SelectConfigurationDlg" Order="3">CONF_HAS_ERRORS = "0" AND CONF_OLD_FOUND="0"</Publish> 
    7886 
    79       <Publish Dialog="InvalidConfigureationDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">1</Publish> 
    80       <Publish Dialog="InvalidConfigureationDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 
    81        
    82       <Publish Dialog="SelectConfigurationDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">1</Publish> 
    83       <Publish Dialog="SelectConfigurationDlg" Control="Next" Event="NewDialog" Value="ConfigureDlg">1</Publish> 
     87      <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish> 
     88      <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="InvalidConfigureationDlg" Order="1">CONF_HAS_ERRORS = "1"</Publish> 
     89      <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="SelectConfigurationDlg" Order="2">CONF_OLD_FOUND="0"</Publish> 
     90      <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="ConfigureDlg" Order="3">CONF_CAN_CHANGE = "1"</Publish> 
     91      <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="VerifyReadyDlg" Order="4">1</Publish> 
     92      <Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeDlg">1</Publish> 
     93      <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="InvalidConfigureationDlg" Order="1">CONF_HAS_ERRORS = "1"</Publish> 
     94      <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="SelectConfigurationDlg" Order="2">CONF_OLD_FOUND="0"</Publish> 
     95      <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="ConfigureDlg" Order="3">CONF_CAN_CHANGE = "1"</Publish> 
     96      <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="VerifyReadyDlg" Order="4">1</Publish> 
    8497 
    85       <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">CONF_OLD_FOUND="0"</Publish> 
    86       <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="SelectConfigurationDlg">CONF_OLD_FOUND="0"</Publish> 
    87       <Publish Dialog="ConfigureDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 
     98      <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish> 
     99      <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish> 
     100      <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="InvalidConfigureationDlg" Order="1">CONF_HAS_ERRORS = "1"</Publish> 
     101      <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="SelectConfigurationDlg" Order="2">CONF_OLD_FOUND="0"</Publish> 
     102      <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfigureDlg" Order="3">CONF_CAN_CHANGE = "1"</Publish> 
     103      <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">1</Publish> 
    88104 
    89       <!-- END: Modified to handle configuration dialog --> 
    90       <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "InstallCustom"</Publish> 
    91             <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish> 
    92             <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">WixUI_InstallMode = "Change"</Publish> 
    93             <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="4">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish> 
    94             <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">WixUI_InstallMode = "Update"</Publish> 
     105      <Publish Dialog="InvalidConfigureationDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "Change" OR WixUI_InstallMode = "InstallCustom"</Publish> 
     106      <Publish Dialog="InvalidConfigureationDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish> 
     107      <Publish Dialog="InvalidConfigureationDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="3">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish> 
     108      <Publish Dialog="InvalidConfigureationDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="4">WixUI_InstallMode = "Update"</Publish> 
     109      <Publish Dialog="InvalidConfigureationDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 
    95110 
    96             <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish> 
     111      <Publish Dialog="SelectConfigurationDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "Change" OR WixUI_InstallMode = "InstallCustom"</Publish> 
     112      <Publish Dialog="SelectConfigurationDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish> 
     113      <Publish Dialog="SelectConfigurationDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="3">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish> 
     114      <Publish Dialog="SelectConfigurationDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="4">WixUI_InstallMode = "Update"</Publish> 
     115      <Publish Dialog="SelectConfigurationDlg" Control="Next" Event="NewDialog" Value="ConfigureDlg">1</Publish> 
    97116 
    98             <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish> 
    99             <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 
    100             <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 
    101             <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish> 
    102         </UI> 
     117      <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="SelectConfigurationDlg" Order="1">CONF_OLD_FOUND="0"</Publish> 
     118      <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="2">WixUI_InstallMode = "Change" OR WixUI_InstallMode = "InstallCustom"</Publish> 
     119      <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="3">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish> 
     120      <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="4">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish> 
     121      <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="5">WixUI_InstallMode = "Update"</Publish> 
     122      <Publish Dialog="ConfigureDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 
    103123 
    104         <UIRef Id="WixUI_Common" /> 
    105     </Fragment> 
     124      <!-- END: Modified to handle configuration dialog --> 
     125      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InvalidConfigureationDlg" Order="1">CONF_HAS_ERRORS = "1"</Publish> 
     126      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfigureDlg" Order="2">CONF_OLD_FOUND="0" OR CONF_CAN_CHANGE="1"</Publish> 
     127      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">WixUI_InstallMode = "Change" OR WixUI_InstallMode = "InstallCustom"</Publish> 
     128      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="4">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish> 
     129      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="5">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish> 
     130      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="6">WixUI_InstallMode = "Update"</Publish> 
     131 
     132      <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish> 
     133 
     134      <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish> 
     135      <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 
     136      <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 
     137      <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish> 
     138    </UI> 
     139 
     140    <UIRef Id="WixUI_Common" /> 
     141  </Fragment> 
    106142</Wix> 
  • include/checkHelpers.hpp

    re11d494 r330af36  
    128128      return *this; 
    129129    } 
     130    void reset() { 
     131      warn.reset(); 
     132      crit.reset(); 
     133    } 
    130134    std::wstring getAlias() { 
    131135      if (alias.empty()) 
     
    604608    } 
    605609 
     610    void reset() { 
     611      bHasBounds_ = false; 
     612    } 
    606613    checkResultType check(TType value) const { 
    607614      if (value == value_) 
     
    750757      lower.setParent(this); 
    751758      return *this; 
     759    } 
     760    void reset() { 
     761      type_ = none; 
    752762    } 
    753763    checkResultType check(TType value) const { 
     
    891901    StateBounds(const StateBounds &other) : value_(other.value_) {} 
    892902 
     903    void reset() { 
     904      value_ = state_none; 
     905    } 
    893906    bool check(TType value) const { 
    894907      return (value & value_) != 0; 
     
    946959      min_ = other.min_; 
    947960      return *this; 
     961    } 
     962    void reset() { 
     963      state.reset(); 
     964      max_.reset(); 
     965      min_.reset(); 
    948966    } 
    949967    bool hasBounds() { 
     
    10101028      filter = other.filter; 
    10111029    } 
     1030    void reset() { 
     1031      filter.reset(); 
     1032    } 
    10121033    bool hasBounds() { 
    10131034      return filter.hasFilter(); 
     
    10621083      state = other.state; 
    10631084    } 
     1085    void reset() { 
     1086      state.reset(); 
     1087    } 
    10641088    bool hasBounds() { 
    10651089      return state.hasBounds(); 
     
    11061130      min_ = other.min_; 
    11071131      return *this; 
     1132    } 
     1133    void reset() { 
     1134      max_.reset(); 
     1135      min_.reset(); 
    11081136    } 
    11091137    bool hasBounds() { 
     
    12051233    } 
    12061234 
     1235    void reset() { 
     1236      max.reset(); 
     1237      min.reset(); 
     1238      eq.reset(); 
     1239      neq.reset(); 
     1240    } 
    12071241    bool hasBounds() { 
    12081242      return max.hasBounds() || min.hasBounds() || eq.hasBounds() || neq.hasBounds(); 
     
    12331267    } 
    12341268    bool check(typename THolder::TValueType &value, std::wstring lable, std::wstring &message, ResultType type) { 
     1269      return check_preformatted(value, THolder::toStringLong(value), lable, message, type); 
     1270    } 
     1271    bool check_preformatted(typename THolder::TValueType &value, std::wstring formatted_value, std::wstring lable, std::wstring &message, ResultType type) { 
    12351272      if ((max.hasBounds())&&(max.check(value) == above)) { 
    1236         message = lable + _T(": ") + formatAbove(THolder::toStringLong(value), type); 
     1273        message = lable + _T(": ") + formatAbove(formatted_value, type); 
    12371274        return true; 
    12381275      } else if ((min.hasBounds())&&(min.check(value) == below)) { 
    1239         message = lable + _T(": ") + formatBelow(THolder::toStringLong(value), type); 
     1276        message = lable + _T(": ") + formatBelow(formatted_value, type); 
    12401277        return true; 
    12411278      } else if ((eq.hasBounds())&&(eq.check(value) == same)) { 
    1242         message = lable + _T(": ") + formatSame(THolder::toStringLong(value), type); 
     1279        message = lable + _T(": ") + formatSame(formatted_value, type); 
    12431280        return true; 
    12441281      } else if ((neq.hasBounds())&&(neq.check(value) != same)) { 
    1245         message = lable + _T(": ") + formatNotSame(THolder::toStringLong(value), type); 
     1282        message = lable + _T(": ") + formatNotSame(formatted_value, type); 
    12461283        return true; 
    12471284      } else { 
     
    12501287      return false; 
    12511288    } 
    1252  
    12531289  }; 
    12541290  typedef ExactBounds<NumericBounds<unsigned long int, int_handler> > ExactBoundsULongInteger; 
  • include/nscapi/functions.hpp

    rf33c12f r330af36  
    748748    ////////////////////////////////////////////////////////////////////////// 
    749749 
    750     template<class T, class U> 
     750    template<class T> 
    751751    struct tokenizer_data { 
    752       boost::escaped_list_separator<U> separator; // \\, ' ', \' 
     752      T perf_lable_enclosure;           // ' 
     753      T perf_separator;             // ' ' 
    753754      T perf_item_splitter;           // ;  
    754755      T perf_equal_sign;              // = 
     
    757758    }; 
    758759 
    759     template<class T, class U> 
    760     static void parse_performance_data(Plugin::QueryResponseMessage::Response *payload, T &perf, tokenizer_data<T, U> tokenizer_data) { 
    761       boost::tokenizer<boost::escaped_list_separator<U>, typename T::const_iterator, T> tok(perf, tokenizer_data.separator); 
    762       BOOST_FOREACH(const T s, tok) { 
    763         if (s.size() == 0) 
    764           break; 
    765         std::vector<T> items = strEx::splitV(s, tokenizer_data.perf_item_splitter); 
     760    template<class T> 
     761    static void parse_performance_data(Plugin::QueryResponseMessage::Response *payload, T &perf, tokenizer_data<T> tokenizer_data) { 
     762      while (true) { 
     763        if (perf.size() == 0) 
     764          return; 
     765        typename T::size_type p = 0; 
     766        if (perf[0] == tokenizer_data.perf_lable_enclosure[0]) { 
     767          p = perf.find(tokenizer_data.perf_lable_enclosure[0], 1)+1; 
     768          if (p == T::npos) 
     769            return; 
     770        } 
     771        p = perf.find(tokenizer_data.perf_separator, p); 
     772        if (p == 0) 
     773          return; 
     774        T chunk; 
     775        if (p == T::npos) { 
     776          chunk = perf; 
     777          perf = T(); 
     778        } else { 
     779          chunk = perf.substr(0, p); 
     780          perf = perf.substr(p); 
     781        } 
     782        std::vector<T> items = strEx::splitV(chunk, tokenizer_data.perf_item_splitter); 
    766783        if (items.size() < 1) { 
    767784          Plugin::Common::PerformanceData* perfData = payload->add_perf(); 
     
    777794        perfData->set_type(Plugin::Common_DataType_FLOAT); 
    778795        std::pair<T,T> fitem = strEx::split(items[0], tokenizer_data.perf_equal_sign); 
    779         perfData->set_alias(to_string(fitem.first)); 
     796        T alias = fitem.first; 
     797        if (alias.size() > 0 && alias[0] == tokenizer_data.perf_lable_enclosure[0] && alias[alias.size()-1] == tokenizer_data.perf_lable_enclosure[0]) 
     798          alias = alias.substr(1, alias.size()-2); 
     799           
     800        perfData->set_alias(to_string(alias)); 
    780801        Plugin::Common_PerformanceData_FloatValue* floatPerfData = perfData->mutable_float_value(); 
    781802 
     
    800821      typedef std::wstring t_string; 
    801822      typedef wchar_t t_char; 
    802       tokenizer_data<t_string, t_char> data; 
    803       data.separator = boost::escaped_list_separator<t_char>(L'\\', L' ', L'\''); 
     823      tokenizer_data<t_string> data; 
     824      data.perf_separator = _T(" "); 
     825      data.perf_lable_enclosure = _T("'"); 
    804826      data.perf_equal_sign = _T("="); 
    805827      data.perf_item_splitter = _T(";"); 
    806828      data.perf_valid_number = _T("0123456789,."); 
    807       parse_performance_data<t_string, t_char>(payload, perf, data); 
     829      parse_performance_data<t_string>(payload, perf, data); 
    808830    } 
    809831    static void parse_performance_data(Plugin::QueryResponseMessage::Response *payload, std::string &perf) { 
    810832      typedef std::string t_string; 
    811833      typedef char t_char; 
    812       tokenizer_data<t_string, t_char> data; 
    813       data.separator = boost::escaped_list_separator<t_char>('\\', ' ', '\''); 
     834      tokenizer_data<t_string> data; 
     835      data.perf_separator = " "; 
     836      data.perf_lable_enclosure = "'"; 
    814837      data.perf_equal_sign = "="; 
    815838      data.perf_item_splitter = ";"; 
    816839      data.perf_valid_number = "0123456789,."; 
    817       parse_performance_data<t_string, t_char>(payload, perf, data); 
     840      parse_performance_data<t_string>(payload, perf, data); 
    818841    } 
    819842 
  • include/nscapi/nscapi_plugin_wrapper.hpp

    r98113da r330af36  
    298298        } 
    299299        return retCode; 
     300      } catch (const std::exception &e) {  
     301        NSC_LOG_CRITICAL(_T("Exception in: NSHandleCommand: ") + utf8::to_unicode(e.what()));  
     302        return NSCAPI::returnUNKNOWN; 
    300303      } catch (...) {  
    301304        NSC_LOG_CRITICAL(_T("Unknown exception in: NSHandleCommand"));  
     305        return NSCAPI::returnUNKNOWN; 
    302306      }  
    303307      return NSCAPI::returnIgnored;  
  • include/utils.h

    rf33c12f r330af36  
    5757      else if (p__.first == (_T("MinCrit") postfix)) { obj.crit.min_ = p__.second; } 
    5858 
     59#define MAP_OPTIONS_EXACT_NUMERIC_LEGACY(obj, postfix) \ 
     60      else if (p__.first == (_T("MaxWarn") postfix)) { obj.warn.max = p__.second; } \ 
     61      else if (p__.first == (_T("MaxCrit") postfix)) { obj.crit.max = p__.second; } \ 
     62      else if (p__.first == (_T("MinWarn") postfix)) { obj.warn.min = p__.second; } \ 
     63      else if (p__.first == (_T("MinCrit") postfix)) { obj.crit.min = p__.second; } 
     64 
    5965#define MAP_OPTIONS_EXACT_NUMERIC_ALL(obj, postfix) \ 
    6066      else if (p__.first == (_T("warn") postfix)) { obj.warn = p__.second; } \ 
    6167      else if (p__.first == (_T("crit") postfix)) { obj.crit = p__.second; } \ 
     68 
     69#define MAP_OPTIONS_EXACT_NUMERIC_LEGACY_EX(obj, postfix, subobj) \ 
     70      else if (p__.first == (_T("MaxWarn") postfix)) { obj.warn.subobj.max = p__.second; } \ 
     71      else if (p__.first == (_T("MaxCrit") postfix)) { obj.crit.subobj.max = p__.second; } \ 
     72      else if (p__.first == (_T("MinWarn") postfix)) { obj.warn.subobj.min = p__.second; } \ 
     73      else if (p__.first == (_T("MinCrit") postfix)) { obj.crit.subobj.min = p__.second; } 
     74 
     75#define MAP_OPTIONS_EXACT_NUMERIC_ALL_EX(obj, postfix, subobj) \ 
     76      else if (p__.first == (_T("warn") postfix)) { obj.warn.subobj = p__.second; } \ 
     77      else if (p__.first == (_T("crit") postfix)) { obj.crit.subobj = p__.second; } \ 
    6278 
    6379#define MAP_OPTIONS_EXACT_NUMERIC_ALL_MULTI(obj, postfix) \ 
  • modules/CheckSystem/CheckSystem.cpp

    rf7a074d r330af36  
    945945} 
    946946 
     947 
     948 
     949struct process_count_result { 
     950  unsigned long running; 
     951  unsigned long hung; 
     952  process_count_result() : running(0), hung(0) {} 
     953 
     954  std::wstring format_value(std::wstring tag, unsigned long count) { 
     955    if (count > 1) 
     956      return tag + _T("(") + strEx::itos(count) +_T(")"); 
     957    if (count == 1) 
     958      return tag; 
     959    return _T(""); 
     960  } 
     961  std::wstring to_wstring() { 
     962    if (running > 0 && hung > 0) 
     963      return format_value(_T("running"), running) + _T(", ") + format_value(_T("hung"), hung); 
     964    if (running > 0) 
     965      return format_value(_T("running"), running); 
     966    if (hung > 0) 
     967      return format_value(_T("hung"), hung); 
     968    return _T("stopped"); 
     969  } 
     970  std::wstring to_wstring_short() { 
     971    if (running > 0 && hung > 0) 
     972      return _T("running, hung"); 
     973    if (running > 0) 
     974      return _T("running"); 
     975    if (hung > 0) 
     976      return _T("hung"); 
     977    return _T("stopped"); 
     978  } 
     979 
     980}; 
     981 
     982class ProcessBound { 
     983public: 
     984  checkHolders::ExactBounds<checkHolders::NumericBounds<unsigned long, checkHolders::int_handler> > running; 
     985  checkHolders::ExactBounds<checkHolders::NumericBounds<unsigned long, checkHolders::int_handler> > hung; 
     986  typedef checkHolders::NumericBounds<unsigned long, checkHolders::int_handler> THolder; 
     987 
     988  typedef ProcessBound TMyType; 
     989  typedef process_count_result TValueType; 
     990 
     991  ProcessBound() {} 
     992  ProcessBound(const ProcessBound &other) { 
     993    running = other.running; 
     994    hung = other.hung; 
     995  } 
     996 
     997  void reset() { 
     998    running.reset(); 
     999    hung.reset(); 
     1000  } 
     1001  bool hasBounds() { 
     1002    return running.hasBounds() || hung.hasBounds(); 
     1003  } 
     1004  static std::wstring toStringLong(TValueType &value) { 
     1005    return value.to_wstring(); 
     1006  } 
     1007  static std::wstring toStringShort(TValueType &value) { 
     1008    return value.to_wstring_short(); 
     1009  } 
     1010  std::wstring gatherPerfData(std::wstring alias, TValueType &value, TMyType &warn, TMyType &crit) { 
     1011    if (hung.hasBounds()) 
     1012      return hung.gatherPerfData(alias, value.hung, warn.hung, crit.hung); 
     1013    return running.gatherPerfData(alias, value.running, warn.running, crit.running); 
     1014  } 
     1015  std::wstring gatherPerfData(std::wstring alias, TValueType &value) { 
     1016    THolder tmp; 
     1017    if (hung.hasBounds()) 
     1018      return tmp.gatherPerfData(alias, value.hung); 
     1019    return tmp.gatherPerfData(alias, value.running); 
     1020  } 
     1021  bool check(TValueType &value, std::wstring lable, std::wstring &message, checkHolders::ResultType type) { 
     1022    if (hung.hasBounds()) { 
     1023      return hung.check_preformatted(value.hung, value.to_wstring(), lable, message, type); 
     1024    } else { 
     1025      return running.check_preformatted(value.running, value.to_wstring(), lable, message, type); 
     1026    } 
     1027    return false; 
     1028  } 
     1029 
     1030}; 
    9471031/** 
    9481032 * Check process state and return result 
     
    9571041NSCAPI::nagiosReturn CheckSystem::checkProcState(std::list<std::wstring> arguments, std::wstring &msg, std::wstring &perf) 
    9581042{ 
    959   typedef checkHolders::CheckContainer<checkHolders::MaxMinStateBoundsStateBoundsInteger> StateContainer; 
     1043  typedef checkHolders::CheckContainer<ProcessBound> StateContainer; 
     1044   
     1045//  typedef checkHolders::CheckContainer<checkHolders::ExactBoundsState> StateContainer2; 
     1046 
    9601047  if (arguments.empty()) { 
    9611048    msg = _T("ERROR: Missing argument exception."); 
     
    9771064   
    9781065 
    979   tmpObject.data = _T("uptime"); 
    980   tmpObject.crit.state = _T("started"); 
     1066  //tmpObject.data = _T("uptime"); 
     1067  //tmpObject.crit.min = 1; 
    9811068 
    9821069  MAP_OPTIONS_BEGIN(arguments) 
    983     MAP_OPTIONS_NUMERIC_ALL(tmpObject, _T("Count")) 
     1070    //MAP_OPTIONS_NUMERIC_ALL(tmpObject, _T("Count")) 
     1071    MAP_OPTIONS_EXACT_NUMERIC_ALL_EX(tmpObject, _T("Count"), running) 
     1072    MAP_OPTIONS_EXACT_NUMERIC_LEGACY_EX(tmpObject, _T("Count"), running) 
     1073    MAP_OPTIONS_EXACT_NUMERIC_ALL_EX(tmpObject, _T("HungCount"), hung) 
     1074    MAP_OPTIONS_EXACT_NUMERIC_LEGACY_EX(tmpObject, _T("HungCount"), hung) 
    9841075    MAP_OPTIONS_STR(_T("Alias"), tmpObject.alias) 
    9851076    MAP_OPTIONS_SHOWALL(tmpObject) 
     
    10031094    else {  
    10041095      tmpObject.data = p__.first; 
    1005       if (p__.second.empty()) 
    1006         tmpObject.crit.state = _T("started");  
    1007       else 
    1008         tmpObject.crit.state = p__.second;  
    1009       list.push_back(tmpObject);  
     1096      if (p__.second.empty()) { 
     1097        if (!tmpObject.crit.running.hasBounds() && !tmpObject.warn.running.hasBounds()) 
     1098          tmpObject.crit.running.min = _T("1");  
     1099      } else if (p__.second == _T("started")) { 
     1100        if (!tmpObject.crit.running.hasBounds() && !tmpObject.warn.running.hasBounds()) 
     1101          tmpObject.crit.running.min = _T("1"); 
     1102      } else if (p__.second == _T("stopped")) { 
     1103        if (!tmpObject.crit.running.hasBounds() && !tmpObject.warn.running.hasBounds()) 
     1104          tmpObject.crit.running.max = _T("0"); 
     1105      } else if (p__.second == _T("hung")) { 
     1106        if (!tmpObject.crit.hung.hasBounds() && !tmpObject.warn.hung.hasBounds()) 
     1107          tmpObject.crit.hung.max = _T("1"); 
     1108      } 
     1109      list.push_back(tmpObject); 
     1110      tmpObject.reset(); 
    10101111    } 
    10111112  MAP_OPTIONS_END() 
     
    10331134          break; 
    10341135      } 
    1035 #ifdef USE_BOOST 
    10361136    } else if (match == match_regexp) { 
    10371137      try { 
     
    10511151        return NSCAPI::returnUNKNOWN; 
    10521152      } 
    1053 #else 
    1054       NSC_LOG_ERROR_STD(_T("NSClient++ is compiled without USEBOOST so no regular expression support for you...") + (*proc).first); 
    1055       msg = _T("Regular expression is not supported: ") + (*proc).first; 
    1056       return NSCAPI::returnUNKNOWN; 
    1057 #endif 
    10581153    } else { 
    10591154      NSC_LOG_ERROR_STD(_T("Unsupported mode for: ") + (*proc).first); 
     
    10731168      } 
    10741169    } else { 
    1075       checkHolders::MaxMinStateValueType<int, checkHolders::state_type> value; 
     1170      process_count_result value; 
    10761171      if (bFound) { 
    1077         if ((*proc).second.hung_count > 0) { 
    1078           NSC_LOG_ERROR_STD(_T("Hung proc: ") + strEx::itos((*proc).second.hung_count)); 
    1079           value.count = (*proc).second.count; 
    1080           value.state = checkHolders::state_hung; 
    1081         } else { 
    1082           value.count = (*proc).second.count; 
    1083           value.state = checkHolders::state_started; 
    1084         } 
     1172        value.hung = (*proc).second.hung_count; 
     1173        value.running = (*proc).second.count; 
    10851174      } else { 
    1086         value.count = 0; 
    1087         if (ignoreState) 
    1088           value.state = checkHolders::state_stopped | checkHolders::state_started | checkHolders::state_hung; 
    1089         else 
    1090         value.state = checkHolders::state_stopped; 
     1175        value.hung = 0; 
     1176        value.running = 0; 
     1177//        if (ignoreState) 
     1178//          value.state = checkHolders::state_stopped | checkHolders::state_started | checkHolders::state_hung; 
     1179//        else 
     1180//        value.state = checkHolders::state_stopped; 
    10911181      } 
    10921182      if (bFound && (*it).alias.empty()) { 
  • service/logger.hpp

    r96c1461 r330af36  
    8888      slave() : mq_(ip::open_only,queue_name.c_str()), plugins_loaded_(false), console_log_(false) { 
    8989#ifdef WIN32 
    90         if(!SetConsoleOutputCP(CP_UTF8)) { // 65001 
    91           std::cerr << "Failed to set console output mode!\n"; 
    92         } 
     90//        if(!SetConsoleOutputCP(CP_UTF8)) { // 65001 
     91//          std::cerr << "Failed to set console output mode!\n"; 
     92//        } 
    9393#endif 
    9494      } 
  • version.hpp

    rf085f9b r330af36  
    11#ifndef VERSION_HPP 
    22#define VERSION_HPP 
    3 #define PRODUCTVER     0,4,0,112 
    4 #define STRPRODUCTVER  "0,4,0,112" 
     3#define PRODUCTVER     0,4,0,113 
     4#define STRPRODUCTVER  "0,4,0,113" 
    55#define STRPRODUCTDATE "2011-12-08" 
    66#endif // VERSION_HPP 
  • version.txt

    rf085f9b r330af36  
    11version=0.4.0 
    2 build=112 
     2build=113 
    33date=2011-12-08 
Note: See TracChangeset for help on using the changeset viewer.