Setting up reccuring downtime - how

Hi :slight_smile:

I’m new here, so sorry if I’m posting that in wrong place…

I want to set recurring downtime for one certain host let’s say this_host_dt

I went through docs… but I don’t really feel how I should do that…
I have Icinga set up on production (not by me). But I do not really feel which file connects which file… so lets say I have

  • /etc/icinga2/zones.d/my_zone/this_host_dt
    should i add to its configuration

apply ScheduledDowntime “my-downtime” to Endpoint {
author = “icingaadmin”
comment = “Scheduled downtime for my host”

ranges = {
monday = “02:00-03:00”
}

assign where “this_host_dt” in client.endpoint (??)
}

To be more precised… I need to set recurring downtime for host this_host_dt and for one service on this host -> ping4
Thank you for any help :slight_smile:

I tried that:

so in /etc/icinga2/conf.d I create a file downtime_test.conf

/**
* The example downtime apply rule.
*/apply ScheduledDowntime "recurring_downtime" to Service {
author = "test"
comment = "Scheduled downtime for backup" 
ranges = {
monday = "service.vars.backup_downtime"
} 
assign where service.vars.backup_downtime != ""
assign where host.name == "this_host_dt"
}

to /etc/icinga2/conf.d/services/users.conf I’ve added vars.backup_downtime =“18:00-20:00”

apply Service "users" {
import "generic-service" 
check_command = "users" 
assign where host.name == NodeName
vars.backup_downtime ="18:00-20:00"
}

it doesn’t work though :frowning:

Hi and welcome to our community,

try this:

apply ScheduledDowntime "backup" to Service {

  author = "icingaadmin"
  comment = "Scheduled downtime for backup"

  ranges = host.vars.backup_downtime.ranges

  assign where host.name == "your_host" && service.name == "your_service"
}

object Host		"your_host" {
    	import		"generic-host"
    	address =	"000.00.00.000"
    	vars.backup_downtime = {
		ranges = {
		  saturday = "23:00-24:00"
		  sunday   = "00:00-01:00"
		}
	}
}
2 Likes

Hi!

Worked! Thank you so much!

Nice! :slight_smile:

Please mark it as solution to close this topic.

1 Like

Hi @keramaisa and a warm welcome from my side too!

I moved your post to the Icinga Core category, it seemed to fit there a little better.
If you are unsure where to post a topic, you can find little descriptions of them if you click the category from the front page :slight_smile:

I see that you have already used markdown in your addition to the post, but if you want to learn more about the formatting, there are some guidelines over here.

And, as Hendrik already said, please mark the answer that solved your problem as the “solution”

Have a wonderful day!
Feu