Duration readout in email notification

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
rkane
Posts: 114
Joined: Wed Aug 15, 2018 3:56 pm

Duration readout in email notification

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Duration readout in email notification

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
rkane
Posts: 114
Joined: Wed Aug 15, 2018 3:56 pm

Re: Duration readout in email notification

Post by rkane »

Duplicate thread, my apologies
Close 'er out
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Duration readout in email notification

Post by scottwilkerson »

rkane wrote:Duplicate thread, my apologies
Close 'er out
Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked