Icinga doesn't start: Validation failed for object

Hi,
my icinga installation does not start anymore.
The installation was working and I had configured icinga with Icinga Director.
I had configured a remote host (on hostname = ubuntu) and installed the agent on it. To do this I followed this guide “Working with Agents and Config Zones”.

Icinga is installed on a VM with hostname “lubuntu”.
The agent is installed in a VM with hostname “ubuntu”.

I made a mistake (I know, I’m an idiot) and from terminal I started the command:
icinga2 node wizard.

Here are the commands I entered:

root@lubuntu:~# icinga2 node wizard
Welcome to the Icinga 2 Setup Wizard!

We will guide you through all required configuration details.

Please specify if this is an agent/satellite setup ('n' installs a master setup) [Y/n]: n

Starting the Master setup routine...

Please specify the common name (CN) [lubuntu]: 
Reconfiguring Icinga...
Checking for existing certificates for common name 'lubuntu'...
Certificate '/var/lib/icinga2/certs//lubuntu.crt' for CN 'lubuntu' already existing. Skipping certificate generation.
Generating master configuration for Icinga 2.
'api' feature already enabled.

Master zone name [master]: 

Default global zones: global-templates director-global
Do you want to specify additional global zones? [y/N]: 
Please specify the API bind host/port (optional):
Bind Host []: 
Bind Port []: 

Do you want to disable the inclusion of the conf.d directory [Y/n]: 
Disabling the inclusion of the conf.d directory...
Checking if the api-users.conf file exists...

Done.

Now restart your Icinga 2 daemon to finish the installation!

I tried to restart Icinga, but I couldn’t.
After logging into the web interface I get this message: Monitoring backend ‘icinga’ is not running.

With the command “icinga2 daemon -C” I got the following configuration errors (?):

