Sattelite host services - enable_perfdata by hostname

This forum was archived to /woltlab and is now in read-only mode.
  • Hi,


    I have this situation. I have monitoring in some comapanies and I have my server set up like master to see all status on one place. There are web gui with performance graphs on 90% of icinga2 servers. But I need to collect perfdata on my server for that 10%. When I want to set condition or use host.enable_perfdata in template Service "satellite-service" it not work - template is loaded before is host definition.


    For host I use this:

    Code
    1. template Host "satellite-host" {
    2. var perf_list = [ "server1", "server2", "server3" ]
    3. if ( this.name in perf_list ) {
    4. import "pnp-hst"
    5. enable_perfdata = true
    6. } else {
    7. enable_perfdata = false
    8. }
    9. }

    Is there any way to do it on service based on host name?


    Thanks a lot and happy xmas :)

  • Is there any way to do it on service based on host name?


    Thanks a lot and happy xmas

    Same to you.

  • I am sorry, may be I do not explain it good.


    I have from my satellites services and host in repository. Like this:

    Code
    1. object Service "users" {
    2. import "satellite-service"
    3. check_command = "dummy"
    4. host_name = "server25"
    5. zone = "zone2.cz"
    6. }


    I need to enable perfdata to theese services, but not all only from some servers.

  • Hello, i checked that the below is working:

    The post was edited 1 time, last by sru ().

  • This may be work, but services are generated automatically in this form. Is possible to change it some where? Of I need another solution. :(

  • @sulicz, i do not understand what you are after.


    • I gave you an "apply rule" based example (which auto-creates services) and you told me you need a "single service object" approach.
    • I modified your "single service object" example into an approved working one, and now you are stating that is not what you need.


    Could it be that we are shooting on moving targets here ;) ?



    This may be work, but services are generated automatically in this form

    "single service object" based configs do *not* auto create services. Apply Rules based ones do.

  • I am sorry - I do not explain it well.


    I have satellites which sends me configuration of hosts and services so services and hosts generated. I need to modify property of enable_perfdata to true based on host name.
    I case when import of template is before definition of host_name, there is no host name defined when template is compiled. I do not know how change form of autogenerated services or how to solve it other way.

  • I possible to modify template from which are generated files in repository.d/hosts. Configuration is loaded from remote nodes.

  • The bottom up mode has been deprecated in 2.6, so you should look for alternatives after all. One thing which could deal with such exception could be for instance Puppet or Ansible generating the actual configuration objects. Or you'll just keep managing them via the top down config sync.

  • It never is. But you'll find the reasons inside the release announcements from December as well as the linked issue.


    https://www.icinga.com/2016/12…inga-web-2-v2-4-released/


    I wrote some docs for a migration as well, in case you're planning to do so.
    https://docs.icinga.com/icinga…tom-up-migration-top-down