You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2016/05/04 14:55:15 UTC
ambari git commit: AMBARI-16249. Cannot import metrics exported by
the export metrics script.(vbrodetskyi)
Repository: ambari
Updated Branches:
refs/heads/trunk cb8dca09c -> 4bdca9aee
AMBARI-16249. Cannot import metrics exported by the export metrics script.(vbrodetskyi)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4bdca9ae
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4bdca9ae
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4bdca9ae
Branch: refs/heads/trunk
Commit: 4bdca9aee7aa89a4beb620955f4f4c62d0639a55
Parents: cb8dca0
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Wed May 4 17:54:48 2016 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Wed May 4 17:54:48 2016 +0300
----------------------------------------------------------------------
.../main/resources/scripts/export_ams_metrics.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4bdca9ae/ambari-server/src/main/resources/scripts/export_ams_metrics.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/scripts/export_ams_metrics.py b/ambari-server/src/main/resources/scripts/export_ams_metrics.py
index 31fc07b..b492a8c 100644
--- a/ambari-server/src/main/resources/scripts/export_ams_metrics.py
+++ b/ambari-server/src/main/resources/scripts/export_ams_metrics.py
@@ -222,8 +222,8 @@ class AmsMetricsProcessor:
Params.METRICS.append(os.path.basename(metric))
metric_file = os.path.join(dir_item_path, metric)
metrics_for_hosts[dir_item][metric] = Utils.read_json_file(metric_file)
- elif os.path.isfile(dir_item_path):
- if dir_item not in Params.METRICS and dir_item != "configs":
+ elif os.path.isfile(dir_item_path) and dir_item != "configs":
+ if dir_item not in Params.METRICS:
Params.METRICS.append(os.path.basename(dir_item))
metric_file = os.path.join(Params.INPUT_DIR, dir_item_path)
metrics_for_hosts[dir_item] = Utils.read_json_file(metric_file)
@@ -312,10 +312,18 @@ class MetricsResource(Resource):
def get(self):
args = request.args
separator = "._"
+
if not "metricNames" in args:
logger.error("Bad request")
abort(404)
- metric_name, operation = args["metricNames"].split(separator, 1)
+
+ if separator in args["metricNames"]:
+ metric_name, operation = args["metricNames"].split(separator, 1)
+ else:
+ metric_name = args["metricNames"]
+ separator = ""
+ operation = ""
+
metric_dict = {"metrics" : []}
if "hostname" in args and args["hostname"] != "":
@@ -439,7 +447,7 @@ def main():
Params.PRECISION = options.precision
- Params.OUT_DIR = options.output_dir
+ Params.OUT_DIR = output_dir if options.output_dir == output_dir else os.path.join(options.output_dir, 'ambari_metrics_export_' + time_suffix)
if Params.START_TIME == -1:
logger.warn('No start time provided, or it is in the wrong format. Please '