root@lubuntu:~# sudo icinga2 daemon -C
[2020-04-24 16:30:10 +0200] information/cli: Icinga application loader (version: r2.11.3-1)
[2020-04-24 16:30:10 +0200] information/cli: Loading configuration file(s).
[2020-04-24 16:30:10 +0200] warning/config: Ignoring directory '/var/lib/icinga2/api/zones/lubuntu' for unknown zone 'lubuntu'.
[2020-04-24 16:30:10 +0200] information/ConfigItem: Committing config item(s).
[2020-04-24 16:30:10 +0200] information/ApiListener: My API identity: lubuntu
[2020-04-24 16:30:10 +0200] critical/config: Error: Validation failed for object 'ubuntu' of type 'Zone'; Attribute 'zone': Object 'lubuntu' of type 'Zone' does not exist.
Location: in /var/lib/icinga2/api/packages/director/d2eb21c5-cdba-4dda-9809-f4dd1023fc15/zones.d/lubuntu/agent_zones.conf: 1:0-1:19
/var/lib/icinga2/api/packages/director/d2eb21c5-cdba-4dda-9809-f4dd1023fc15/zones.d/lubuntu/agent_zones.conf(1): object Zone "ubuntu" {
                                                                                                                 ^^^^^^^^^^^^^^^^^^^^
/var/lib/icinga2/api/packages/director/d2eb21c5-cdba-4dda-9809-f4dd1023fc15/zones.d/lubuntu/agent_zones.conf(2):     parent = "lubuntu"
/var/lib/icinga2/api/packages/director/d2eb21c5-cdba-4dda-9809-f4dd1023fc15/zones.d/lubuntu/agent_zones.conf(3):     endpoints = [ "ubuntu" ]

[2020-04-24 16:30:10 +0200] critical/config: 1 error
[2020-04-24 16:30:10 +0200] critical/cli: Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config.
root@lubuntu:~# 

This is the contents of the file /var/lib/icinga2/api/packages/director/d2eb21c5-cdba-4dda-9809-f4dd1023fc15/zones.d/lubuntu/agent_zones.conf:

object Zone "ubuntu" {
    parent = "lubuntu"
    endpoints = [ "ubuntu" ]
}

This is the contents of the file /etc/icinga2/zones.conf

/*
 * Generated by Icinga 2 node setup commands
 * on 2020-04-24 15:55:41 +0200
 */

object Endpoint "lubuntu" {
}

object Zone "master" {
        endpoints = [ "lubuntu" ]
}

object Zone "global-templates" {
        global = true
}

object Zone "director-global" {
        global = true
}

Please, can you suggest how to get icinga back up and running?
Thank you very much

Hi,
for me it looks as the zone “lubuntu” is missing in your director config.
You have a zone “ubuntu” which enpoint is “ubuntu” and its parent is “lubuntu”.
In director your zone is called “master”.
So let your zone “ubuntu” point to “master” as parent and it should be fine?
Best,
M.

1 Like

You post says your Icinga does not start anymore. So I’m guess it was working good at one time. Than you added client “ubuntu”. Correct? If this is correct, the command you posted show you running the node wizard on the master (lubuntu) again. You need to run the node wizard on the new agent (ubuntu) to get the agent working. If you ran the node wizard a 2nd time on the master your CA certificate will change and all agents will need to register with the master again.

Also check your zones.conf file. It may of changed after running the node wizard.

1 Like

Yes, before icinga worked perfectly.
I mean that icinga (on lubuntu) and the ubuntu host (where the agent is installed) worked. Both worked.
For example I could check the hard disk on ubuntu with the command “disk.”
Icinga stopped working when I started the command “icinga2 node wizard” on the host “lubuntu”

thanks for your help

Can you share your zone.conf file on master (lubuntu) and agent (ubuntu)?

Master (lubuntu) zone.conf:
/*
* Generated by Icinga 2 node setup commands
* on 2020-04-24 15:55:41 +0200
*/

object Endpoint "lubuntu" {
}

object Zone "master" {
        endpoints = [ "lubuntu" ]
}

object Zone "global-templates" {
        global = true
}

object Zone "director-global" {
        global = true
}

Agent (ubuntu) zone.conf:
/** Icinga 2 Config - proposed by Icinga Director */

object Endpoint "ubuntu" {}

object Zone "ubuntu" {
  parent = "lubuntu"
  endpoints = [ "ubuntu" ]
}

object Zone "lubuntu" {
  endpoints = [ "lubuntu" ]
}
object Endpoint "lubuntu" {
  host = "lubuntu"
}
object Zone "director-global" {
  global = true
}

thanks

The parent attributes on the zone object is pointing at itself. The parent attribute needs to point at your master zone. See @blindzero post earlier.

Agent (ubuntu) zone.conf

object Zone "ubuntu" {
  parent = "master"
  endpoints = [ "ubuntu" ]
}

Add the cluster-zone check command to all your agents to confirm they are connected correctly.

I’m sorry, I didn’t understand which file I need to edit.

  • Agent (ubuntu) zone.conf: /etc/icinga2/zones.conf ?
    or
  • Master (lubuntu) zone.conf: /var/lib/icinga2/api/packages/director/d2eb21c5-cdba-4dda-9809-f4dd1023fc15/zones.d/lubuntu/agent_zones.conf ?

thanks again for your help

Your zone lubuntu became invalid, I’d assume. It looks like to run icinga2 node wizard a second time and now you have a certificate failure. You would see this in the logs. You can also check icinga2 object list -n lubuntu.

1 Like

You need to edit the zone.conf file on the agent.

Did you follow the the node wizard step for agents?

1 Like

Hi,
on the master (lubuntu) I modified the file /etc/icinga2/zones.conf, from this

/*
* Generated by Icinga 2 node setup commands
* on 2020-04-24 15:55:41 +0200
*/


object Endpoint "lubuntu" {
}

object Zone "master" {
        endpoints = [ "lubuntu" ]
}

object Zone "global-templates" {
        global = true
}

object Zone "director-global" {
        global = true
}

to this

/*
 * Generated by Icinga 2 node setup commands
 * on 2020-04-24 15:55:41 +0200
 */

object Endpoint "lubuntu" {
}

object Zone "lubuntu" {
        endpoints = [ "lubuntu" ]
}

object Zone "global-templates" {
        global = true
}

object Zone "director-global" {
        global = true
}

After this edit the error messages have disappeared and the icinga is working again.

root@lubuntu:~# sudo icinga2 daemon -C
[2020-04-28 14:45:26 +0200] information/cli: Icinga application loader (version: r2.11.3-1)
[2020-04-28 14:45:26 +0200] information/cli: Loading configuration file(s).
[2020-04-28 14:45:26 +0200] information/ConfigItem: Committing config item(s).
[2020-04-28 14:45:26 +0200] information/ApiListener: My API identity: lubuntu
[2020-04-28 14:45:26 +0200] information/ConfigItem: Instantiated 1 FileLogger.
[2020-04-28 14:45:26 +0200] information/ConfigItem: Instantiated 1 NotificationComponent.
[2020-04-28 14:45:26 +0200] information/ConfigItem: Instantiated 1 IcingaApplication.
[2020-04-28 14:45:26 +0200] information/ConfigItem: Instantiated 3 Hosts.
[2020-04-28 14:45:26 +0200] information/ConfigItem: Instantiated 1 ApiListener.
[2020-04-28 14:45:26 +0200] information/ConfigItem: Instantiated 1 CheckerComponent.
[2020-04-28 14:45:26 +0200] information/ConfigItem: Instantiated 5 Zones.
[2020-04-28 14:45:26 +0200] information/ConfigItem: Instantiated 1 ExternalCommandListener.
[2020-04-28 14:45:26 +0200] information/ConfigItem: Instantiated 3 Endpoints.
[2020-04-28 14:45:26 +0200] information/ConfigItem: Instantiated 1 ApiUser.
[2020-04-28 14:45:26 +0200] information/ConfigItem: Instantiated 1 IdoMysqlConnection.
[2020-04-28 14:45:26 +0200] information/ConfigItem: Instantiated 237 CheckCommands.
[2020-04-28 14:45:26 +0200] information/ConfigItem: Instantiated 9 Services.
[2020-04-28 14:45:26 +0200] information/ScriptGlobal: Dumping variables to file '/var/cache/icinga2/icinga2.vars'
[2020-04-28 14:45:26 +0200] information/cli: Finished validating the configuration file(s).

I hope this is the right solution.
Thanks again for your help