From 26c412af7430ac21eaf4c742cdc83b0c00306b44 Mon Sep 17 00:00:00 2001 From: Robert Sander Date: Thu, 4 Jan 2024 09:45:10 +0100 Subject: [PATCH 1/2] adds MKP for ups --- ups/ups-1.1.mkp | Bin 0 -> 1690 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ups/ups-1.1.mkp diff --git a/ups/ups-1.1.mkp b/ups/ups-1.1.mkp new file mode 100644 index 0000000000000000000000000000000000000000..bfc57d8f34478a3ccc07dac49f8647d5bad5d493 GIT binary patch literal 1690 zcmV;L24(pliwFo7#Fb?N|8;P4Eio=JE^TXY0PUM?Z`(Eyfb-eE;;N=|viVJpU$%4| z=Cw^?piKkCzVtYxGW^0C__aKE;^6q#?@<<6Fg$&}2 zuS^5!v|8COvi{rXHaZ(_tKDkvw3>}(2g^I1ZgT?~8;?M$4O7_U#<$7GGE2=oR^?qN z590|}21ZOyxq_cnO=nNP&bg2w{;TRVNn&McQ(mr=pgiT;S0XVYmR8-LbN|ds6AkZr z<0JSEUfO~rOlLy=E_03eLWVJ$dZ`Mn%G{Vl@7C)xVdm+i=EqU}plEEAw^h%rMrU=S zIIl-c8?NfuNMle(#b>7q~En!8+7i-hzP|1%YePxJa_t+^tR zF#n9r^4ez2tu>OJ?utOF*(Bs%Dvhvxco<9m>EYuqF#l_R=ve-T`QPcdYx&>pv?%`{ zC;y#1|D9cMz99dd3OGyYZ?!+4{+Ys3_FIjAkp0$NmWpWSW8SoVe1GkQbBZFE@mcAe z8Sh}mgJTokI#x7rmG6$tcW|Sme5`T;%$4{c@_K zj7-Du)4x3ac`wv#4*W;?-)!0Ewfyh4+m!#0!PQiLob})BwmSK5`)VFEyNy;c{*7+a z%DK&*hWnV~53mu%(wj%O%iUG~KjrC@da6}@B4nM*b4V_6GmxdHQ2o9NT>9};$k{HW zCaC`S9BZorcLZswaS&*3cA;ejOQol%vE^?=v*GT*Vhx945r_R~a)1I?e8E2R3z|mN z@my%YzW{du&~accnBva?F5?t@CIJ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K 2.2 --- ups/ups-1.1.mkp | Bin 1690 -> 0 bytes ups/ups-2.0.0.mkp | Bin 0 -> 1789 bytes ups/web/plugins/wato/active_checks_ups.py | 72 ++++++++++++++-------- 3 files changed, 45 insertions(+), 27 deletions(-) delete mode 100644 ups/ups-1.1.mkp create mode 100644 ups/ups-2.0.0.mkp diff --git a/ups/ups-1.1.mkp b/ups/ups-1.1.mkp deleted file mode 100644 index bfc57d8f34478a3ccc07dac49f8647d5bad5d493..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1690 zcmV;L24(pliwFo7#Fb?N|8;P4Eio=JE^TXY0PUM?Z`(Eyfb-eE;;N=|viVJpU$%4| z=Cw^?piKkCzVtYxGW^0C__aKE;^6q#?@<<6Fg$&}2 zuS^5!v|8COvi{rXHaZ(_tKDkvw3>}(2g^I1ZgT?~8;?M$4O7_U#<$7GGE2=oR^?qN z590|}21ZOyxq_cnO=nNP&bg2w{;TRVNn&McQ(mr=pgiT;S0XVYmR8-LbN|ds6AkZr z<0JSEUfO~rOlLy=E_03eLWVJ$dZ`Mn%G{Vl@7C)xVdm+i=EqU}plEEAw^h%rMrU=S zIIl-c8?NfuNMle(#b>7q~En!8+7i-hzP|1%YePxJa_t+^tR zF#n9r^4ez2tu>OJ?utOF*(Bs%Dvhvxco<9m>EYuqF#l_R=ve-T`QPcdYx&>pv?%`{ zC;y#1|D9cMz99dd3OGyYZ?!+4{+Ys3_FIjAkp0$NmWpWSW8SoVe1GkQbBZFE@mcAe z8Sh}mgJTokI#x7rmG6$tcW|Sme5`T;%$4{c@_K zj7-Du)4x3ac`wv#4*W;?-)!0Ewfyh4+m!#0!PQiLob})BwmSK5`)VFEyNy;c{*7+a z%DK&*hWnV~53mu%(wj%O%iUG~KjrC@da6}@B4nM*b4V_6GmxdHQ2o9NT>9};$k{HW zCaC`S9BZorcLZswaS&*3cA;ejOQol%vE^?=v*GT*Vhx945r_R~a)1I?e8E2R3z|mN z@my%YzW{du&~accnBva?F5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1rr^I4{AP9mW2!bF8f*=TjAP9mW2!bF8f*=Tj fAP9mW2!bF8f*=TjAP9mWh?nOVaU4V!0C)fZqpgx; literal 0 HcmV?d00001 diff --git a/ups/web/plugins/wato/active_checks_ups.py b/ups/web/plugins/wato/active_checks_ups.py index 37f759a3..70490c63 100644 --- a/ups/web/plugins/wato/active_checks_ups.py +++ b/ups/web/plugins/wato/active_checks_ups.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- encoding: utf-8; py-indent-offset: 4 -*- # @@ -17,33 +17,51 @@ # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301 USA. -group = "activechecks" +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + Integer, + TextAscii, +) -register_rule(group, - "active_checks:ups", - Dictionary( - title = _("Check UPS"), - help = _("Checks UPS values"), - elements = [ - ( "hostname", - TextAscii(title = _("DNS Hostname or IP address"), - default_value = "$HOSTADDRESS$", - ), - ), - ( "upsname", - TextAscii(title = _("UPS Name"), - allow_empty = False, - ), +from cmk.gui.plugins.wato import ( + rulespec_registry, + HostRulespec, +) + +from cmk.gui.plugins.wato.active_checks.common import ( + RulespecGroupIntegrateOtherServices, +) + +def _valuespec_active_checks_ups(): + return Dictionary( + title = _("Check UPS"), + help = _("Checks UPS values"), + elements = [ + ( "hostname", + TextAscii(title = _("DNS Hostname or IP address"), + default_value = "$HOSTADDRESS$", ), - ( "port", - Integer(title = _("Port number"), - minvalue = 1, - maxvalue = 65535, - default_value = 3493, - ), + ), + ( "upsname", + TextAscii(title = _("UPS Name"), + allow_empty = False, ), - ] - ), - match = 'all' - ) + ), + ( "port", + Integer(title = _("Port number"), + minvalue = 1, + maxvalue = 65535, + default_value = 3493, + ), + ), + ] + ) +rulespec_registry.register( + HostRulespec( + group=RulespecGroupIntegrateOtherServices, + match_type="all", + name="active_checks:ups", + valuespec=_valuespec_active_checks_ups, + ))