Skip to content

Instantly share code, notes, and snippets.

@docapotamus
Created July 20, 2015 18:39
Show Gist options
  • Save docapotamus/0f7893ab7bece2860353 to your computer and use it in GitHub Desktop.
Save docapotamus/0f7893ab7bece2860353 to your computer and use it in GitHub Desktop.
Remove expired alerts
from redis import StrictRedis
hostname = ''
r = StrictRedis(hostname)
for key in r.keys('{alerts:*}'):
ttl = r.ttl(key)
if ttl == -1:
r.delete(key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment