Can't get past Icingaweb2 setup on new installation

Hi everyone,

Im in the process of installing icinga2 from scratch and the final step was Icingaweb2.

I accessed the front-end set-up wizard and the step of " Database Resource" is not giving me a Postgresql option in the drop down even though i have installed postgresql and followed all the steps as described in the official installation docs.

If i try to go ahead with the default values
“icingaweb_db”
“MYSQL”
localhost
icingaweb_users
and add username and password …

then im getting the following error
" * Failed to successfully validate the configuration: SQLSTATE[HY000] [2002] No such file or directory"

I have also attached a screenshot.

Any help much appreciated.

Many thanks in advance!

Is MySQL/MariaDB running, and does it provide the local unix socket file? This one is accessed by the PHP PDO driver, and when it is not there, you’ll see this error message.

Which distribution are you using, and the versions of PHP and Icinga Web 2 would be interesting as well.

The lack of PostgreSQL inside the setup wizard might be the origin of a missing PHP driver for PostgreSQL, verify that too.

Cheers,
Michael

Thank you so much for your help Michael.

All sorted and i have managed to successfully install icinga web.

However there seems to be an issue with permissions as this is what i see as soon as i login:

SQLSTATE[42501]: Insufficient privilege: 7 ERROR: permission denied for relation icinga_dbversion, query was: SELECT icinga_dbversion.version FROM icinga_dbversion

#0 /usr/share/icingaweb2/library/vendor/Zend/Db/Statement.php(297): Zend_Db_Statement_Pdo->_execute(Array) #1 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(470): Zend_Db_Statement->execute(Array) #2 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query(String, Array) #3 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(816): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Select), Array) #4 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php(1400): Zend_Db_Adapter_Abstract->fetchOne(Object(Zend_Db_Select)) #5 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php(832): Icinga\Module\Monitoring\Backend\Ido\Query\IdoQuery->getIdoVersion() #6 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php(877): Icinga\Module\Monitoring\Backend\Ido\Query\IdoQuery->initializeForPostgres() #7 /usr/share/php/Icinga/Data/SimpleQuery.php(122): Icinga\Module\Monitoring\Backend\Ido\Query\IdoQuery->init() #8 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/MonitoringBackend.php(300): Icinga\Data\SimpleQuery->__construct(Object(Icinga\Data\Db\DbConnection), Array) #9 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/DataView/DataView.php(53): Icinga\Module\Monitoring\Backend\MonitoringBackend->query(String, Array) #10 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/MonitoringBackend.php(255): Icinga\Module\Monitoring\DataView\DataView->__construct(Object(Icinga\Module\Monitoring\Backend\Ido\IdoBackend), Array) #11 /usr/share/icingaweb2/modules/monitoring/application/controllers/ListController.php(81): Icinga\Module\Monitoring\Backend\MonitoringBackend->from(String, Array) #12 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Monitoring\Controllers\ListController->hostsAction() #13 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String) #14 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response)) #15 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response)) #16 /usr/share/php/Icinga/Application/webrouter.php(104): Icinga\Application\Web->dispatch() #17 /usr/share/icingaweb2/public/index.php(4): require_once(String) #18 {main}

SQLSTATE[42501]: Insufficient privilege: 7 ERROR: permission denied for relation icinga_dbversion

