Jump to content

Prometheus TSDB: Difference between revisions

From Costa's Wiki
No edit summary
No edit summary
Line 6: Line 6:
How to drop and delete metrics in Prometheus  https://faun.pub/how-to-drop-and-delete-metrics-in-prometheus-7f5e6911fb33
How to drop and delete metrics in Prometheus  https://faun.pub/how-to-drop-and-delete-metrics-in-prometheus-7f5e6911fb33


;Find all unused metrics
Grafana token
Grafana token
  eyJrIjoibzQ4R3I5Mm9FcUMwOFZPNzdpWEtnNEl5ZU1IVkYyUG4iLCJuIjoibWltaXItdG9rZW4iLCJpZCI6MX0=
  eyJrIjoibzQ4R3I5Mm9FcUMwOFZPNzdpWEtnNEl5ZU1IVkYyUG4iLCJuIjoibWltaXItdG9rZW4iLCJpZCI6MX0=
Line 12: Line 13:


  mimirtool analyze grafana --address=http://10.0.0.200:30725 --key="eyJrIjoibzQ4R3I5Mm9FcUMwOFZPNzdpWEtnNEl5ZU1IVkYyUG4iLCJuIjoibWltaXItdG9rZW4iLCJpZCI6MX0="
  mimirtool analyze grafana --address=http://10.0.0.200:30725 --key="eyJrIjoibzQ4R3I5Mm9FcUMwOFZPNzdpWEtnNEl5ZU1IVkYyUG4iLCJuIjoibWltaXItdG9rZW4iLCJpZCI6MX0="
mimirtool analyze prometheus --address=http://10.0.0.200:30900
jq -r ".additional_metric_counts[].metric" prometheus-metrics.json | sort > unused_metrics.txt

Revision as of 21:10, 26 July 2024

Oldest record in Prometheus
cd /home/costa/data/prometheus-data ;grep -r minTime --include meta.json | awk '{print $3}' | sort | head -n1 | rev| cut -c5- | rev | { read gmt ; date -d "@$gmt" ; }

snapshot https://gist.github.com/ksingh7/d5e4414d92241e0802e59fa4c585b98b

How to drop and delete metrics in Prometheus https://faun.pub/how-to-drop-and-delete-metrics-in-prometheus-7f5e6911fb33

Find all unused metrics

Grafana token

eyJrIjoibzQ4R3I5Mm9FcUMwOFZPNzdpWEtnNEl5ZU1IVkYyUG4iLCJuIjoibWltaXItdG9rZW4iLCJpZCI6MX0=
curl -H "Authorization: Bearer eyJrIjoibzQ4R3I5Mm9FcUMwOFZPNzdpWEtnNEl5ZU1IVkYyUG4iLCJuIjoibWltaXItdG9rZW4iLCJpZCI6MX0=" http://10.0.0.200:30725/api/dashboards/home
mimirtool analyze grafana --address=http://10.0.0.200:30725 --key="eyJrIjoibzQ4R3I5Mm9FcUMwOFZPNzdpWEtnNEl5ZU1IVkYyUG4iLCJuIjoibWltaXItdG9rZW4iLCJpZCI6MX0="
mimirtool analyze prometheus --address=http://10.0.0.200:30900
jq -r ".additional_metric_counts[].metric" prometheus-metrics.json | sort > unused_metrics.txt