I use Grafana (front-end), InfluxDB (back-end), and Telegraf (server agent) for monitoring my network. Because I recently decided to decommission my Pixelfed and WriteFreely instances, I also wanted to delete their metrics from InfluxDB so they show longer showed up in Grafana. I used the following command to delete the metrics.
DROP SERIES FROM /.*/ WHERE "host" = '<HOSTNAME>'
This worked very well. The actual metrics were indeed deleted; however, there was one problem. The query that Grafana uses to populate the pull-down menu on my dashboard was still showing all of the deleted servers, for some reason.
As it turns out, this is expected behavior with InfluxDB. I’m not going to get into the details, but it is explained in my reference GitHub issues below.
Anyway, here’s the original command that was returning the active and deleted hosts.
SHOW TAG VALUES FROM system WITH KEY=host
After doing a bit of research, I discovered a solution proposed by ushuz, who posted the following comment.
By simply adding a
WHERE clause, I was able to exclude the servers that were decommissioned, without having to do any maintenance to InfluxDB.
SHOW TAG VALUES FROM system WITH KEY=host WHERE host != ''
I hope this helps!