I’m testing grafana with prometheus as my source. I have a system that I renamed, and was getting old data I didn’t need. I tried backing up my prometheus database, removing the invalid data, and reimporting, but Grafana is still showing the old hostname in my variable query.
Any advice?
Thanks
torkel
May 10, 2018, 10:07am
2
The data is stored in prometheus (metrics & label & label values), so you need to remove it there
1.Remove the host from Prometheus configuration:
a. Open your Prometheus configuration file (usually named prometheus.yml).
b. Locate the job configuration that includes the host you want to remove.
c. Remove the entry for the host from the targets list.
sudo systemctl stop prometheus
cd /var/lib/prometheus
mkdir /root/backup
cp -r * /root/backup/
sudo rm -rf *
sudo systemctl restart prometheus or start prometheus
sudo systemctl restart node_exporter
Step 3: Verify in Grafana
Refresh Dashboards:
Open your Grafana instance and refresh the relevant dashboards to ensure the host no longer appears in the metrics.
Clear Cache (If Necessary):
If the host still appears due to cached data, clear your browser cache or the cache on the Grafana server.
Hi,
To remove data in prometheus, you can use admin API that need to enable in prometheus.
I think this URL that can help you to understand it:
prometheus
Regards,
Fadjar