Solved

Impossible to import users using LDAP


Badge +3

Hello
I have a strange behavior when I import certain ldap users
I get a blank Contacts/Users page

I enabled ldap debug, and on centreon-error.log, there is this error every time I try to import an user

PHP Fatal error:  Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`centreon`.`contactgroup_contact_relation`, CONSTRAINT `contactgroup_contact_relation_ibfk_1` FOREIGN KEY (`contact_contact_id`) REFERENCES `contact` (`contact_id`) ON DELETE CASCADE) in /usr/share/centreon/www/class/centreonDB.class.php:274
Stack trace:
#0 /usr/share/centreon/www/include/configuration/configObject/contact/DB-Func.php(1277): CentreonDB->query('INSERT INTO con...')
#1 /usr/share/centreon/www/include/configuration/configObject/contact/ldapImportContact.php(134): insertLdapContactInDB(Array)
#2 /usr/share/centreon/www/include/configuration/configObject/contact/contact.php(168): require_once('/usr/share/cent...')
#3 /usr/share/centreon/www/main.get.php(257): include_once('/usr/share/cent...')
#4 {main}
thrown in /usr/share/centreon/www/class/centreonDB.class.php on line 274

I checked those tables where it say there is constraint violation, and I did not find any violation

the user that I try to add, had been deleted, and I tried to add them again

I’m using ActiveDirectory

Centreon version 20.10

 

Thank you

icon

Best answer by wadOps 27 July 2022, 10:44

View original

3 replies

Userlevel 4
Badge +13

Hi @wadOps 
Can you go on the page Administration > Parameters > Debug and enable the SQL debug?
After doign that, can you import the contact again and check the logfile /var/log/centreon/sql-error.log?

Badge +3

Hello @sduret,

Thank you for reply

I did what have you told, I tried adding those users multiple times, but every time, sql-error.log is always empty

Badge +3

problem solved

there was another ldap connection which had users with the same name
and that created data base constrainte

Reply