ScheduledDowntime gets applied to all services instead of one

We have a service that is shutdown during the weekends and I scheduled downtime for that. However last weekend we noticed that all services of this server now have scheduled downtime instead of just that one service.

This is how my host definition looks like:

object Host "CONTROL_CENTER_001" {
  import "generic-host"

  address = "xxx.xxx.xxx.xxx"

  vars.os = "windows"
  vars.type = "server"
  vars.env = "prd"
  vars.notification_period = "24x7"
  vars.remote_client = "cc001"

  vars.remote_procs["Process: Control Center Service"] = {
        procs_critical = "1:"
        procs_warning = "1:"
        procs_command = "ControlCenter.exe"
  }

}

And below is how I scheduled the downtime:

apply ScheduledDowntime "controlcenter-ignore" to Service {
  author = "icingaadmin"
  comment = "Scheduled downtime for process Control Center Service"

  ranges = {
    friday = "23:00-24:00"
    saturday = "00:00-24:00"
    sunday = "00:00-23:00"
  }

  assign where host.vars.remote_procs["Process: Control Center Service"].procs_command == "ControlCenter.exe"
}

Hello @mchlrv and thank you for reporting!

Everything works as intended. E.g.:

object Host "h1" { }
object Host "h2" { }

apply Service "s1" { assign where true }
apply Service "s2" { assign where true }
apply Service "s3" { assign where true }

apply ScheduledDowntime "sd1" to Service { assign where host.name == "h1" }
  • There are two host, h1 and h2
  • The services s1, s2 and s3 are applied to all hosts (h1 and h2) resulting in:
    • h1!s1
    • h1!s2
    • h1!s3
    • h2!s1
    • h2!s2
    • h2!s3
  • The ScheduledDowntime sd1 apply rule (let’s say) iterates over all services (apply ... to Service):
    • h1!s1host.name == "h1" – true
    • h1!s2host.name == "h1" – true
    • h1!s3host.name == "h1" – true
    • h2!s1host.name == "h1" – false
    • h2!s2host.name == "h1" – false
    • h2!s3host.name == "h1" – false

Your config behaves the same – your assign where rule checks only for the host, so either all services of a host get that ScheduledDowntime – or none.

Best,
AK

Hi @Al2Klimov ,

Thanks for the your reply. I don’t think I get it, I apply the SD not to a host.name but to host.vars.remote_procs right?

Are you saying it is not possible to SD for only one service? So it is either all services os none? Or is my code wrong?

Regards,
Michael

Your code applies the SD to all services with host.vars.remote_procs["Process: Control Center Service"].procs_command == "ControlCenter.exe". It doesn’t difference the services of a host from each other. Maybe you’d like something like host.vars.remote_procs["Process: Control Center Service"].procs_command == "ControlCenter.exe" && service.name == "disk"?

1 Like

@Al2Klimov, thanks for the clarification, I’ve now solved it with the help of your solution.

1 Like

Hello and welcome to the community Michael!

I would like to ask you to mark the answer that helped you solve the problem you had as the ‘solution’.

This helps others with a similar problem to navigate the topic quicker and it’s clear for others that the problem has been resolved.

Thank you very much for posting!
Feu

1 Like