From 8c5c30dfd4f4b8433875ae5e90fce31bfcd85fc5 Mon Sep 17 00:00:00 2001 From: kevgliss Date: Wed, 21 Dec 2016 11:01:21 -0800 Subject: [PATCH] Adding some additional output to expiration command. (#626) --- lemur/endpoints/cli.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lemur/endpoints/cli.py b/lemur/endpoints/cli.py index 61677a99..689461b1 100644 --- a/lemur/endpoints/cli.py +++ b/lemur/endpoints/cli.py @@ -26,10 +26,14 @@ def expire(ttl): """ Removed all endpoints that have not been recently updated. """ + print("[+] Staring expiration of old endpoints.") now = arrow.utcnow() expiration = now - timedelta(hours=ttl) endpoints = database.session_query(Endpoint).filter(cast(Endpoint.last_updated, ArrowType) <= expiration) for endpoint in endpoints: + print("[!] Expiring endpoint: {name} Last Updated: {last_updated}".format(name=endpoint.name, last_updated=endpoint.last_updated)) database.delete(endpoint) metrics.send('endpoint_expired', 'counter', 1) + + print("[+] Finished expiration.")