I was just going through deleting some old data (development stuff, older devices that don’t exist anymore, etc.) from my Icinga2 DB (MariaDB) and was wondering if there was a “best practice” for doing this as there doesn’t seem to be mentions of DB management in the docs, other than the optimization/tuning stuff. So far, I’ve just been removing hosts from their relevant tables (
icinga_endpointstatus where applicable), but is there perhaps a different, better way I should be doing this?
I made a simple script to speed up this process:
USE icinga; DELETE FROM icinga_hosts where alias = (@host); DELETE FROM icinga_objects where name1 = (@host); DELETE FROM icinga_endpoints where identity = (@host); DELETE FROM icinga_endpointstatus where identity = (@host);
where @host is supplied in calling the script.
This question stems from my desire to delete old hosts/services from showing up in Grafana (which uses InfluxDB) because I’m under the impression that even if I delete data from InfluxDB, the same data is being resent from the Icinga2 DB, though now I’m not sure that I’m deleting data from InfluxDB correctly – if someone has insight on that too, it would be very helpful!
Here are the commands I tried for the InfluxDB data deletion:
DELETE FROM "<host>" DROP SERIES FROM "<host>" DROP MEASUREMENT "<host>"
then I restart
influxdb, but the data seems to remain in my dashboards.