Module: check_mk
Branch: master
Commit: 7bf1f1cb195feebe1958f2d61f245c1286127a36
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7bf1f1cb195feeā¦
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 2 11:57:29 2014 +0100
#1582 FIX Fixed missing graphs in mails when sending notifications to non-contacts
When sending HTML mails to mail addresses or contacts which are not assigned to
a host or service, the graphs were missing in the HTML mails. This has been fixed
now. To make it fully working, you need to use the Check_MK Monitoring System builds.
---
.bugs/2204 | 7 +++++--
.werks/1582 | 11 +++++++++++
ChangeLog | 1 +
notifications/mail | 5 ++++-
4 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/.bugs/2204 b/.bugs/2204
index 9047c86..39483fe 100644
--- a/.bugs/2204
+++ b/.bugs/2204
@@ -1,9 +1,9 @@
Title: Make PNP graphs in notifications user independent
Component: core
-State: open
+Class: bug
+State: done
Date: 2014-11-18 10:18:50
Targetversion: 1.2.5i1
-Class: bug
When using bulk notifications to send mails to a non-contact, the graphs can not
be fetched from PNP, because there is no user context. This seems to need a patch
@@ -12,3 +12,6 @@ livestatus for permission on the service or host.
A possible good fix could be to patch pnp that the permission check is disabled
when executed from command line.
+
+2014-12-02 11:55:17: changed state open -> done
+Fixed.
diff --git a/.werks/1582 b/.werks/1582
new file mode 100644
index 0000000..68b157a
--- /dev/null
+++ b/.werks/1582
@@ -0,0 +1,11 @@
+Title: Fixed missing graphs in mails when sending notifications to non-contacts
+Level: 1
+Component: notifications
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417517720
+Class: fix
+
+When sending HTML mails to mail addresses or contacts which are not assigned to
+a host or service, the graphs were missing in the HTML mails. This has been fixed
+now. To make it fully working, you need to use the Check_MK Monitoring System builds.
diff --git a/ChangeLog b/ChangeLog
index 3481d36..ade9e24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -118,6 +118,7 @@
* 1512 Bulk notification can now be grouped according to custom macro values...
* 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...
BI:
* 1435 FIX: Saving BI aggregations: No longer reports 'Request-URI Too
Large'...
diff --git a/notifications/mail b/notifications/mail
index e77c21b..60ba26c 100755
--- a/notifications/mail
+++ b/notifications/mail
@@ -380,15 +380,18 @@ def fetch_pnp_data(context, params):
# Autodetect the path in OMD environments
path = "%s/share/pnp4nagios/htdocs/index.php" %
context['OMD_ROOT']
php_save_path = "-d session.save_path=%s/tmp/php/session" %
context['OMD_ROOT']
+ env = 'REMOTE_USER="check-mk" SKIP_AUTHORIZATION=1'
except:
# Non-omd environment - use plugin argument 1
path = context.get('PARAMETER_1', '')
php_save_path = "" # Using default path
+ skip_authorization = False
+ env = 'REMOTE_USER="%s"' % context['CONTACTNAME']
if not os.path.exists(path):
raise GraphException('Unable to locate pnp4nagios index.php (%s)' %
path)
- return os.popen('REMOTE_USER="%s" php %s %s "%s"' %
(context['CONTACTNAME'], php_save_path, path, params)).read()
+ return os.popen('%s php %s %s "%s"' % (env, php_save_path, path,
params)).read()
def fetch_num_sources(context):
svc_desc = context['WHAT'] == 'HOST' and '_HOST_' or
context['SERVICEDESC']