Scraping only relevant metrics in Prometheus, according to your Grafana dashboards [Solved]

One of my customers is using Grafana Cloud as a service, and they send a lot of metrics/DataSeries (remote_write) to the Prometheus instance that is hosted on Grafana Cloud. This made the price of Grafana Cloud service go high, without a real reason, since we’re not using all the metrics that are being sent in our dashboard.

I’ve created a CLI that appends to your current prometheus.yml file rules, these rules keep only the metrics that are used in Grafana dashboards.

The tool - https://github.com/unfor19/frigga

Let me know if you have any questions

Originally posted at https://community.grafana.com/t/scraping-only-relevant-metrics-in-prometheus-according-to-your-grafana-dashboards-solution/32829?u=meir1