Page 1 of 1

Duration readout in email notification

Posted: Mon Sep 17, 2018 10:32 am
by rkane
Hi all, I'm attempting to include a duration readout in an email notification. I've created an email template but do not see a variable for "duration". My commands (notify-host-by-email, notify-service-by-email) appear to be formatted as the old default email template....not my new one.

Here's what I'd like to have work

Code: Select all

%alertsummary%

Notification Type: %type%
Host: %host%
State: %hoststate% (%HOSTDURATION%)
Address: %hostaddress%
Info: %hostoutput%
Date/Time: %datetime%

Respond: %responseurl%
Nagios URL: %xiserverurl%
Here's what I get

Code: Select all

Nagios has detected a problem with this host.

Notification Type: PROBLEM
Host: CONF-1
State: DOWN (%HOSTDURATION%)
Address: CONF-1
Info: check_icmp: Failed to resolve CONF-1
Date/Time: 2018-09-17 10:11:29

Re: Duration readout in email notification

Posted: Mon Sep 17, 2018 2:44 pm
by scottwilkerson
rkane wrote:

Code: Select all

    %alertsummary%

    Notification Type: %type%
    Host: %host%
    State: %hoststate% (%HOSTDURATION%)
    Address: %hostaddress%
    Info: %hostoutput%
    Date/Time: %datetime%

    Respond: %responseurl%
    Nagios URL: %xiserverurl%
what you have here looks like a template for the xi_host_notification_handler and xi_service_notification_handler, NOT what can be uses with notify-host-by-email, notify-service-by-email. These %macro% are special to this particular notification handler. You could add the duration macros $HOSTDURATION$ and $SERVICEDURATION$ using the following instructions starting on page 7

https://assets.nagios.com/downloads/nag ... iables.pdf

Re: Duration readout in email notification

Posted: Thu Sep 20, 2018 2:37 pm
by rkane
Duplicate thread, my apologies
Close 'er out

Re: Duration readout in email notification

Posted: Thu Sep 20, 2018 2:47 pm
by scottwilkerson
rkane wrote:Duplicate thread, my apologies
Close 'er out
Locking thread