Module: check_mk
Branch: master
Commit: 90c441a3ef64f3c1cfea8d39c13fe3990c5b066c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=90c441a3ef64f3…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 2 12:31:29 2014 +0100
#1583 FIX Can use contact groups without hosts/services assigned in RBN rules now
Contact groups without hosts/services assigned could be configured, but not
used when using Nagios as monitoring core. This has been fixed now. You can
now safely configure all existing contact groups as recipients for notifications.
---
.bugs/2156 | 8 ++++++--
.werks/1583 | 11 +++++++++++
ChangeLog | 1 +
modules/check_mk.py | 6 +++++-
4 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/.bugs/2156 b/.bugs/2156
index d71fe4b..2fb782d 100644
--- a/.bugs/2156
+++ b/.bugs/2156
@@ -1,9 +1,9 @@
Title: Do always create contact groups, even if no host/service is contained
Component: core
-State: open
+Class: bug
+State: done
Date: 2014-05-26 14:18:35
Targetversion: future
-Class: bug
The rule based notifications allow the selection of a contact group as
a rule's contact selection. If you create contact groups with WATO that do
@@ -14,3 +14,7 @@ Micro Core is not affected as it seems.
Beware: an unpatched Nagios might not consider this as a valid configuration.
If that is the case then we need a global config option. We then set this
option to True for OMD installations and patch Nagios in OMD.
+
+2014-12-02 12:27:52: changed state open -> done
+Contact groups with contacts assigned, but without host/services are now created
+within Nagios (they are already available within CMC).
diff --git a/.werks/1583 b/.werks/1583
new file mode 100644
index 0000000..3958ce5
--- /dev/null
+++ b/.werks/1583
@@ -0,0 +1,11 @@
+Title: Can use contact groups without hosts/services assigned in RBN rules now
+Level: 1
+Component: notifications
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417519674
+Class: fix
+
+Contact groups without hosts/services assigned could be configured, but not
+used when using Nagios as monitoring core. This has been fixed now. You can
+now safely configure all existing contact groups as recipients for notifications.
diff --git a/ChangeLog b/ChangeLog
index ade9e24..46bac54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -119,6 +119,7 @@
* 1168 FIX: HTML mails can now be configured to display graphs among each other...
* 1514 FIX: Try harder to detect previous hard state in notification when using
Nagios as core...
* 1582 FIX: Fixed missing graphs in mails when sending notifications to
non-contacts...
+ * 1583 FIX: Can use contact groups without hosts/services assigned in RBN rules
now...
BI:
* 1435 FIX: Saving BI aggregations: No longer reports 'Request-URI Too
Large'...
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 02679b1..ec26d4a 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1968,12 +1968,12 @@ def create_nagios_config(outfile = sys.stdout, hostnames = None):
for hostname in hostnames:
create_nagios_config_host(outfile, hostname)
+ create_nagios_config_contacts(outfile)
create_nagios_config_hostgroups(outfile)
create_nagios_config_servicegroups(outfile)
create_nagios_config_contactgroups(outfile)
create_nagios_config_commands(outfile)
create_nagios_config_timeperiods(outfile)
- create_nagios_config_contacts(outfile)
if extra_nagios_conf:
outfile.write("\n# extra_nagios_conf\n\n")
@@ -2654,6 +2654,10 @@ def create_nagios_config_contacts(outfile):
cnames.sort()
for cname in cnames:
contact = contacts[cname]
+ # Create contact groups in nagios, even when they are empty. This is needed
+ # for RBN to work correctly when using contactgroups as recipients which are
+ # not assigned to any host
+ contactgroups_to_define.update(contact.get("contactgroups", []))
# If the contact is in no contact group or all of the contact groups
# of the contact have neither hosts nor services assigned - in other
# words if the contact is not assigned to any host or service, then