Nevermind, I've confused "apply" and "assign" (vs Object service) - I have it working now, thanks for the hint!

--
Tomasz Chmielewski
http://www.sslrack.com


On 2014-09-29 17:15 (Mon), Tomasz Chmielewski wrote:
And, if I comment out host_name, it refuses to start with:

[2014-09-29 15:11:36 +0000] critical/config:
Config error: Required attribute is missing: Object 'disk_nrpe' (Type:
'Service') at
/etc/icinga2/conf.d/hosts/server1.example.com/disk.conf:7 -> Attribute
'host_name'
[2014-09-29 15:11:36 +0000] critical/config: 1 errors, 0 warnings.


So it looks it's not possible to use "apply" keyword to assign
services to selected hosts? Or, how it is done?

--
Tomasz Chmielewski
http://www.sslrack.com


On 2014-09-29 17:08 (Mon), Tomasz Chmielewski wrote:
On 2014-09-29 14:15 (Mon), Kasia Macias wrote:
Maybe using "apply" keyword would be more convenient?
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/monitoring-basics#using-apply-services

I've tried to follow it, but Icinga2 refuses to start.

My host definition:

object Host "server1.example.com" {
  import "generic-host"

  address = "server1.example.com"

  vars.nrpe = "1"  # <------ added this variable
  vars.os = "Linux"
  vars.sla = "24x7"
}


My service definition:

object Service "disk_nrpe" {
  import "generic-service"

  host_name = "aww01.timedoctorstaging.com"

  check_command = "nrpe"
  vars.nrpe_command = "check_disk"
  vars.sla = "24x7"

  assign where host.vars.nrpe == "1"  # <------ added this line
# assign where "1" in host.vars.nrpe # <---- tried also this way, also errors
}


In the log, I can see:

[2014-09-29 14:58:22 +0000] critical/config: Location:
/etc/icinga2/conf.d/hosts/server1.example.com/disk.conf(5):  */
/etc/icinga2/conf.d/hosts/server1.example.com/disk.conf(6):
/etc/icinga2/conf.d/hosts/server1.example.com/disk.conf(7): object
Service "disk_nrpe" {

^^^^^^^^^^^^^^
/etc/icinga2/conf.d/hosts/server1.example.com/disk.conf(8):   import
"generic-service"
/etc/icinga2/conf.d/hosts/server1.example.com/disk.conf(9):

Config error:
[2014-09-29 14:58:22 +0000] critical/config: 1 errors, 0 warnings.


The error goes away if I remove the "assign" line added to service definition.

What am I doing wrong?
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to