Unable to setup the database in icinga web url

I am using centos I have configured icinga while setup i have given the token and selected the monitor option after that there were some red color which fixed with the help of document.

But still there are some yellow color packages needs to be installed, I did installed all.

sudo yum install -y rh-php73-php-mysqlnd rh-php73-php-fpm sclo-php73-php-pecl-imagick rh-php73-php-ldap rh-php73-php-pgsql rh-php73-php-xmlrpc rh-php73-php-intl rh-php73-php-gd rh-php73-php-pdo rh-php73-php-soap rh-php73-php-posix rh-php73-php-cli -y

I restarted httpd service and icinga2 many times, but still it did not turned into green

sudo icinga2 --version
icinga2 - The Icinga 2 network monitoring daemon (version: 2.12.1-1)

Copyright © 2012-2020 Icinga GmbH (https://icinga.com/)
License GPLv2+: GNU GPL version 2 or later http://gnu.org/licenses/gpl2.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

System information:
Platform: CentOS Linux
Platform version: 7 (Core)
Kernel: Linux
Kernel version: 3.10.0-1127.19.1.el7.x86_64
Architecture: x86_64

Build information:
Compiler: GNU 4.8.5
Build host: runner-wytxxqbb-project-322-concurrent-0
OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017

Application information:

General paths:
Config directory: /etc/icinga2
Data directory: /var/lib/icinga2
Log directory: /var/log/icinga2
Cache directory: /var/cache/icinga2
Spool directory: /var/spool/icinga2
Run directory: /run/icinga2

Old paths (deprecated):
Installation root: /usr
Sysconf directory: /etc
Run directory (base): /run
Local state directory: /var

Internal paths:
Package data directory: /usr/share/icinga2
State path: /var/lib/icinga2/icinga2.state
Modified attributes path: /var/lib/icinga2/modified-attributes.conf
Objects path: /var/cache/icinga2/icinga2.debug
Vars path: /var/cache/icinga2/icinga2.vars
PID path: /run/icinga2/icinga2.pid

Postgres:

postgres=# \list
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
------------±---------±---------±------------±------------±----------------------
icinga | icinga | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
icingaweb2 | icinga | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(5 rows)

I have read many documents and tried all the possibilities but still i am not able to move ahead “Next” is not working to setup database details.

Thanks,
Pradeep A

Hi,

On centos you also need to restart the php-fpm service.
What packages are still yellow? Share a screenshot maybe.

As for the DB setup you first input all the connection information, host, port, db name, username that is/should be allowed access to the db and the password.
In most cases the user does not exist at that time. After clicking next the setup will ask for privileged credentials to create the user for the database as well as the db schema.
Not sure if there are some differences in the steps on pgsql though, as I only have setups with mysql.

Hi,

Thanks for the reply
I have restarted the service
sudo systemctl restart rh-php71-php-fpm.service
sudo systemctl restart httpd.service
sudo systemctl restart icinga2.service

Please find the screenshots.


By the way I have configured postgres not mysql
$ vi /etc/yum.repos.d/CentOS-Base.repo
Next, add exclude=postgresql* to the [base] and [updates] sections.

$ yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm -y

$ yum install postgresql96-server
$ /usr/pgsql-9.6/bin/postgresql96-setup initdb
$ systemctl enable postgresql-9.6
$ systemctl start postgresql-9.6
$ yum install icinga2-ido-pgsql
sudo -u postgres psql -c “CREATE ROLE icinga WITH LOGIN PASSWORD ‘*****’”
sudo -u postgres createdb -O icinga -E UTF8 icinga
sudo -u postgres createdb -O icinga -E UTF8 icingaweb2

Edited the file $ vi /var/lib/pgsql/9.6/data/pg_hba.conf

icinga

local icinga icinga md5
host icinga icinga 127.0.0.1/32 md5
host icinga icinga ::1/128 md5

icinga

local icingaweb2 icinga md5
host icingaweb2 icinga 127.0.0.1/32 md5
host icingaweb2 icinga ::1/128 md5

“local” is for Unix domain socket connections only

local all all ident

IPv4 local connections:

host all all 127.0.0.1/32 ident

IPv6 local connections:

host all all ::1/128 ident

$ systemctl restart postgresql-9.6

$ sudo su - postgres
$ psql -U icinga -d icinga < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql
$ exit
$ icinga2 feature enable ido-pgsql
$ systemctl restart icinga2

$ yum install httpd
$ systemctl enable httpd
$ systemctl start httpd
$ yum install rh-php71-php-fpm
$ systemctl start rh-php71-php-fpm.service
$ systemctl enable rh-php71-php-fpm.service

$ yum install php-pgsql

and the rest as is

This indicates that you have PHP7.1 running, but you installed all the packages for PHP7.3.
Which version are you really using?
As you have CentOS 7 I assume PHP7.1 is correct. So just install the modules for 7.1 and it should work.

This depends on the version of Icinga Web 2 that’s installed. If it’s v2.8+, PHP 7.3 is correct.

Good to know.
But then he will need to install the appropriate services as well.

yes I did
now i have configured another instance with mariodb
at final step
User Group Backend configuration has been successfully written to: /etc/icingaweb2/groups.ini
Unable to create user group “Administrators”. An error occured:
ERROR: Zend_Db_Adapter_Exception in /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Pdo/Abstract.php:145 with message: SQLSTATE[HY000] [1045] Access denied for user ‘icingaadmin’@‘localhost’ (using password: YES)

I tried to give different permissions

show databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
| icinga |
| icinga2 |
| icingaweb |
| mysql |
| performance_schema |

I fixed the postgres think and able to access the icinga, but I have another instance where i configured mariodb which i have mentioned in my last post.

User Group Backend configuration has been successfully written to: /etc/icingaweb2/groups.ini
Unable to create user group “Administrators”. An error occured:
ERROR: Zend_Db_Adapter_Exception in /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Pdo/Abstract.php:145 with message: SQLSTATE[HY000] [1045] Access denied for user ‘icingaadmin’@‘localhost’ (using password: YES)

I tried to give different permissions

show databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
| icinga |
| icinga2 |
| icingaweb |
| mysql |
| performance_schema |

Well, the user “icingaadmin” is not allowed to access the database.

Normally the user “icingaadmin” is the admin for the webinterface and not a user that connects to the database.

You need to configure the database resources for icingaweb and icinga-ido correctly with the approriate database users.
This does not differ from the postgre approach, I would assume. So just do what you did before with pgsql :slight_smile: