All hosts disappear after run of icinga node setup

Hi, am somewhat a newb to icinga2 so this is probably a configuration issue. Can’t seem to find anyone else that has had this issue though. After a clean install of icinga2 and icinga2web on CentOS, everything looks good. Can see all my hosts and services, all is green. I want this install to be my Master, so I run the icinga2 node wizard. After I run the wizard and restart icinga2 all my hosts and services disappear. I see them in my etc/icinag2/conf.d/hosts.conf file, but nothing on the web page.

On the node setup wizard I answered the questions as follows:
Please specify if this is a satellite/client setup (‘n’ installs a master setup) [Y/n]: n
Please specify the common name (CN) [icinga2-master1.mydomain.com]:
Master zone name [master]:
Do you want to specify additional global zones? [y/N]: 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.
At this point all my hosts/endpoints are switches and routers. Just doing simple snmp and hostalive checks. Do I need to change the entries in my hosts.conf and services.conf to make them visible again?

Do you want to disable the inclusion of the conf.d directory

So the default was Y, I don’t see a “no” specified. If your hosts/services are in conf.d, you’ll want to edit icinga2.conf to re-include that directory. That particular question is for when you’re setting up something with master and satellite zones in zones.d and don’t want conf.d conflicting. Were you planning on satellite zones, or is it just the one server you’re working with here?

1 Like

Hi Blake, right now I just want one main server. In the future I may have satellite zones (ie some branches that connect to HQ). Want to keep it simple at first until I am better acquainted with the software and know what I am doing. I believe I just hit enter and accepted the default for that last question.

Okay, yeah, if you uncomment out this line in /etc/icinga2/icinga.conf:

//include_recursive "conf.d"

Everything will go back to normal after a reload. It’s at the bottom.

Thanks. That worked. After I uncommented that, icinga2 would not restart. Threw the error:
critical/config: Error: Object ‘root’ of type ‘ApiUser’ re-defined: in /etc/icinga2/conf.d/api-users.conf: 4:1-4:21; previous definition: in /etc/icinga2/conf.d/api-users.conf: 4:1-4:21

So it looks like the wizard also uncommented the line:
include “conf.d/api-users.conf”

Once I commented that line out. I was able to restart and everything came back. That is a little confusing to me. If that line is commented out how is icinga getting in info it needs for api connections?

check in zones.d and see if there is a global-templates folder and if there is an api-users.conf in it. Otherwise,

grep -ir 'ApiUser "root"' /etc/icinga2
1 Like

Nothing but a README file in zones.d. Grep came back with:
/etc/icinga2/conf.d/api-users.conf:object ApiUser “root” {

That’s… odd.

Can you paste the full output of icinga2 daemon -C ?

Sure can, edited a few things out for security.
[2019-06-11 16:11:43 -0700] information/cli: Icinga application loader (version: r2.10.5-1)
[2019-06-11 16:11:43 -0700] information/cli: Loading configuration file(s).
[2019-06-11 16:11:43 -0700] information/ConfigItem: Committing config item(s).
[2019-06-11 16:11:43 -0700] information/ApiListener: My API identity: icinga2centos.corp.mydomain.com
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 1 ScheduledDowntime.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 15 Services.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 1 IcingaApplication.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 5 Hosts.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 1 FileLogger.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 3 Dependencies.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 2 NotificationCommands.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 12 Notifications.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 1 NotificationComponent.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 2 HostGroups.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 1 ApiListener.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 1 Downtime.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 1 CheckerComponent.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 3 Zones.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 1 Endpoint.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 3 ApiUsers.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 1 User.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 215 CheckCommands.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 1 IdoPgsqlConnection.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 1 UserGroup.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 3 ServiceGroups.
[2019-06-11 16:11:44 -0700] information/ConfigItem: Instantiated 3 TimePeriods.
[2019-06-11 16:11:44 -0700] information/ScriptGlobal: Dumping variables to file ‘/var/cache/icinga2/icinga2.vars’
[2019-06-11 16:11:44 -0700] information/cli: Finished validating the configuration file(s).

That looks like it passed. It still isn’t starting?

Sorry, think I miss communicated. Everything is working now. I was just trying to understand why I had to comment out the line:
include “conf.d/api-users.conf”

I would think that file is necessary for api connections to work.

The duplicate actually makes sense to me now. Since you’re including conf.d recursively, you are thereby including api-users.conf. Explicitly telling it to include it again caused the redefine error.

2 Likes

Ah, now I get it. Thanks much for your answers Blake.