Setup - Command Transport - Error

I am trying to setup Icinga 2.12 latest version. In the command transport step, i am getting the following error.

Failed to successfully validate the configuration: Couldn’t connect to the Icinga 2 API:

icinga spi is setup and daemon restarted. Still i see this error. And no other additional error shown as discussed in the other topics. This is a blank error which doesn’t give me any clues.

Does anybody have any idea on this ?

Hi and welcome,

is the api still enabled?

icinga2 features list?

did you defined a api user for icingaweb2 in /etc/icinga2/features-enabled/api.conf?
e.g.

object ApiUser "icingaweb2" {
  password = "xxx"
  permissions = [ "*" ]
}

is the monitoring module enabled?

icingacli module list | grep monitoring

image

Did you define the api user in /etc/icingaweb2/modules/monitoring/commandtransports.ini?
e.g.

[icinga2]
transport = "api"
host = "localhost"
port = "5665"
username = "icingaweb2"
password = "xxx"

features list shows api enabled

ApiUser is added in /etc/icinga2/conf.d/api-users.conf

Should it be added to /etc/icinga2/features-enabled/api.conf as well ? this file has references of ApiListeners

icingacli module list | grep monitoring was empty initially

i ran the commande icingacli module enable moitoring

after this i am able to see monitoring in the list as enabled.

But still, /etc/icingaweb2/modules/monitoring/ this monitoring folder is not created yet. even after icinga2 restart.

I searched online if there is some specific command to install the monitoring module but i found only the icingacli module enable command…

Is there a specific way to install this module or should we create this folder manualy ?

If you enable a feature, icinga creates a hardlink from the original file /etc/icinga2/features-available/api.conf to /etc/icinga2/features-enabled/api.conf :wink:

ok than it looks like that here is the problem. From what we can found in the docs, that is installed automaticly during the setup from icingaweb2.

But if in /etc/icingaweb2/modules/monitoring/ are no files that means there is no configuration. You could try to create them manually. Maybe something happens during the installation.

A reason why the setup from icingaweb2 was not able to write the files in this directory are permission errors like SELinux. Normally the files should be created if you configure your everything during the web UI.

This is what the web setup normally should do.

Please check if you have included this config file with you configuration.
If you ran the node wizard during setup it will have asked if you want to disable the inclusion of the conf.d directory. If you created the api-users.conf file afterwards it might not be included.

Example from the /etc/icinga2/icinga2.conf from on of my systems:

// Disabled by the node setup CLI command on 2020-04-01 16:00:51 +0200
// include_recursive "conf.d"
include "conf.d/api-users.conf"

Do you have any configuration under /etc/icingaweb2 ?
If not please check if the user running the webserver (e.g www-data for Debian/Ubuntu, apache for RHEL/centOS) has permission to write into the directory. There should be a guide displayed at the beginning of the web setup when you have to enter the setup token.

seems like selinux and fireqall was the issue at that step. now the command transport config thru. but the last step of setting up shows error.

Module “monitoring” could not be enabled. An error occured:
ERROR: Icinga\Exception\SystemPermissionException in /usr/share/php/Icinga/Application/Modules/Manager.php:275 with message: Cannot enable module “monitoring”. Check the permissions for the enabledModules directory: /etc/icingaweb2/enabledModules

permissions

fixed it by running

$ chown -R apache /etc/icingaweb2/

Fine, good to read, that it worked now