centreon / centreon-collect

Centreon collect software collection
11 stars 6 forks source link

hosts and services deleted from UI are not purged in centreon_storage #719

Closed Ghiles-khd closed 1 year ago

Ghiles-khd commented 1 year ago

BUG REPORT INFORMATION

Prerequisites

The opened issue, must be code related. GitHub is not meant for support. Feel free to check the CONTRIBUTING section for more details.

Versions

For the RPM based systems

-- Copy/Paste the result of the following command --

$ rpm -qa | grep centreon-broker
centreon-broker-21.10.3-3.el7.x86_64
centreon-broker-cbd-21.10.3-3.el7.x86_64
centreon-broker-cbmod-21.10.3-3.el7.x86_64
centreon-broker-storage-21.10.3-3.el7.x86_64
centreon-broker-core-21.10.3-3.el7.x86_64
centreon-broker-graphite-21.10.3-3.el7.x86_64

Operating System

*CentOS

How the the component has been installed and versions

Description

Hi, We have observed that deleted hosts and services are not purged in Centreon_storage(tables: Hosts, services) after restarting the engine. we also have some sql error in "central-broker-master.log" indicating that the host_id does not exist.

thanks for the help,

Steps to Reproduce

Please describe precisely the steps to reproduce the encountered issue.

  1. Delete host from UI.
  2. Export and restart Engine
  3. check if the host is still exist in centreon_storage database

Describe the received result

In the database: MariaDB [centreon_storage]> select host_id,last_check from hosts where host_id =12022\G; 1. row host_id: 12022 last_check: 1681465277 1 row in set (0.002 sec)

Logs

centreon-broker logs (if needed)

[2023-04-14T16:50:40.310+02:00] [sql] [error] SQL: host with host_id = 12022 does not exist - unable to store service of that host. You should restart centengine
[2023-04-14T16:50:40.310+02:00] [sql] [error] SQL: host with host_id = 12022 does not exist - unable to store service of that host. You should restart centengine
[2023-04-14T16:50:40.310+02:00] [sql] [error] SQL: host with host_id = 12022 does not exist - unable to store service of that host. You should restart centengine
[2023-04-14T16:50:40.310+02:00] [sql] [error] SQL: host with host_id = 12022 does not exist - unable to store service of that host. You should restart centengine
bouda1 commented 1 year ago

Even in the more recent releases, services and hosts are not deleted from the centreon_storage database. But normally, they are disabled (column 'enabled' set to 0).

A good practice is then to regularly remove the disabled hosts/services. It is not done by cbd because it is time consuming and leads sometimes to deadlocks in the database.

For the issue about not existing hosts, maybe you should update your version, 21.10.0 is quite an old version now.