Delete PushGateway groups
What's inside this article
⌄
- How to delete PushGateway metrics
- How to delete PushGateway groups
- PushGateway remove group data
- Prometheus PushGateway cleanup
- Delete metrics PushGateway
- PushGateway metrics delete not working
- PushGateway groups delete not working
First, you must specify all the keys of the group that you want to delete. You need to delete groups with such keys, that you used to when pushing metrics.
For example, your group only contains the key job="myjob". Then you can remove it in this way:
curl --location --request DELETE 'http://localhost:9091/metrics/job/myjob'
Or this way:
pushGateway.delete("myjob");
If your group has key instance="myinstance" except job="myjob", then you need to add this key when deleting:
curl --location --request DELETE 'http://localhost:9091/metrics/job/myjob/instance/myinstance'
And respectively:
Map<String, String> keyMap = new HashMap<>();
keyMap.put("instance", "myinstance");
pushGateway.delete("myjob", keyMap);
If you don’t specify all keys during deletion, then despite a positive 202 response from the server, the deletion will not occur.
Therefore, if groups deletions from the PushGateway not work, make sure that you have specified all the existing keys of the group that you want to delete!