summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dashboard.tar.gzbin0 -> 14627 bytes
-rw-r--r--dashboard/backup-db.sh (renamed from scripts/backup-db.sh)0
-rw-r--r--dashboard/dashboard/__init__.py0
-rw-r--r--dashboard/dashboard/common/__init__.py0
-rw-r--r--dashboard/dashboard/common/elastic_access.py (renamed from scripts/shared_utils.py)0
-rw-r--r--dashboard/dashboard/common/logger_utils.py (renamed from scripts/logger_utils.py)4
-rw-r--r--dashboard/dashboard/conf/__init__.py0
-rw-r--r--dashboard/dashboard/conf/config.py (renamed from scripts/config.py)2
-rw-r--r--dashboard/dashboard/conf/testcases.py (renamed from scripts/testcases_parser.py)2
-rw-r--r--dashboard/dashboard/elastic2kibana/__init__.py0
-rw-r--r--dashboard/dashboard/elastic2kibana/main.py (renamed from scripts/create_kibana_dashboards.py)32
-rw-r--r--dashboard/dashboard/elastic2kibana_main.py4
-rw-r--r--dashboard/dashboard/functest/__init__.py0
-rw-r--r--dashboard/dashboard/functest/testcases.yaml (renamed from scripts/testcases.yaml)0
-rw-r--r--dashboard/dashboard/mongo2elastic/__init__.py0
-rw-r--r--dashboard/dashboard/mongo2elastic/format.py (renamed from scripts/mongo2elastic_format.py)0
-rw-r--r--dashboard/dashboard/mongo2elastic/main.py (renamed from scripts/mongo_to_elasticsearch.py)25
-rw-r--r--dashboard/dashboard/mongo2elastic_main.py4
-rw-r--r--dashboard/etc/config.ini (renamed from scripts/config.ini)2
-rw-r--r--dashboard/kibana_cleanup.py (renamed from scripts/kibana_cleanup.py)6
20 files changed, 41 insertions, 40 deletions
diff --git a/dashboard.tar.gz b/dashboard.tar.gz
new file mode 100644
index 0000000..ef85f90
--- /dev/null
+++ b/dashboard.tar.gz
Binary files differ
diff --git a/scripts/backup-db.sh b/dashboard/backup-db.sh
index 35c3fbe..35c3fbe 100644
--- a/scripts/backup-db.sh
+++ b/dashboard/backup-db.sh
diff --git a/dashboard/dashboard/__init__.py b/dashboard/dashboard/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/dashboard/dashboard/__init__.py
diff --git a/dashboard/dashboard/common/__init__.py b/dashboard/dashboard/common/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/dashboard/dashboard/common/__init__.py
diff --git a/scripts/shared_utils.py b/dashboard/dashboard/common/elastic_access.py
index e90a17f..e90a17f 100644
--- a/scripts/shared_utils.py
+++ b/dashboard/dashboard/common/elastic_access.py
diff --git a/scripts/logger_utils.py b/dashboard/dashboard/common/logger_utils.py
index 25d28a5..1830808 100644
--- a/scripts/logger_utils.py
+++ b/dashboard/dashboard/common/logger_utils.py
@@ -57,9 +57,9 @@ class Logger(object):
return self.logger
-class KibanaDashboardLogger(Logger):
+class DashboardLogger(Logger):
file_path = '/var/log/kibana_dashboard'
def __init__(self, logger_name):
- super(KibanaDashboardLogger, self).__init__(logger_name)
+ super(DashboardLogger, self).__init__(logger_name)
diff --git a/dashboard/dashboard/conf/__init__.py b/dashboard/dashboard/conf/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/dashboard/dashboard/conf/__init__.py
diff --git a/scripts/config.py b/dashboard/dashboard/conf/config.py
index 2d447a7..2e0f1ca 100644
--- a/scripts/config.py
+++ b/dashboard/dashboard/conf/config.py
@@ -22,7 +22,7 @@ class APIConfig:
"""
def __init__(self):
- self._default_config_location = "./config.ini"
+ self._default_config_location = "../etc/config.ini"
self.elastic_url = 'http://localhost:9200'
self.elastic_creds = None
self.destination = 'elasticsearch'
diff --git a/scripts/testcases_parser.py b/dashboard/dashboard/conf/testcases.py
index cf95998..e120987 100644
--- a/scripts/testcases_parser.py
+++ b/dashboard/dashboard/conf/testcases.py
@@ -1,7 +1,7 @@
import yaml
-with open('./testcases.yaml') as f:
+with open('./functest/testcases.yaml') as f:
testcases_yaml = yaml.safe_load(f)
f.close()
diff --git a/dashboard/dashboard/elastic2kibana/__init__.py b/dashboard/dashboard/elastic2kibana/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/dashboard/dashboard/elastic2kibana/__init__.py
diff --git a/scripts/create_kibana_dashboards.py b/dashboard/dashboard/elastic2kibana/main.py
index 19d5b5e..c1cbc30 100644
--- a/scripts/create_kibana_dashboards.py
+++ b/dashboard/dashboard/elastic2kibana/main.py
@@ -4,12 +4,11 @@ import urlparse
import argparse
-import logger_utils
-import shared_utils
-import testcases_parser
-from config import APIConfig
+from common import logger_utils, elastic_access
+from conf import testcases
+from conf.config import APIConfig
-logger = logger_utils.KibanaDashboardLogger('elastic2kibana').get
+logger = logger_utils.DashboardLogger('elastic2kibana').get
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--config-file",
@@ -18,6 +17,11 @@ parser.add_argument("-c", "--config-file",
args = parser.parse_args()
CONF = APIConfig().parse(args.config_file)
+base_elastic_url = CONF.elastic_url
+generate_inputs = CONF.is_js
+input_file_path = CONF.js_path
+kibana_url = CONF.kibana_url
+es_creds = CONF.elastic_creds
_installers = {'fuel', 'apex', 'compass', 'joid'}
@@ -53,7 +57,7 @@ class KibanaDashboard(dict):
for visualization in self._kibana_visualizations:
url = urlparse.urljoin(base_elastic_url, '/.kibana/visualization/{}'.format(visualization.id))
logger.debug("publishing visualization '{}'".format(url))
- shared_utils.publish_json(visualization, es_creds, url)
+ elastic_access.publish_json(visualization, es_creds, url)
def _construct_panels(self):
size_x = 6
@@ -131,7 +135,7 @@ class KibanaDashboard(dict):
def _publish(self):
url = urlparse.urljoin(base_elastic_url, '/.kibana/dashboard/{}'.format(self.id))
logger.debug("publishing dashboard '{}'".format(url))
- shared_utils.publish_json(self, es_creds, url)
+ elastic_access.publish_json(self, es_creds, url)
def publish(self):
self._publish_visualizations()
@@ -282,8 +286,8 @@ def _get_pods_and_scenarios(project_name, case_name, installer):
}
})
- elastic_data = shared_utils.get_elastic_docs(urlparse.urljoin(base_elastic_url, '/test_results/mongo2elastic'),
- es_creds, query_json)
+ elastic_data = elastic_access.get_elastic_docs(urlparse.urljoin(base_elastic_url, '/test_results/mongo2elastic'),
+ es_creds, query_json)
pods_and_scenarios = {}
@@ -312,7 +316,7 @@ def construct_dashboards():
:return: list of KibanaDashboards
"""
kibana_dashboards = []
- for project, case_dicts in testcases_parser.testcases_yaml.items():
+ for project, case_dicts in testcases.testcases_yaml.items():
for case in case_dicts:
case_name = case.get('name')
visualizations = case.get('visualizations')
@@ -359,13 +363,7 @@ def generate_js_inputs(js_file_path, kibana_url, dashboards):
js_file_fdesc.write(str(js_dict).replace("u'", "'"))
-if __name__ == '__main__':
- base_elastic_url = CONF.elastic_url
- generate_inputs = CONF.is_js
- input_file_path = CONF.js_path
- kibana_url = CONF.kibana_url
- es_creds = CONF.elastic_creds
-
+def main():
dashboards = construct_dashboards()
for kibana_dashboard in dashboards:
diff --git a/dashboard/dashboard/elastic2kibana_main.py b/dashboard/dashboard/elastic2kibana_main.py
new file mode 100644
index 0000000..3ec27cb
--- /dev/null
+++ b/dashboard/dashboard/elastic2kibana_main.py
@@ -0,0 +1,4 @@
+from elastic2kibana.main import main
+
+if __name__ == '__main__':
+ main()
diff --git a/dashboard/dashboard/functest/__init__.py b/dashboard/dashboard/functest/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/dashboard/dashboard/functest/__init__.py
diff --git a/scripts/testcases.yaml b/dashboard/dashboard/functest/testcases.yaml
index 9c33d2e..9c33d2e 100644
--- a/scripts/testcases.yaml
+++ b/dashboard/dashboard/functest/testcases.yaml
diff --git a/dashboard/dashboard/mongo2elastic/__init__.py b/dashboard/dashboard/mongo2elastic/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/dashboard/dashboard/mongo2elastic/__init__.py
diff --git a/scripts/mongo2elastic_format.py b/dashboard/dashboard/mongo2elastic/format.py
index ef485ba..ef485ba 100644
--- a/scripts/mongo2elastic_format.py
+++ b/dashboard/dashboard/mongo2elastic/format.py
diff --git a/scripts/mongo_to_elasticsearch.py b/dashboard/dashboard/mongo2elastic/main.py
index 777eda6..25b5320 100644
--- a/scripts/mongo_to_elasticsearch.py
+++ b/dashboard/dashboard/mongo2elastic/main.py
@@ -10,13 +10,12 @@ import uuid
import argparse
-import logger_utils
-import mongo2elastic_format
-import shared_utils
-import testcases_parser
-from config import APIConfig
+from common import logger_utils, elastic_access
+from conf import testcases
+from conf.config import APIConfig
+from mongo2elastic import format
-logger = logger_utils.KibanaDashboardLogger('mongo2elastic').get
+logger = logger_utils.DashboardLogger('mongo2elastic').get
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--config-file",
@@ -50,7 +49,7 @@ class DocumentPublisher:
def format(self):
try:
if self._verify_document() and self.fmt:
- self.is_formatted = vars(mongo2elastic_format)[self.fmt](self.doc)
+ self.is_formatted = vars(format)[self.fmt](self.doc)
else:
self.is_formatted = False
except Exception:
@@ -65,7 +64,7 @@ class DocumentPublisher:
self._publish()
def _publish(self):
- status, data = shared_utils.publish_json(self.doc, self.creds, self.to)
+ status, data = elastic_access.publish_json(self.doc, self.creds, self.to)
if status > 300:
logger.error('Publish record[{}] failed, due to [{}]'
.format(self.doc, json.loads(data)['error']['reason']))
@@ -201,7 +200,7 @@ class DocumentsPublisher:
exit(-1)
def get_existed_docs(self):
- self.existed_docs = shared_utils.get_elastic_docs_by_days(self.elastic_url, self.creds, self.days)
+ self.existed_docs = elastic_access.get_elastic_docs_by_days(self.elastic_url, self.creds, self.days)
return self
def publish(self):
@@ -231,10 +230,10 @@ def main():
if to == 'elasticsearch':
to = base_elastic_url
- for project, case_dicts in testcases_parser.testcases_yaml.items():
+ for project, case_dicts in testcases.testcases_yaml.items():
for case_dict in case_dicts:
case = case_dict.get('name')
- fmt = testcases_parser.compose_format(case_dict.get('format'))
+ fmt = testcases.compose_format(case_dict.get('format'))
DocumentsPublisher(project,
case,
fmt,
@@ -242,7 +241,3 @@ def main():
base_elastic_url,
es_creds,
to).export().get_existed_docs().publish()
-
-
-if __name__ == '__main__':
- main() \ No newline at end of file
diff --git a/dashboard/dashboard/mongo2elastic_main.py b/dashboard/dashboard/mongo2elastic_main.py
new file mode 100644
index 0000000..141d8f3
--- /dev/null
+++ b/dashboard/dashboard/mongo2elastic_main.py
@@ -0,0 +1,4 @@
+from mongo2elastic.main import main
+
+if __name__ == '__main__':
+ main()
diff --git a/scripts/config.ini b/dashboard/etc/config.ini
index 63d283d..b94ac7b 100644
--- a/scripts/config.ini
+++ b/dashboard/etc/config.ini
@@ -9,6 +9,6 @@ creds =
destination = elasticsearch
[kibana]
-url = http://10.63.243.17/kibana/app/kibana
+url = http://10.63.243.17:5601/app/kibana
js = true
js_path = /usr/share/nginx/html/kibana_dashboards/conf.js
diff --git a/scripts/kibana_cleanup.py b/dashboard/kibana_cleanup.py
index d87d9a2..9ce4994 100644
--- a/scripts/kibana_cleanup.py
+++ b/dashboard/kibana_cleanup.py
@@ -4,7 +4,7 @@ import urlparse
import argparse
-import shared_utils
+from dashboard.common import elastic_access
logger = logging.getLogger('clear_kibana')
logger.setLevel(logging.DEBUG)
@@ -14,10 +14,10 @@ logger.addHandler(file_handler)
def delete_all(url, es_creds):
- ids = shared_utils.get_elastic_docs(url, es_creds, body=None, field='_id')
+ ids = elastic_access.get_elastic_docs(url, es_creds, body=None, field='_id')
for id in ids:
del_url = '/'.join([url, id])
- shared_utils.delete_request(del_url, es_creds)
+ elastic_access.delete_request(del_url, es_creds)
if __name__ == '__main__':