Repository: ambari Updated Branches: refs/heads/trunk f070a5910 -> 3b8da53d6
AMBARI-16990. [Grafana] Add HDFS - Users dashboard. (Prajwal Rao via yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3b8da53d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3b8da53d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3b8da53d Branch: refs/heads/trunk Commit: 3b8da53d619e6ad2ef82c3a9f37dbb1471d2e7b4 Parents: f070a59 Author: Yusaku Sako <[email protected]> Authored: Mon Jun 6 13:11:35 2016 -0700 Committer: Yusaku Sako <[email protected]> Committed: Mon Jun 6 13:11:35 2016 -0700 ---------------------------------------------------------------------- .../ambari-metrics/datasource.js | 45 ++++ .../HDP/grafana-hdfs-users.json | 270 +++++++++++++++++++ 2 files changed, 315 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/3b8da53d/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js index 6c6b43b..7390aa8 100644 --- a/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js +++ b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js @@ -143,6 +143,9 @@ define([ data.metricname.lastIndexOf("_metric")); var aliasSuffix = ' on ' + tableSuffix; } + if(templateSrv.variables[0].query === "callers") { + alias = data.metricname.substring(data.metricname.indexOf('(')+1, data.metricname.indexOf(')')); + } timeSeries = { target: alias + aliasSuffix, datapoints: [] @@ -236,6 +239,16 @@ define([ getMetricsData(target) ); }; + var getNnAppIdData = function(target) { + var precision = target.precision === 'default' || typeof target.precision == 'undefined' ? '' : '&precision=' + + target.precision; + var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator; + var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform; + return backendSrv.get(self.url + '/ws/v1/timeline/metrics?metricNames=' + target.nnMetric + metricTransform + + metricAggregator + '&appId=namenode&startTime=' + from + '&endTime=' + to + precision).then( + allHostMetricsData(target) + ); + }; // Time Ranges var from = Math.floor(options.range.from.valueOf() / 1000); @@ -320,6 +333,22 @@ define([ })); }); } + //Templatized Dashboard for Call Queues + if (templateSrv.variables[0].query === "callers") { + var allCallers = templateSrv.variables.filter(function(variable) { return variable.query === "callers";}); + var selectedCallers = (_.isEmpty(allCallers)) ? "" : allCallers[0].options.filter(function(user) + { return user.selected; }).map(function(callerName) { return callerName.value; }); + selectedCallers = templateSrv._values.Callers.lastIndexOf('}') > 0 ? templateSrv._values.Callers.slice(1,-1) : + templateSrv._values.Callers; + var selectedCaller = selectedCallers.split(','); + _.forEach(selectedCaller, function(processCaller) { + metricsPromises.push(_.map(options.targets, function(target) { + target.nnCaller = processCaller; + target.nnMetric = target.metric.replace('*', target.nnCaller); + return getNnAppIdData(target); + })); + }); + } // To speed up querying on templatized dashboards. if (templateSrv.variables[1] && templateSrv.variables[1].name === "hosts") { @@ -458,6 +487,22 @@ define([ }); } + //Templated Variables for Call Queue Metrics + if(interpolated === "callers") { + return this.initMetricAppidMapping() + .then(function () { + var nnCallers = allMetrics["namenode"]; + var extractCallers = nnCallers.filter(/./.test.bind(new + RegExp("ipc.client.org.apache.hadoop.ipc.DecayRpcScheduler.Caller", 'g'))); + var callers = _.sortBy(_.uniq(_.map(extractCallers, function(caller) { + return caller.substring(caller.indexOf('(')+1, caller.indexOf(')')) }))); + return _.map(callers, function (callers) { + return { + text: callers + }; + }); + }); + } // Templated Variable for YARN Queues. // It will search the cluster and populate the queues. if(interpolated === "yarnqueues") { http://git-wip-us.apache.org/repos/asf/ambari/blob/3b8da53d/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/grafana-hdfs-users.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/grafana-hdfs-users.json b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/grafana-hdfs-users.json new file mode 100644 index 0000000..3b98af9 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/grafana-hdfs-users.json @@ -0,0 +1,270 @@ +{ + "id": null, + "title": "HDFS - Users", + "originalTitle": "HDFS - Users", + "tags": [ + "hdfs" + ], + "style": "dark", + "timezone": "browser", + "editable": true, + "hideControls": false, + "sharedCrosshair": false, + "rows": [ + { + "collapse": false, + "editable": true, + "height": "25px", + "panels": [ + { + "content": "<h4 align=\"center\">Metrics for HDFS Namenode RPC Call Queue status in terms of call volumes for top users and their priority assignment. Click on each row title to expand on demand to look at various metrics. </h4>\n<h6 style=\"color:red;\" align=\"center\">This dashboard is managed by Ambari. You may lose any changes made to this dashboard. If you want to customize, make your own copy.</h6>", + "editable": true, + "error": false, + "id": 3, + "isNew": true, + "links": [], + "mode": "html", + "span": 12, + "style": {}, + "title": "", + "type": "text" + } + ], + "title": "New row" + }, + { + "collapse": false, + "editable": true, + "height": "250px", + "panels": [ + { + "aliasColors": {}, + "bars": false, + "datasource": null, + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": 0, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null, + "threshold1": null, + "threshold1Color": "rgba(216, 200, 27, 0.27)", + "threshold2": null, + "threshold2Color": "rgba(234, 112, 112, 0.22)" + }, + "id": 1, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "hideEmpty": true, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "span": 12, + "stack": false, + "steppedLine": false, + "targets": [ + { + "aggregator": "avg", + "alias": "Volume", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "hosts": "", + "metric": "ipc.client.org.apache.hadoop.ipc.DecayRpcScheduler.Caller(*).Volume", + "precision": "default", + "refId": "A", + "transform": "diff" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Namenode Rpc Caller Volume", + "tooltip": { + "shared": false, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "short", + "short" + ] + } + ], + "title": "Row" + }, + { + "collapse": false, + "editable": true, + "height": "250px", + "panels": [ + { + "aliasColors": {}, + "bars": false, + "datasource": null, + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null, + "threshold1": null, + "threshold1Color": "rgba(216, 200, 27, 0.27)", + "threshold2": null, + "threshold2Color": "rgba(234, 112, 112, 0.22)" + }, + "id": 2, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "hideEmpty": true, + "hideZero": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": false, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 3, + "points": true, + "renderer": "flot", + "seriesOverrides": [], + "span": 12, + "stack": false, + "steppedLine": false, + "targets": [ + { + "aggregator": "avg", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "metric": "ipc.client.org.apache.hadoop.ipc.DecayRpcScheduler.Caller(*).Priority", + "precision": "default", + "refId": "A", + "transform": "none" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Namenode Rpc Caller Priority", + "tooltip": { + "shared": false, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "short", + "short" + ] + } + ], + "title": "New row" + } + ], + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": { + "now": true, + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "templating": { + "list": [ + { + "allFormat": "glob", + "current": { + "text": "All", + "value": "" + }, + "datasource": null, + "hideLabel": false, + "includeAll": true, + "multi": true, + "multiFormat": "glob", + "name": "Callers", + "options": [ + { + "text": "All", + "value": "", + "selected": true + } + ], + "query": "callers", + "refresh": true, + "regex": "", + "type": "query" + } + ] + }, + "annotations": { + "list": [] + }, + "refresh": false, + "schemaVersion": 8, + "version": 27, + "links": [ + { + "asDropdown": true, + "icon": "external link", + "tags": [ + "hdfs" + ], + "title": "HDFS Dashboards", + "type": "dashboards" + } + ] +} \ No newline at end of file
