Question

database cleanup

  • 19 April 2023
  • 4 replies
  • 714 views

Userlevel 1
Badge +7

I ran this command to remove old metrics

find /var/lib/centreon/metrics -type f -name '*.rrd' -mtime +90 -delete

and I would like to know if is safe to perform this query directly 

DELETE FROM data_bin WHERE id_metric NOT IN (SELECT metric_id FROM metrics)

 


4 replies

Userlevel 1
Badge +3

I ran this command to remove old metrics

find /var/lib/centreon/metrics -type f -name '*.rrd' -mtime +90 -delete

and I would like to know if is safe to perform this query directly 

DELETE FROM data_bin WHERE id_metric NOT IN (SELECT metric_id FROM metrics)

 

did you run the cleanup on the DB?

I also want to know if it's possible

Userlevel 1
Badge +7

I ran this query 

UPDATE `metrics` SET to_delete = 1 WHERE index_id NOT IN (SELECT id FROM index_data)

but I still not sure if this is the best way to do so

I also ran these ones in order to clear duplicated hosts and services

DELETE FROM `index_data` WHERE `host_name` LIKE '%\_1'
DELETE FROM `index_data` WHERE `service_description` LIKE '%\_1' and service_description != 'meta_1'
DELETE FROM `services` WHERE description LIKE '%\_1' AND description != 'meta_1'

 

Badge +2

Hi Guys

 

Which is the best solution to clean the centreon database ?

I want to reduce the size of it 

Badge +2

Hi @cesinhaleal  How can I run the cleanup on Centreon DB ?

Is there more detailed documentation regarding metrics cleanup  from  filesystem and DB ?

 

Thank you very much

Costi

Reply