Prevent email notifications during downtime

object host “(hostname)” {
basic config, nothing fancy
}

object Service “http” {
import “generic-service”
host_name = “(website)”
check_command = “http”
vars.http_uri="(website page)"
vars.downtime=“01:00-05:00”
vars.NotifyLevel=“Business”
}
Beginning around 2am the above service goes down as expected, yet Icinga continues to notify me via email. Normally a downed item would send me a text message as well as an email notification but the downtime above at least prevents the text message. Tried digging in a bit with this Advanced topic/help page here, but I don’t necessarily need to set a fancier downtime, rather just have the notifications respect the existing time frame above.

Can we also see the downtime and notification objects (for both email and text)?

Thank you Blake for the quick reply. downtime.conf:
apply ScheduledDowntime “service-downtime” to Service {
ranges = {
monday = host.vars.downtime
tuesday = host.vars.downtime
wednesday = host.vars.downtime
thursday = host.vars.downtime
friday = host.vars.downtime
saturday = host.vars.downtime
sunday = host.vars.downtime
}
assign where host.vars.downtime != “”
}

apply ScheduledDowntime “host-downtime” to Host {
ranges = {
monday = host.vars.downtime
tuesday = host.vars.downtime
wednesday = host.vars.downtime
thursday = host.vars.downtime
friday = host.vars.downtime
saturday = host.vars.downtime
sunday = host.vars.downtime
}
assign where host.vars.downtime != “”
}

For notification objects, would you be referring to something like /etc/icinga2/notif.conf

Hi :slight_smile: and welcome,

What is the content of this variable on the host?
The downtime variable of the service definition is not used anywhere in your apply rule.

So either change the downtime config for the service to something like

apply ScheduledDowntime “service-downtime” to Service {
ranges = {
	monday = service.vars.downtime
	tuesday = service.vars.downtime
	wednesday = service.vars.downtime
	thursday = service.vars.downtime
	friday = service.vars.downtime
	saturday = service.vars.downtime
	sunday = service.vars.downtime
}
assign where service.vars.downtime != “”
}

or add the correct downtime window to the host variable(be aware that this would also change the hosts downtime!)

Also please use the options to format your posts, e.g. with code tags at the beginning and the end of code/config snippets. ```
Here is a guide:

Thanks for the replies, I’m good to go! Blake’s question referring me towards downtime.conf explained the issue. Since any service-downtime referred back to any downtime set for a host object, my service downtime was never going to work! Seemingly simple but as somebody who is coming into an environment where Icinga is already setup and I’m learning on the job, both Blake’s and log1c’s posts were quite helpful.