summaryrefslogtreecommitdiffstats
path: root/utils/test/dashboard/kibana_cleanup.py
diff options
context:
space:
mode:
authorTrevor Bramwell <tbramwell@linuxfoundation.org>2017-11-21 00:46:35 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-11-21 00:46:35 +0000
commit174b299271189496bae4c4d6727ea26a7a098756 (patch)
treeb063e18c795988e38e1eb4afa74d4cbf9524f057 /utils/test/dashboard/kibana_cleanup.py
parentfd65ec9e84ae025e6b903c403514405ba0bb0a61 (diff)
parentf11f26d23dabde24b0bcd67ac81b094aa89eb6c9 (diff)
Merge "Remove 'utils/test' Directory and update INFO"
Diffstat (limited to 'utils/test/dashboard/kibana_cleanup.py')
-rw-r--r--utils/test/dashboard/kibana_cleanup.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/utils/test/dashboard/kibana_cleanup.py b/utils/test/dashboard/kibana_cleanup.py
deleted file mode 100644
index 7e3662c29..000000000
--- a/utils/test/dashboard/kibana_cleanup.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#! /usr/bin/env python
-import logging
-import urlparse
-
-import argparse
-
-from dashboard.common import elastic_access
-
-logger = logging.getLogger('clear_kibana')
-logger.setLevel(logging.DEBUG)
-file_handler = logging.FileHandler('/var/log/{}.log'.format('clear_kibana'))
-file_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: '
- '%(message)s'))
-logger.addHandler(file_handler)
-
-
-def delete_all(url, es_creds):
- ids = elastic_access.get_docs(url, es_creds, body=None, field='_id')
- for id in ids:
- del_url = '/'.join([url, id])
- elastic_access.delete_docs(del_url, es_creds)
-
-
-if __name__ == '__main__':
- parser = argparse.ArgumentParser(
- description=('Delete saved kibana searches, '
- 'visualizations and dashboards'))
- parser.add_argument('-e', '--elasticsearch-url',
- default='http://localhost:9200',
- help=('the url of elasticsearch, '
- 'defaults to http://localhost:9200'))
-
- parser.add_argument('-u', '--elasticsearch-username', default=None,
- help=('The username with password for elasticsearch '
- 'in format username:password'))
-
- args = parser.parse_args()
- base_elastic_url = args.elasticsearch_url
- es_creds = args.elasticsearch_username
-
- urls = (urlparse.urljoin(base_elastic_url, '/.kibana/visualization'),
- urlparse.urljoin(base_elastic_url, '/.kibana/dashboard'),
- urlparse.urljoin(base_elastic_url, '/.kibana/search'))
-
- for url in urls:
- delete_all(url, es_creds)