[Check_mk (english)] email: custom notifications with PNP4nagios not working?

Eric Malenfant eric.malenfant at cira.ca
Thu Jul 28 17:44:03 CEST 2016

Took me a while – the ‘mail’ script from git is newer than what was shipped, so – I’ve pulled it down, and have modified the requisite lines.
Doesn’t really make sense to modify the script here – instead, it seems like whats missing, is the actual option within WATO to define the local path so it can be passed as PARAMETER_1

That to me would be the solution instead of hacking up a file that will get overwritten later when upgraded.

In anycase, line 550, modified to direct path

548     except:
549         # Non-omd environment - use plugin argument 1
550         path = "/usr/local/pnp4nagios/share/index.php"
551         php_save_path = "" # Using default path
552         skip_authorization = False
553         env = 'REMOTE_USER="%s"' % context['CONTACTNAME'].encode('utf-8')

Original:  path = context.get('PARAMETER_1', '')

With rule-based notifications enabled, is still fails.
Without rule-based notifications – yep, pnp4nagios graphs are now missing.

Eric Malenfant
Sr Systems Administrator
eric.malenfant at cira.ca<mailto:eric.malenfant at cira.ca>

From: Andreas Döhler [mailto:andreas.doehler at gmail.com]
Sent: July-27-16 4:04 PM
To: Eric Malenfant; checkmk-en at lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] email: custom notifications with PNP4nagios not working?

Hi Eric,

I would hard code the parameters for PNP according to your setup.
It would be more work to workaround the second problem :)

The line numbers are taken from the git status -- http://git.mathias-kettner.de/git/?p=check_mk.git;a=blob;f=notifications/mail

The changes must be made around line 540. Variable "path" needs to be build for your system. The environment with "REMOTE_USER" depends on your installation.

As your rule sets the variable "url_prefix" the second parameter is ignored.
If you want to look, line 700 onward gives the explanation.

Best regards

Eric Malenfant <eric.malenfant at cira.ca<mailto:eric.malenfant at cira.ca>> schrieb am Mi., 27. Juli 2016 um 21:47 Uhr:
First, this is check_mk (RAW) 1.2.8p5 on top of Nagios Core 4.1.1 (working fine) - not OMD.

2 separate problems have been observed:

1: without rule based notifications:
I can configure each user to use HTML email, and define the 2 required plugin arguments, pnp4nagios location, and URL (PARAMETER_1 and _2)
This works fine.. save that I also want to customize the Subject line, and what gets sent.
So, I have a rule defined for that.

notification_parameters.setdefault('mail', [])

notification_parameters['mail'] = [
  ( {'reply_to': 'nagios at cira.ca<mailto:nagios at cira.ca>', 'url_prefix': 'http://nagios/check_mk/', 'host_subject': u'$HOSTNAME$ - $EVENT_TXT$', 'service_subject': u'$HOSTNAME$/$SERVICEDESC$ $EVENT_TXT$', 'elements': ['address', 'abstime', 'reltime', 'longoutpu
t', 'ack_author', 'ack_comment', 'graph']}, [], ALL_HOSTS ),
] + notification_parameters['mail']

This doesn't seem to get applied at all.

Flip it around, for issue #2:

I enabled rule base notifications, created 1 single rule - and now my notication_parameters work, but pnp4nagios graphs don't get attached, and complaints in notify.log;

2016-07-27 14:51:24 Preparing flexible notifications for emalenfant
2016-07-27 14:51:24  Notification channel with plugin mail
2016-07-27 14:51:24      executing /usr/share/check_mk/notifications/mail
2016-07-27 14:51:24      Output: Failed to add graphs to mail. Continue without them. ('OMD_ROOT')

So now, notification_parameters does get applied correctly now, but no graphs, and no option to enter any plugin parameters.

Any work-arounds/solutions at this time for either of these 2 issues?
I'll take one or the other at this point.

Eric Malenfant
Sr Systems Administrator

The Canadian Internet Registration Authority (CIRA)
979 Bank Street, Suite 400
Ottawa, ON , K1S 5K5
Tel:   (613) 237-5335 Ext:267
Cel:   (613) 513-9314
Fax:  (613) 237-0534

e-mail: eric.malenfant at cira.ca<mailto:eric.malenfant at cira.ca>

checkmk-en mailing list
checkmk-en at lists.mathias-kettner.de<mailto:checkmk-en at lists.mathias-kettner.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mathias-kettner.de/pipermail/checkmk-en/attachments/20160728/bc121908/attachment-0001.html>

More information about the checkmk-en mailing list