Icinga / ansible-playbooks

Ansible Playbook for Icinga 2
GNU General Public License v2.0
225 stars 122 forks source link

Unidentified issue with icinga2_web2_db database setup #72

Closed maccadia closed 6 years ago

maccadia commented 6 years ago

During Icinga2 Web2 UI graphical setup on Ubuntu ; after Database Resource settings.

Current Behavior

Database Setup

It seems that either the database you defined earlier does not yet exist and cannot be created using the provided access credentials, the database does not have the required schema to be operated by Icinga Web 2 or the provided access credentials do not have the sufficient permissions to access the database. Please provide appropriate access credentials to solve this.

Expected Behavior

Authentication Backend

As you've chosen to use a database for authentication all you need to do now is defining a name for your first authentication backend.

Possible Solution

Granting all privileges to icinga2_web2_db_user as suggested in documentation solves the problem. However, it might be good to identify the root cause.

- name: Create Icinga2 Web Database User and configure Grants
  mysql_user:
    name: "{{ icinga2_web2_db_user }}"
    password: "{{ icinga2_web2_db_pass }}"
    state: present
    priv: "{{ icinga2_web2_db }}.*:ALL"

Your Environment

ansible 2.4.3.0
python version = 2.7.12
Ubuntu 16.04.4 LTS
aflatto commented 6 years ago

Hi @MAccadia Can you share the error you got ? A screen shot would be very helpful and maybe even the ansible execution output of the relevant step. Thank you

maccadia commented 6 years ago

Hello, I wasn't able to reproduce the error. I guess I was using a wrong password / db name somehow. Sorry...

maccadia commented 6 years ago

I run into the same issue today. Fresh install on Ubuntu VM.

I use :

    - role: icinga2-ansible-web2-ui
      icinga2_db: "icinga2"
      icinga2_db_user: "icinga2"
      icinga2_db_pass: "**********"
      icinga2_web2_db: "icingaweb"
      icinga2_web2_db_user: "icingaweb"
      icinga2_web2_db_pass: "***********"

The playbook runs without errors. When I go to http://IP//icingaweb2/setup I get this first : screenshot-2018-3-15 icinga web 1

and then

screenshot-2018-3-15 icinga web

On my server, I have :

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| icinga2            |
| icingaweb          |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
6 rows in set (0,00 sec)

mysql> select user,host from mysql.user;
+------------------+---------------------+
| user             | host                |
+------------------+---------------------+
| repl             | %                   |
| root             | 127.0.0.1           |
| root             | ::1                 |
| debian-sys-maint | localhost           |
| icinga2          | localhost           |
| icingaweb        | localhost           |
| mysql.session    | localhost           |
| mysql.sys        | localhost           |
| root             | localhost           |
| root             | phi-monitoring-test |
+------------------+---------------------+
10 rows in set (0,00 sec)

mysql> show grants for 'icingaweb'@'localhost';
+---------------------------------------------------------------------------------------------------------------------------------------+
| Grants for icingaweb@localhost                                                                                                        |
+---------------------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'icingaweb'@'localhost'                                                                                         |
| GRANT SELECT, INSERT, UPDATE, DELETE, DROP, INDEX, EXECUTE, CREATE VIEW ON `icingaweb`.* TO 'icingaweb'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0,00 sec)

Then, If I run GRANT ALL ON 'icingaweb'.* TO 'icingaweb'@'localhost' and click Back and Next in IcingaWeb2 Setup. I get the expected :

screenshot-2018-3-15 icinga web 2

aflatto commented 6 years ago

Hello @MAccadia The issue is fixed in #81

Thank you for your input

coom commented 6 years ago

Same here ..

Created database like this :

DROP DATABASE icinga_auth;
CREATE DATABASE icinga_auth;
GRANT ALL ON icinga_auth.* TO 'icinga_auth'@'localhost' IDENTIFIED BY '0zhzaoOmMs4PURZRYZnl';
FLUSH PRIVILEGES;

Then I click on "Validate configuration", the wizzard says that everything is OK, then I click next and :

It seems that either the database you defined earlier does not yet exist and cannot be created using the provided access credentials, the database does not have the required schema to be operated by Icinga Web 2 or the provided access credentials do not have the sufficient permissions to access the database. Please provide appropriate access credentials to solve this.

Do you have an idea?

devchristianschroeder commented 6 years ago

Same on my side:

The provided credentials cannot be used to grant all required privileges to the login "icinga".

maccadia commented 6 years ago

This issue has been fixed for me with #81. The only advice I can give is to double check your login/passwords.

devchristianschroeder commented 6 years ago

I imported the mysql schema manually into the database 'icinga2_web', assign ALL privileges to the database and user 'icinga' but the error existed. Then I changed the user name and password to root in the web configuration wizard and it worked. The root user has super privileges may be this is the point?

capture2

capture3

capture

therealdirk commented 5 years ago

Same problem here.GRANT ALL ON icingaweb.* TO icingaweb@localhost or modifying the privileges in icinga2_web2_ui_Debian_install.yml solves the problem.