0

I'm trying to configure an Icinga2 Master Server with 2 Clients for the beginning. So I want the configuration like I'm configuring the Master and synchronize the Configs to the Clients. This works already, but if a client goes down. The Master says it is still up, because the clients are checking themselves. The tricky thing is that I can't work with IP's because all IP's are dynamic and I can't register a dyn-dns for every Server. Later it will be 30-50 Servers.

Hope someone can help me.

Tombart
  • 30,520
  • 16
  • 123
  • 136
Zunno
  • 1
  • 2

1 Answers1

0

You can use puppet-icinga2 which allows collecting information about nodes. On client side you'd create exportable resource (puppet code follows):

  @@icinga2::object::host { $::fqdn:
    display_name => $::fqdn,
    address      => $::ipaddress_eth0,
    check_command => 'hostalive',
    target        => "/etc/icinga2/zones.d/${::domain}/hosts.conf",
    zone          => $::fqdn,
  }

  @@::icinga2::object::endpoint { "$::fqdn":
      host => "$::ipaddress_eth0",
  }

  @@::icinga2::object::zone { "$::fqdn":
      endpoints => [ "$::fqdn", ],
      parent    => 'master',
  }

which will be propagated to master (PuppetDB is required):

  Icinga2::Object::Host <<| |>> { }
  Icinga2::Object::Endpoint <<| |>> { }
  Icinga2::Object::Zone <<| |>> { }

As long as the puppet master has stable DNS you'll have updated zone.conf. After puppet agent run on client host information gets registered in PuppetDB. Upon next puppet agent run on master it will have up-to-date information about the node.

Then you can implement a check from icinga master:

apply Service "ping" to Host {
  import "generic-service"

  check_command = "ping"
  zone = "master" //execute check from master zone
  assign where "linux-server" in host.groups
}

Note there are also other automation integrations like Ansible which might offer similar functionality.

Tombart
  • 30,520
  • 16
  • 123
  • 136