Page 1 of 1

Email Notification Message Variable for Notify TimePeriod

Posted: Mon Mar 20, 2017 12:01 pm
by haimster2797
I am running Nagios XI 2014R2.3. We are in production and all is working great. My question is in relation to the e-mail notification Messages variables. I want to put in my "Host Alert Message" and "Service Alert Message" body of the email the setting that is defined in "Notifications" section of a service/host that says "TIMEPERIOD" where you can customize to notify 24x7 or 8x5 or M - Fri, etc. This way our Operations folks will see in the e-mail this is 8x5 notification only vs one that is 24x7 so they know to page out or not during what hours.

Is there a defined variable for this and/or if I need to do a custom, can someone guide me step-by-step to configure that?


Thanks!

Re: Email Notification Message Variable for Notify TimePerio

Posted: Mon Mar 20, 2017 2:09 pm
by rkennedy
Take a look at https://assets.nagios.com/downloads/nag ... iables.pdf

You would either need to use custom vars, or possible look at these ones provided through Core. https://assets.nagios.com/downloads/nag ... olist.html

This might be what you're after -

Code: Select all

$ISVALIDTIME:$ 9	
This is a special on-demand macro that returns a 1 or 0 depending on whether or not a particular time is valid within a specified timeperiod. There are two ways of using this macro:

$ISVALIDTIME:24x7$ will be set to "1" if the current time is valid within the "24x7" timeperiod. If not, it will be set to "0".
$ISVALIDTIME:24x7:timestamp$ will be set to "1" if the time specified by the "timestamp" argument (which must be in time_t format) is valid within the "24x7" timeperiod. If not, it will be set to "0".

Re: Email Notification Message Variable for Notify TimePerio

Posted: Mon Mar 20, 2017 2:35 pm
by dwhitfield
One option we have too if you don't like what @rkennedy has provided is we could put in a feature request. Unfortunately, this would mean upgrading to the latest version once it is included. Is that something that would interest you?

I did look at the macros included in 4, and it does not appear we have exactly what you want there: https://assets.nagios.com/downloads/nag ... olist.html

Re: Email Notification Message Variable for Notify TimePerio

Posted: Mon Mar 20, 2017 4:20 pm
by haimster2797
If it was something already available which appears to not be the case, I think we will pass at this time. If that is something they could build in as a feature request down the road that would be great. It would be nice when receiving the e-mail notifications if you can add the variable for whether a host/service notification is 24x7 or 8x5 notify only. Reason being is unless you are an admin, you cannot see if a host/service is 24x7 or 8x5 notification setting without editing the host in core config. For a NOC, seeing right on the e-mail if 24x7 or 8x5 notify right away would be very efficient I think to anyone.

Example:
If schedule 1 was:
M - Fri 8am - 5pm

Schedule 2 was:
24x7x365

Schedule 3 was:
M - Thu 8am - 5pm
Fri 8am - 10pm


On my Alert e-mail notification for a host configured with schedule 3, if the variable would present the entire schedule defined for that Host/Service and show it to me like so:

***** Nagios XI Alert **********

*****Notification Hours******
(Variable here)
Schedule 3:
M - Thu 8am - 5pm
Fri 8am - 10pm
********************************

Nagios has detected a problem with this service.

Notification Type: PROBLEM

Service: TapiSrv
Host: SERVER1
Address: SERVER1
State: CRITICAL
Info:
TapiSrv: Stopped
Date/Time: 2017-03-20 15:21:02



The other option that could be helpful is on the "Status Details" screen to show the defined schedule chosen there as well so you don't have to edit the job to see what its schedule is. This way you can see what the notification schedule is if you are looking from Nagios on a critical host and want to know if notify 24x7 or work hours. Going a step further, if you hover your mouse over the wording of your defined schedule "Schedule 3" for example, it will show you the value in a little preview bubble which would show the days / hours / times.

Re: Email Notification Message Variable for Notify TimePerio

Posted: Tue Mar 21, 2017 10:21 am
by dwhitfield
I have created feature request https://github.com/NagiosEnterprises/na ... issues/350 for this issue. It's possible they will do something with this in XI rather than Core, but Core seems like the proper place (the current version of XI uses Core 4.2.4, for example). There is no guarantee this will be added, and I certainly do not have a time frame.

That said, are we ready to close this ticket or did you want to add more to the request?

Re: Email Notification Message Variable for Notify TimePerio

Posted: Tue Mar 21, 2017 10:42 am
by haimster2797
No, you can close it out. Thanks for all the help!

Re: Email Notification Message Variable for Notify TimePerio

Posted: Tue Jan 09, 2018 5:22 pm
by dwhitfield
This request will be included in Core 4.4: https://github.com/NagiosEnterprises/na ... issues/350

At this time, I cannot say when this will make it into XI, but Core 4.4 will NOT be in XI 5.5.