Module: check_mk
Branch: master
Commit: 9e25c7b620a6f2b566c157c98ade89f81a75f654
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9e25c7b620a6f2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 20 10:31:16 2017 +0100
5532 Host/Service states and outputs can now be translated
The states and service status detail of hosts and services can now be translated. You can now
use the rules {{Host state translation}} and {{Service state translation}} to configure the
Check_MK core to translate either specific states to other states or the status detail to other
texts.
States: For each host/service you can configure a transformation of each possible monitoring state
to another one.
The state translation can, for example, be used to inverse a host check in case you want to get
a notification in case a host becomes reachable.
The translation of detail outputs is done using regular expressions. You can specify multiple
regular expressions (infix match, case sensitive) per object which are applied to the current
status detail. The matched text will be replaced by the specified replacement text. You can
use match groups to extract parts of the original text using the regular expression.
Change-Id: I1f81a91bfbedcf3a3f14566fe5a7a121418f38fe
---
.werks/5532 | 24 ++++++++++++++++++++++++
web/htdocs/valuespec.py | 12 ++++++++++++
2 files changed, 36 insertions(+)
diff --git a/.werks/5532 b/.werks/5532
new file mode 100644
index 0000000..c9f53df
--- /dev/null
+++ b/.werks/5532
@@ -0,0 +1,24 @@
+Title: Host/Service states and outputs can now be translated
+Level: 2
+Component: cmc
+Compatible: compat
+Edition: cee
+Version: 1.5.0i2
+Date: 1511169817
+Class: feature
+
+The states and service status detail of hosts and services can now be translated. You can now
+use the rules {{Host state translation}} and {{Service state translation}} to configure the
+Check_MK core to translate either specific states to other states or the status detail to other
+texts.
+
+States: For each host/service you can configure a transformation of each possible monitoring state
+to another one.
+
+The state translation can, for example, be used to inverse a host check in case you want to get
+a notification in case a host becomes reachable.
+
+The translation of detail outputs is done using regular expressions. You can specify multiple
+regular expressions (infix match, case sensitive) per object which are applied to the current
+status detail. The matched text will be replaced by the specified replacement text. You can
+use match groups to extract parts of the original text using the regular expression.
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 8de080f..a09712a 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -1733,6 +1733,7 @@ class DropdownChoice(ValueSpec):
# Special conveniance variant for monitoring states
+# TODO: Rename to ServiceState() or something like this
class MonitoringState(DropdownChoice):
def __init__(self, **kwargs):
choices = [ ( 0, _("OK")),
@@ -1742,6 +1743,17 @@ class MonitoringState(DropdownChoice):
kwargs.setdefault("default_value", 0)
DropdownChoice.__init__(self, choices=choices, **kwargs)
+
+class HostState(DropdownChoice):
+ def __init__(self, **kwargs):
+ choices = [
+ ( 0, _("UP")),
+ ( 1, _("DOWN")),
+ ( 2, _("UNREACHABLE")),
+ ]
+ kwargs.setdefault("default_value", 0)
+ DropdownChoice.__init__(self, choices=choices, **kwargs)
+
# A Dropdown choice where the elements are ValueSpecs.
# The currently selected ValueSpec will be displayed.
# The text representations of the ValueSpecs will be used as texts.
Module: check_mk
Branch: master
Commit: 1fc70e65f80cfd79da72f66344d0c0319733a39c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1fc70e65f80cfd…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Mon Nov 20 08:42:01 2017 +0100
5548 FIX zpool_status: Fixed crash if pool has been deleted or vanished
The service would crash if a previously detected pool has been removed/deleted
or vanished for some reasons. This is now fixed and the service output will
reflect that no pool is available.
Change-Id: Id55b02802f69893e9949775e92b497910d99e1fe
---
.werks/5548 | 12 ++++++++++++
checks/zpool_status | 2 ++
2 files changed, 14 insertions(+)
diff --git a/.werks/5548 b/.werks/5548
new file mode 100644
index 0000000..9b1949e
--- /dev/null
+++ b/.werks/5548
@@ -0,0 +1,12 @@
+Title: zpool_status: Fixed crash if pool has been deleted or vanished
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1511163595
+Class: fix
+
+The service would crash if a previously detected pool has been removed/deleted
+or vanished for some reasons. This is now fixed and the service output will
+reflect that no pool is available.
diff --git a/checks/zpool_status b/checks/zpool_status
index f0cbfe4..a700226 100644
--- a/checks/zpool_status
+++ b/checks/zpool_status
@@ -71,6 +71,8 @@ def inventory_zpool_status(info):
def check_zpool_status(_no_item, _no_params, info):
if " ".join(info[0]) == "all pools are healthy":
return 0, "All pools are healthy"
+ elif " ".join(info[0]) == "no pools available":
+ return 3, "No pools available"
start_pool = False
multiline = False