#0 /usr/share/icingaweb2/library/vendor/Zend/Db/Statement/Pdo.php(219): PDOStatement->execute(Array) #1 /usr/share/icingaweb2/library/vendor/Zend/Db/Statement.php(297): Zend_Db_Statement_Pdo->_execute(Array) #2 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(470): Zend_Db_Statement->execute(Array) #3 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query(String, Array) #4 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(816): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Select), Array) #5 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php(1400): Zend_Db_Adapter_Abstract->fetchOne(Object(Zend_Db_Select)) #6 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php(832): Icinga\Module\Monitoring\Backend\Ido\Query\IdoQuery->getIdoVersion() #7 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php(877): Icinga\Module\Monitoring\Backend\Ido\Query\IdoQuery->initializeForPostgres() #8 /usr/share/php/Icinga/Data/SimpleQuery.php(122): Icinga\Module\Monitoring\Backend\Ido\Query\IdoQuery->init() #9 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/MonitoringBackend.php(300): Icinga\Data\SimpleQuery->__construct(Object(Icinga\Data\Db\DbConnection), Array) #10 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/DataView/DataView.php(53): Icinga\Module\Monitoring\Backend\MonitoringBackend->query(String, Array) #11 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/MonitoringBackend.php(255): Icinga\Module\Monitoring\DataView\DataView->__construct(Object(Icinga\Module\Monitoring\Backend\Ido\IdoBackend), Array) #12 /usr/share/icingaweb2/modules/monitoring/application/controllers/ListController.php(81): Icinga\Module\Monitoring\Backend\MonitoringBackend->from(String, Array) #13 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Monitoring\Controllers\ListController->hostsAction() #14 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String) #15 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response)) #16 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response)) #17 /usr/share/php/Icinga/Application/webrouter.php(104): Icinga\Application\Web->dispatch() #18 /usr/share/icingaweb2/public/index.php(4): require_once(String) #19 {main}

During the set up the verification process failed once and i had to force changes because i couldnt figure out why it was complaining, all settings were correct but it looked like it didn’t like the username chosen as if there were no permissions. Which is clearly the case but i dont seem to find any guidance on how to fix this.

Any ideas on how to resolve this would be much appreciated.

Many thanks again.

Verify the grants for the icinga IDO database, the user which is configured inside the Icinga Web 2 DB resources doesn’t have the proper permissions to access it.

You can test that on the CLI with using the credentials:

mysql -u <icingadbuser> -p <icingadbname>
<enter password>
select * from icinga_dbversion;
show grants;

If that doesn’t work, show the grants as root:

mysql -u root -p <icingadbname>
show grants;

You may need to alter the granted permissions for the icinga db user. Do not use root.

Cheers,
Michael

Thanks again Michael.

These are the databases as shown in the screenshot (it’s postgresql by the way):

07

I can login in the icinga DB but i dont seem to be able to login to the icinga2 DB.

What you mean is i need to grant access to the user of Icinga Web DB to be able to access the Icinga IDO DB?

Hmmm please share the resources.ini and the monitoring modules backend config - I‘m not sure about the two databases icinga and icinga2. It seems that icinga2 is the one holding the current IDO schema, and the owner is definitely wrong being postgres instead of icinga.

Which brings me to the question - how‘s the Icinga 2 IDO configured, user and database?

The Icinga2 IDO Database name is “icinga2” and the user is “icinga”.

Both DB’s have the same name and user because the setup wizard wouldn’t authenticate any other combination, which seemed quite wrong to me but it was the only way it allowed me to continue without issues. It’s the first time i’m installing icinga2.

Screenshot of resources.ini attached.

17

many many thanks

The Icinga Web 2 setup wizard wants to create its own database called icingaweb (or icingaweb2) where the schema is imported. This is due to the fact that its two different apps and schemas.

Doesn’t harm your environment though, just uncommon that’s why I am asking.

The grants for the icinga2 database tell that the owner is postgres, which would indicate that icinga doesn’t have access. Verify the content of your pg_hba.conf file and ensure that icinga2 grants permissions for the icinga user as owner.

Cheers,
Michael

I believe this is the case as i edited the pg_hba.conf file according to the icinga installation instructions.

here’s a copy of it

Do you think it’s wise to unistall icinga web and postgres and start all over again or this would mess up everything a little bit more?

thanks for your time and help again

Please avoid screenshots of configuration, enclose such with 3 backticks and copy them instead. I can barely read the black background and blue comments.

I’m not sure whether PostgreSQL makes sense at all. How familiar are you with PostgreSQL compared to MySQL? The grants/permissions must be intact in order to allow applications to read/write in there.