Using Director to create host dictionaries?

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


    I'm trying to learn how "apply" works in Icinga2 and have created the host and service definitions below. They work great but I have over 100 services on about 30 servers and I'm looking for the most maintainable way to implement this.


    Now I would like to know if it's possible to use Director to create the same kind of config so I can do without .conf files. I've looked at data fields and data lists in Director but it seems to me that I need dictionaries. I may completely misunderstand how Director could handle this and I'd really appreciate some direction.


    Can this type of config be created completely in Director?

    If so, what features of Director should I look at to do this?


    object Host "prodlxapp30" {
    import "nextouch-host"
    address ="10.60.222.yyy"
    # define http services for this host.
    vars.httpservices["BIG"]={
    display_name="BIG",
    action_url="https://BIGweb.domain.com/monitor/monitor.jsp",
    base_url="BIGweb.domain.com",
    service_ip="10.60.222.xxx"}
    vars.httpservices["BIGpublic"]={
    display_name="BIGPublic",
    action_url="https://BIGpublic.domain.com/monitor/monitor.jsp",
    base_url="BIGpublic.domain.com",
    # ssl value of 1 is inherited from "nextouch-host" but can be overridden here.
    # ssl=0,
    service_ip="10.60.222.xxx"}
    }



    # Apply this http check service to all services defined in vars.httpservices for any hosts.
    apply Service "Apply-Httpchecks" for (serviceName => config in host.vars.httpservices) {
    import "nextouch-service"
    vars += config
    display_name = vars.http.display_name
    host_name = host.name
    action_url = vars.action_url
    vars.http.vhost = vars.base_url
    vars.http_address = vars.service_ip
    vars.http.ssl = vars.ssl
    }


    Thanks!