Need help to setup Icinga2 on Raspi

Problem:
I want to setup host settings regarding Icinga2 on the puppet master server and I don’t know how to do that. I’m a beginner. I managed to setup foreman / puppet server and the the agent on the Raspi. I can manage the Raspi over foreman. I enable the classes “Icinga2” and “Icingaweb2” and I can now open the Icinga Webinterface.

What I don’t understand is: how do I setup e.g. the DB host for IcingaWeb2 in foreman?

Icinga says:

class {'icingaweb2':
  manage_repos   => true,
  import_schema  => true,
  db_type        => 'mysql',
  db_host        => 'localhost',
  db_port        => 3306,
  db_username    => 'icingaweb2',
  db_password    => 'supersecret',
  config_backend => 'db',
  extra_packages => [ 'git' ],
  require        => Mysql::Db['icingaweb2'],
}

But where to setup that? Sorry for the dumb questions :no_mouth:

Expected outcome:
Setup the parameters for the class that is attached to the host.

Foreman and Proxy versions:
Version 3.3.0

Distribution and version:
CentOS 7

Ok, the question is more about using Puppet within Foreman than about Icinga 2. From what you describe I think you managed to place Puppet classes on the Puppetserver managed by Foreman’s Smart-Proxy and import the classes into Foreman. You also managed to assign them at the host and it is working with the defaults. So the next step would be set the parameters.

Navigate to “Configure > Classes” and select the class, in the tab “Smart Class parameters” you can add a Default value, set the datatype and allow overrides so at host level you can change the value.

You will also need the mysql class and probably some custom puppet code as a ENC for Puppet can only manage classes and nit defined resources.

2 Likes

First of all: thank you very very much for the answer. I was a little bit lost :neutral_face:

Yes - correct.

Did that (or at least I think I did that).
The Icinga module docu says:

Setting up a Icinga Server with a CA and to store configuration:

class { '::icinga::server':
  ca            => true,
  ticket_salt   => 'supersecret',
  config_server => true,
  workers       => { 'dmz' => { 'endpoints' => { 'worker.example.org' => { 'host' => '172.16.2.11' }}, }},
  global_zones  => [ 'global-templates', 'linux-commands', 'windows-commands' ],
}

I then added the class icinga::server to my host and set some vars:

The question now is: In principal - is this äquivalent? Or do I miss something?

The puppet agent on my host gives me the error:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Missing title. The title expression resulted in undef (file: /etc/puppetlabs/code/environments/production/modules/icinga/manifests/ido.pp, line: 83, column: 15) on node raspberrypi.fritz.box

But this error says me almost nothing. I asked also in the Icinga forum. But sadly they are not very responsive…

Co you haven an Idea?
Thanks!

Christoph

It’s much easier to understand the error message if you posted the exact module version you have installed. I can only assume you have the latest icinga/icinga module from puppet forge 2.7.1. If that’s the case line 83 is this:

The title is undef, i.e. $ido_package_name has not been defined. It would be defined a few lines before

to either ::icinga2::globals::ido_mysql_package_name or ::icinga2::globals::ido_pgsql_package_name depending on $db_type. So either $db_type is not really set to either mysql or pgsql there or the globals are not defined in the icinga-icinga2 module. That picks up the default value via hiera in this file:

This is how this information should go. But that’s really pure puppet…