Changeset 330af36 in nscp
- Timestamp:
- 12/12/11 07:46:11 (19 months ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2
- Children:
- 53c1a6e
- Parents:
- f085f9b
- Files:
-
- 8 added
- 10 edited
-
changelog (modified) (1 diff)
-
helpers/installers/ui/WixUI_MondoNSCP.wxs (modified) (1 diff)
-
include/checkHelpers.hpp (modified) (11 diffs)
-
include/nscapi/functions.hpp (modified) (4 diffs)
-
include/nscapi/nscapi_plugin_wrapper.hpp (modified) (1 diff)
-
include/utils.h (modified) (1 diff)
-
modules/CheckSystem/CheckSystem.cpp (modified) (7 diffs)
-
modules/GraphiteClient/CMakeLists.txt (added)
-
modules/GraphiteClient/GraphiteClient.cpp (added)
-
modules/GraphiteClient/GraphiteClient.def (added)
-
modules/GraphiteClient/GraphiteClient.h (added)
-
modules/GraphiteClient/module.cmake (added)
-
modules/GraphiteClient/stdafx.cpp (added)
-
modules/GraphiteClient/stdafx.h (added)
-
scripts/python/test_w32_system.py (added)
-
service/logger.hpp (modified) (1 diff)
-
version.hpp (modified) (1 diff)
-
version.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
changelog
rf085f9b r330af36 5 5 * Fixa dependonservice LanManWorkStation (old win) 6 6 * Fix RtlStringFromGUID problem on NT4 7 8 2011-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| 7 23 8 24 2011-12-06 MickeM -
helpers/installers/ui/WixUI_MondoNSCP.wxs
rb7d17f8 r330af36 34 34 35 35 <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" /> 41 41 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" /> 44 44 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" /> 53 53 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> 55 55 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> 58 58 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> 61 61 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>66 62 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<...> 74 85 --> 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>78 86 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> 84 97 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> 88 104 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> 95 110 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> 97 116 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> 103 123 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> 106 142 </Wix> -
include/checkHelpers.hpp
re11d494 r330af36 128 128 return *this; 129 129 } 130 void reset() { 131 warn.reset(); 132 crit.reset(); 133 } 130 134 std::wstring getAlias() { 131 135 if (alias.empty()) … … 604 608 } 605 609 610 void reset() { 611 bHasBounds_ = false; 612 } 606 613 checkResultType check(TType value) const { 607 614 if (value == value_) … … 750 757 lower.setParent(this); 751 758 return *this; 759 } 760 void reset() { 761 type_ = none; 752 762 } 753 763 checkResultType check(TType value) const { … … 891 901 StateBounds(const StateBounds &other) : value_(other.value_) {} 892 902 903 void reset() { 904 value_ = state_none; 905 } 893 906 bool check(TType value) const { 894 907 return (value & value_) != 0; … … 946 959 min_ = other.min_; 947 960 return *this; 961 } 962 void reset() { 963 state.reset(); 964 max_.reset(); 965 min_.reset(); 948 966 } 949 967 bool hasBounds() { … … 1010 1028 filter = other.filter; 1011 1029 } 1030 void reset() { 1031 filter.reset(); 1032 } 1012 1033 bool hasBounds() { 1013 1034 return filter.hasFilter(); … … 1062 1083 state = other.state; 1063 1084 } 1085 void reset() { 1086 state.reset(); 1087 } 1064 1088 bool hasBounds() { 1065 1089 return state.hasBounds(); … … 1106 1130 min_ = other.min_; 1107 1131 return *this; 1132 } 1133 void reset() { 1134 max_.reset(); 1135 min_.reset(); 1108 1136 } 1109 1137 bool hasBounds() { … … 1205 1233 } 1206 1234 1235 void reset() { 1236 max.reset(); 1237 min.reset(); 1238 eq.reset(); 1239 neq.reset(); 1240 } 1207 1241 bool hasBounds() { 1208 1242 return max.hasBounds() || min.hasBounds() || eq.hasBounds() || neq.hasBounds(); … … 1233 1267 } 1234 1268 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) { 1235 1272 if ((max.hasBounds())&&(max.check(value) == above)) { 1236 message = lable + _T(": ") + formatAbove( THolder::toStringLong(value), type);1273 message = lable + _T(": ") + formatAbove(formatted_value, type); 1237 1274 return true; 1238 1275 } 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); 1240 1277 return true; 1241 1278 } 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); 1243 1280 return true; 1244 1281 } 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); 1246 1283 return true; 1247 1284 } else { … … 1250 1287 return false; 1251 1288 } 1252 1253 1289 }; 1254 1290 typedef ExactBounds<NumericBounds<unsigned long int, int_handler> > ExactBoundsULongInteger; -
include/nscapi/functions.hpp
rf33c12f r330af36 748 748 ////////////////////////////////////////////////////////////////////////// 749 749 750 template<class T , class U>750 template<class T> 751 751 struct tokenizer_data { 752 boost::escaped_list_separator<U> separator; // \\, ' ', \' 752 T perf_lable_enclosure; // ' 753 T perf_separator; // ' ' 753 754 T perf_item_splitter; // ; 754 755 T perf_equal_sign; // = … … 757 758 }; 758 759 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); 766 783 if (items.size() < 1) { 767 784 Plugin::Common::PerformanceData* perfData = payload->add_perf(); … … 777 794 perfData->set_type(Plugin::Common_DataType_FLOAT); 778 795 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)); 780 801 Plugin::Common_PerformanceData_FloatValue* floatPerfData = perfData->mutable_float_value(); 781 802 … … 800 821 typedef std::wstring t_string; 801 822 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("'"); 804 826 data.perf_equal_sign = _T("="); 805 827 data.perf_item_splitter = _T(";"); 806 828 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); 808 830 } 809 831 static void parse_performance_data(Plugin::QueryResponseMessage::Response *payload, std::string &perf) { 810 832 typedef std::string t_string; 811 833 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 = "'"; 814 837 data.perf_equal_sign = "="; 815 838 data.perf_item_splitter = ";"; 816 839 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); 818 841 } 819 842 -
include/nscapi/nscapi_plugin_wrapper.hpp
r98113da r330af36 298 298 } 299 299 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; 300 303 } catch (...) { 301 304 NSC_LOG_CRITICAL(_T("Unknown exception in: NSHandleCommand")); 305 return NSCAPI::returnUNKNOWN; 302 306 } 303 307 return NSCAPI::returnIgnored; -
include/utils.h
rf33c12f r330af36 57 57 else if (p__.first == (_T("MinCrit") postfix)) { obj.crit.min_ = p__.second; } 58 58 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 59 65 #define MAP_OPTIONS_EXACT_NUMERIC_ALL(obj, postfix) \ 60 66 else if (p__.first == (_T("warn") postfix)) { obj.warn = p__.second; } \ 61 67 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; } \ 62 78 63 79 #define MAP_OPTIONS_EXACT_NUMERIC_ALL_MULTI(obj, postfix) \ -
modules/CheckSystem/CheckSystem.cpp
rf7a074d r330af36 945 945 } 946 946 947 948 949 struct 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 982 class ProcessBound { 983 public: 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 }; 947 1031 /** 948 1032 * Check process state and return result … … 957 1041 NSCAPI::nagiosReturn CheckSystem::checkProcState(std::list<std::wstring> arguments, std::wstring &msg, std::wstring &perf) 958 1042 { 959 typedef checkHolders::CheckContainer<checkHolders::MaxMinStateBoundsStateBoundsInteger> StateContainer; 1043 typedef checkHolders::CheckContainer<ProcessBound> StateContainer; 1044 1045 // typedef checkHolders::CheckContainer<checkHolders::ExactBoundsState> StateContainer2; 1046 960 1047 if (arguments.empty()) { 961 1048 msg = _T("ERROR: Missing argument exception."); … … 977 1064 978 1065 979 tmpObject.data = _T("uptime");980 tmpObject.crit.state = _T("started");1066 //tmpObject.data = _T("uptime"); 1067 //tmpObject.crit.min = 1; 981 1068 982 1069 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) 984 1075 MAP_OPTIONS_STR(_T("Alias"), tmpObject.alias) 985 1076 MAP_OPTIONS_SHOWALL(tmpObject) … … 1003 1094 else { 1004 1095 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(); 1010 1111 } 1011 1112 MAP_OPTIONS_END() … … 1033 1134 break; 1034 1135 } 1035 #ifdef USE_BOOST1036 1136 } else if (match == match_regexp) { 1037 1137 try { … … 1051 1151 return NSCAPI::returnUNKNOWN; 1052 1152 } 1053 #else1054 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 #endif1058 1153 } else { 1059 1154 NSC_LOG_ERROR_STD(_T("Unsupported mode for: ") + (*proc).first); … … 1073 1168 } 1074 1169 } else { 1075 checkHolders::MaxMinStateValueType<int, checkHolders::state_type>value;1170 process_count_result value; 1076 1171 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; 1085 1174 } 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; 1091 1181 } 1092 1182 if (bFound && (*it).alias.empty()) { -
service/logger.hpp
r96c1461 r330af36 88 88 slave() : mq_(ip::open_only,queue_name.c_str()), plugins_loaded_(false), console_log_(false) { 89 89 #ifdef WIN32 90 if(!SetConsoleOutputCP(CP_UTF8)) { // 6500191 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 // } 93 93 #endif 94 94 } -
version.hpp
rf085f9b r330af36 1 1 #ifndef VERSION_HPP 2 2 #define VERSION_HPP 3 #define PRODUCTVER 0,4,0,11 24 #define STRPRODUCTVER "0,4,0,11 2"3 #define PRODUCTVER 0,4,0,113 4 #define STRPRODUCTVER "0,4,0,113" 5 5 #define STRPRODUCTDATE "2011-12-08" 6 6 #endif // VERSION_HPP -
version.txt
rf085f9b r330af36 1 1 version=0.4.0 2 build=11 22 build=113 3 3 date=2011-12-08
Note: See TracChangeset
for help on using the changeset viewer.








