Module: check_mk
Branch: master
Commit: 8c1ba1e88988f7c5fd63f36a73b346af99697e1f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8c1ba1e88988f7…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Dec 15 11:55:28 2016 +0100
EC: Use livestatus.LocalConnection() when fetching contact groups
Change-Id: I7bf22656cc7b3ffb116d7eef4c6f294cd9d94444
---
bin/mkeventd | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/bin/mkeventd b/bin/mkeventd
index 3fff2e2..2cc26d1 100755
--- a/bin/mkeventd
+++ b/bin/mkeventd
@@ -3994,7 +3994,7 @@ def add_rbn_contact_information(context, host, contact_groups,
contact_groups_no
if group_contacts == None:
group_contacts = set([])
-
group_contacts.update(fetch_contacts_of_group_from_livestatus(group_name))
+ group_contacts.update(contacts)
if group_contacts != None:
group_contacts = list(group_contacts)
@@ -4050,14 +4050,14 @@ def core_has_notifications_disabled(event):
def fetch_contacts_of_group_from_livestatus(group_name):
try:
- answer = livestatus_query("GET contactgroups\nFilter: name = %s\n"
- "Columns: members\nOutputFormat: python\n" %
group_name)
- if answer:
- contacts = eval(answer)[0][0]
- if "check-mk-notify" in contacts: # Remove artifical contact used
for rule based notifications
- contacts.remove("check-mk-notify")
- return contacts
- except: # TODO: Make this more specific
+ contacts = livestatus.LocalConnection().query_value(
+ "GET contactgroups\nFilter: name = %s\nColumns: members" %
group_name)
+ if "check-mk-notify" in contacts: # Remove artifical contact used for
rule based notifications
+ contacts.remove("check-mk-notify")
+ return contacts
+
+ except Exception, e:
+ log("Cannot determine contacts of group %s: %s" % (group_name, e))
if opt_debug:
raise