官方文档: https://prometheus.io/docs/prometheus/latest/querying/api/


通过prometheus的admin-api ,我们可以执行些骚操作:


1、确保 prometheus 启动的时候, 加了参数  --web.enable-admin-api

 ./prometheus --storage.tsdb.retention=180d --web.enable-admin-api


2、测试清理key

假定我们要清理的 key是 mysql_global_status_threads_running{instance="test-db13:9104",job="mysql"}:


清理这个key的全部的数据

curl -X POST \
  -g 'http://192.168.2.100:9090/api/v1/admin/tsdb/delete_series?match[]=up&match[]&