Question

sql errors : Cannot add or update a child row

  • 25 September 2023
  • 2 replies
  • 113 views

Badge +2

Hello,

I just added a new poller using API script. Everything seems fine, except my poller is in state “poller is not running”.

Communication between central and poller is OK.

On central logs, I see a lot of sql errors like this :

 

[2023-09-25T11:19:12.344+02:00] [sql] [error] mysql_connection: could not store host:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`hosts`, CONSTRAINT `hosts_ibfk_1` FOREIGN KEY (`instance_id`) REFERENCES `instances` (`instance_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.378+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.423+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.431+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.439+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.447+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.456+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.464+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.488+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.503+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.519+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.528+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.539+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.546+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.557+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.566+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.573+02:00] [sql] [error] mysql_connection: could not store service:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.580+02:00] [sql] [error] mysql_connection: could not store host group membership:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`hosts_hostgroups`, CONSTRAINT `hosts_hostgroups_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:19:12.581+02:00] [sql] [error] mysql_connection: could not store host group membership:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`hosts_hostgroups`, CONSTRAINT `hosts_hostgroups_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
 

 

 

I guess that’s why my poller is not running...

can anybody tell me how to fix it please ?

 

My central is running 22.04.4 and my poller 23.04.4

Regards


2 replies

Badge +2

I’ve remove all hosts linked to this poller, and still have SQL errors on central :

[2023-09-25T11:50:07.361+02:00] [sql] [error] mysql_connection: could not store host:  Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`hosts`, CONSTRAINT `hosts_ibfk_1` FOREIGN KEY (`instance_id`) REFERENCES `instances` (`instance_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.386+02:00] [sql] [error] mysql_connection: could not store host: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`hosts`, CONSTRAINT `hosts_ibfk_1` FOREIGN KEY (`instance_id`) REFERENCES `instances` (`instance_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.393+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.394+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.395+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.396+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.398+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.399+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.400+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.401+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.408+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.410+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.411+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.412+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.413+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.415+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.416+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.424+02:00] [sql] [error] mysql_connection: could not store service: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`services`, CONSTRAINT `services_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.426+02:00] [sql] [error] mysql_connection: could not store host group membership: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`hosts_hostgroups`, CONSTRAINT `hosts_hostgroups_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)
[2023-09-25T11:50:07.426+02:00] [sql] [error] mysql_connection: could not store host group membership: Cannot add or update a child row: a foreign key constraint fails (`centreon_storage`.`hosts_hostgroups`, CONSTRAINT `hosts_hostgroups_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE CASCADE)

 

Badge +2

the new poller has not been created in centreon_storage.instances mysql tables

Reply