Module: check_mk
Branch: master
Commit: 7826043dfc32b6c649d23cd4d70effe453271bc2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7826043dfc32b6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 17 11:09:24 2017 +0200
5397 Microcore can now be configured to send UNREACHABLE notifications
Normally you don't want to receive UNREACHABLE notifications of hosts. Configuring
client/parent relationships between your hosts is a good idea to be able to
detect network outages. DOWN states of hosts will then be translated into UNREACHABLE,
making your view clear for the real cause (e.g. a router in DOWN state).
But there may be situations where you want to be able to receive these UNREACHABLE
notifications. This was already configurable when using the Nagios core for a long
time. For the Microcore the suppression of UNREACHABLE notifications was hard coded.
This has been changed now.
The default behaviour will not be changed. New sites or updates sites will not send
out UNREACHABLE notifications by default. To enable the new feature, you will first
have to tell the core to send out UNREACHABLE notifications.
To have a seamless transition we additionally changed these things:
<ul>
<li>A default rule that disables the UNREACHABLE notifications is being created
for new sites in the ruleset "Notified events for hosts". Whenever you want
to enable UNREACHABLE notifications, simply enable them using this rule.</li>
<li>Updated sites:
<ul>
<li>If you have configured rules for all your hosts in the
"Notified events for hosts" ruleset, the core will continue working
as configured.</li>
<li>Microcore: For hosts that have no matching rule in "Notified events
for hosts",
the Microcore will <i>not send</i> out UNREACHABLE
notifications.</li>
<li>Microcore: If you previously had configured a rule in "Notified
events for hosts"
which enabled the UNREACHABLE notifications, this rule had no effect. It will now
be working after updating.</li>
<li>Nagios: For hosts that have no matching rule in "Notified events
for hosts",
the Nagios core will <i>send</i> out UNREACHABLE
notifications.</li>
</ul>
</li>
</ul>
Change-Id: Ie6dab1970f9e0dd433986e38b84a604a7a26c552
---
.werks/5397 | 44 ++++++++++++++++++++++++++++++
web/htdocs/wato.py | 23 ++++++++++++----
web/plugins/wato/check_mk_configuration.py | 10 +++++--
3 files changed, 69 insertions(+), 8 deletions(-)
diff --git a/.werks/5397 b/.werks/5397
new file mode 100644
index 0000000..631ab5a
--- /dev/null
+++ b/.werks/5397
@@ -0,0 +1,44 @@
+Title: Microcore can now be configured to send UNREACHABLE notifications
+Level: 2
+Component: core
+Compatible: compat
+Edition: cee
+Version: 1.5.0i1
+Date: 1508230324
+Class: feature
+
+Normally you don't want to receive UNREACHABLE notifications of hosts. Configuring
+client/parent relationships between your hosts is a good idea to be able to
+detect network outages. DOWN states of hosts will then be translated into UNREACHABLE,
+making your view clear for the real cause (e.g. a router in DOWN state).
+
+But there may be situations where you want to be able to receive these UNREACHABLE
+notifications. This was already configurable when using the Nagios core for a long
+time. For the Microcore the suppression of UNREACHABLE notifications was hard coded.
+This has been changed now.
+
+The default behaviour will not be changed. New sites or updates sites will not send
+out UNREACHABLE notifications by default. To enable the new feature, you will first
+have to tell the core to send out UNREACHABLE notifications.
+
+To have a seamless transition we additionally changed these things:
+
+<ul>
+<li>A default rule that disables the UNREACHABLE notifications is being created
+ for new sites in the ruleset "Notified events for hosts". Whenever you
want
+ to enable UNREACHABLE notifications, simply enable them using this rule.</li>
+<li>Updated sites:
+ <ul>
+ <li>If you have configured rules for all your hosts in the
+ "Notified events for hosts" ruleset, the core will continue working
+ as configured.</li>
+ <li>Microcore: For hosts that have no matching rule in "Notified
events for hosts",
+ the Microcore will <i>not send</i> out UNREACHABLE
notifications.</li>
+ <li>Microcore: If you previously had configured a rule in "Notified
events for hosts"
+ which enabled the UNREACHABLE notifications, this rule had no effect. It will
now
+ be working after updating.</li>
+ <li>Nagios: For hosts that have no matching rule in "Notified events
for hosts",
+ the Nagios core will <i>send</i> out UNREACHABLE
notifications.</li>
+ </ul>
+</li>
+</ul>
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 5bc3204..24cf9be 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -7990,9 +7990,11 @@ def event_rule_match_conditions(flavour):
( "match_host_event",
ListChoice(
title = _("Match host event type"),
- help = _("Select the host event types and transitions this rule
should handle. Note: "
- "If you activate this option and do <b>not</b>
also specify service event "
- "types then this rule will never hold for service
notifications!"),
+ help = _("Select the host event types and transitions this rule
should handle.<br>"
+ "Note: If you activate this option and do
<b>not</b> also specify service event "
+ "types then this rule will never hold for service
notifications!<br>"
+ "Note: You can only match on event types <a
href=\"%s\">created by the core</a>.") % \
+
"wato.py?mode=edit_ruleset&varname=extra_host_conf%3Anotification_options",
choices = [
( 'rd', _("UP") + u" ➤ " +
_("DOWN")),
( 'ru', _("UP") + u" ➤ " +
_("UNREACHABLE")),
@@ -8013,9 +8015,11 @@ def event_rule_match_conditions(flavour):
( "match_service_event",
ListChoice(
title = _("Match service event type"),
- help = _("Select the service event types and transitions this rule
should handle. Note: "
- "If you activate this option and do <b>not</b>
also specify host event "
- "types then this rule will never hold for host
notifications!"),
+ help = _("Select the service event types and transitions this rule
should handle.<br>"
+ "Note: If you activate this option and do
<b>not</b> also specify host event "
+ "types then this rule will never hold for host
notifications!<br>"
+ "Note: You can only match on event types <a
href=\"%s\">created by the core</a>.") % \
+
"wato.py?mode=edit_ruleset&varname=extra_service_conf%3Anotification_options",
choices = [
( 'rw', _("OK") + u" ➤ " +
_("WARN")),
( 'rr', _("OK") + u" ➤ " +
_("OK")),
@@ -14768,6 +14772,13 @@ def create_sample_config():
],
},
+ # Disable unreachable notifications by default
+ 'extra_host_conf': {
+ 'notification_options': [
+ ( 'd,r,f,s', [], ALL_HOSTS, {} ),
+ ],
+ },
+
# Periodic service discovery
'periodic_discovery': [
({'severity_unmonitored': 1,
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index fbdd4e0..e579999 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -1731,13 +1731,19 @@ register_rule(group,
( "f", _("Start or end of flapping state")),
( "s", _("Start or end of a scheduled downtime")),
],
- default_value = [ "d", "u", "r", "f",
"s" ],
+ default_value = [ "d", "r", "f", "s"
],
),
title = _("Notified events for hosts"),
help = _("This ruleset allows you to restrict notifications of host problems
to certain "
"states, e.g. only notify on DOWN, but not on UNREACHABLE. Please
select the types "
"of events that should initiate notifications. Please note that
several other "
- "filters must also be passed in order for notifications to finally
being sent out."),
+ "filters must also be passed in order for notifications to finally
being sent out."
+ "<br><br>"
+ "Please note: There is a difference between the Microcore and Nagios
when you have "
+ "a host that has no matching rule in this ruleset. In this case the
Microcore will "
+ "not send out UNREACHABLE notifications while the Nagios core would
send out "
+ "UNREACHABLE notifications. To align this behaviour, create a rule
matching "
+ "all your hosts and configure it to either send UNREACHABLE
notifications or not."),
forth = lambda x: x != 'n' and x.split(",") or [],
back = lambda x: ",".join(x) or "n",
),