Skip to content

Instantly share code, notes, and snippets.

@hgranillo
Created January 3, 2018 00:03
Show Gist options
  • Save hgranillo/8abe1dd89469cacc32bdb6a64bab22a4 to your computer and use it in GitHub Desktop.
Save hgranillo/8abe1dd89469cacc32bdb6a64bab22a4 to your computer and use it in GitHub Desktop.
Prometheus Cheatsheets

HOW TO DELETE DATA FOR A SPECIFIC JOB IN PROMETHEUS 2.0

For this you need to run prometheus with '--web.enable-admin-api'

Get date in ISO 8601 format date --iso-8601=seconds

Modify this json with date and job values, and save it as data.json

{
  "min_time": "2018-01-01T17:38:20-03:00",
  "max_time": "2018-01-03T17:38:20-03:00",
  "matchers": [{
    "type": "EQ",
    "name": "job",
    "value": "my-job"
  }]
}

Curl this baby

curl -k -d "@data.json" -X POST -H "Content-Type: application/json" -g 'http://localhost:9090/api/v2/admin/tsdb/delete_series'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment