Apply service to servce

Hello guys,
My use case is as following:

I want to be able to create a service if host has a specific service.
For example:
If i’ve created a Service with http_check for host X, I would like to have an apply rule that create SSL Certificate check for the same host with the service variables.

Tried something like:

apply Service "my_custom_check" to Service {
  import "generic-service"
  host_name = service.host_name
  check_command = "check_ssl_cert"
  display_name = check + " My Custom Check"
  name  = check + "customSSL"

  enable_notifications = true

  ignore where service.vars.http_ssl != true || services.vars.ignore_certificate_check == true
  assign where service.check_command == http_check
}

But ofcourse it isn’t supported and I’m getting:

Error: ‘apply’ target type ‘Service’ is invalid

Any hints how can I achive such behavior without using host vars?

Hi,

the easiest way is to create set of service checks, put in that set both of this service checks and assign this service set like you did for a Service with http_check :smiley: