1

I'm trying to implement automatic monitoring using nagios/icinga and puppet.

Hosts and basic services are working but now I want to implement different checks for services based on hostgroups. While I could setup the hostgroups in hiera I want to be able to do the following:

Apply a class for each service (like ssh, http) which only "exports" a hostgroup-name (like "ssh-servers" and "http-servers" and also apply a base class which "collects" these names, joins them to a string and exports a nagios_host resource like this:

  @@nagios_host { $::fqdn:
    ensure     => present,
    use        => "generic-host",
    alias      => $::hostname,
    address    => $::ipaddress,
    hostgroups => $hostgroups, # this should be something like "ssh-servers, http-servers"
  }

I'm just starting with puppet and looked at virtual resources and exported resources but I'm not sure how to apply this correctly. Is this even possible?

Hameno
  • 351
  • 3
  • 14

1 Answers1

1

The export/import paradigm does not lend itself well to this type of data gathering. If you want to take advantage of it, you will need to define resource types that Just Work when gathered on the Nagios server from all the agent catalogs.

Your mileage might very well increase if you try and rely on PuppetDB queries instead. You get much more control this way.

Felix Frank
  • 8,125
  • 1
  • 23
  • 30