2 ##############################################################################
3 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 '''This file realize a function of creating dashboard of stress ping test'''
12 from elasticsearch import Elasticsearch
14 import utils.logger as log
15 from utils.parser import Parser as conf_parser
17 LOG = log.Logger(__name__).getLogger()
18 config = ConfigParser.ConfigParser()
20 dashboard_path = os.path.join(conf_parser.test_dir,
23 dashboard_dir = dashboard_path + "/"
26 def dashboard_send_data(runner_config, test_data):
29 es_ip = runner_config['dashboard_ip'].split(':')
30 es = Elasticsearch([{'host': es_ip[0]}])
31 print test_data["test_body"]
32 res = es.index(index="bottlenecks",
33 doc_type=test_data["testcase"],
34 body=test_data["test_body"][0])
35 if res['created'] == "False":
36 LOG.error("date send to kibana have errors ", test_data["data_body"])