Repository: ambari Updated Branches: refs/heads/trunk 0ed40ae0f -> 0909d7cdb
AMBARI-19373. Grafana datasource changes to accommodate new visualizations for TopN. (Vivek Subramanian via yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0909d7cd Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0909d7cd Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0909d7cd Branch: refs/heads/trunk Commit: 0909d7cdbf5290490c9908e43f34bf02f92e48c3 Parents: 0ed40ae Author: Yusaku Sako <[email protected]> Authored: Fri Jan 6 14:19:08 2017 -0800 Committer: Yusaku Sako <[email protected]> Committed: Fri Jan 6 14:20:09 2017 -0800 ---------------------------------------------------------------------- .../ambari-metrics/datasource.js | 36 +- .../HDP/grafana-hdfs-topn.json | 846 +++++++++++++++++++ 2 files changed, 880 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0909d7cd/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 eb883e8..207db16 100644 --- a/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js +++ b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js @@ -145,16 +145,46 @@ define([ var timeSeries = {}; var metricData = res.metrics; _.map(metricData, function (data) { + var totalCountFlag = false; var aliasSuffix = data.hostname ? ' on ' + data.hostname : ''; + var op = ''; + var user = ''; if(!_.isEmpty(templateSrv.variables) && templateSrv.variables[0].query === "hbase-tables") { var tableName = "Tables."; var tableSuffix = data.metricname.substring(data.metricname.indexOf(tableName) + tableName.length, data.metricname.lastIndexOf("_metric")); - var aliasSuffix = ' on ' + tableSuffix; + aliasSuffix = ' on ' + tableSuffix; } if(templateSrv.variables[0].query === "callers") { alias = data.metricname.substring(data.metricname.indexOf('(')+1, data.metricname.indexOf(')')); } + // Set legend and alias for HDFS - TopN dashboard + if(data.metricname.indexOf('dfs.NNTopUserOpCounts') === 0) { + var metricname_arr = data.metricname.split("."); + _.map(metricname_arr, function (segment) { + if(segment.indexOf('op=') === 0) { + var opKey = 'op='; + op = segment.substring(segment.indexOf(opKey) + opKey.length); + } else if(segment.indexOf('user=') === 0) { + var userKey = 'user='; + user = segment.substring(segment.indexOf(userKey) + userKey.length); + } + }); + // Check if metric is TotalCount + if(data.metricname.indexOf('TotalCount') > 0) { + totalCountFlag = true; + if (op !== '*') { + alias = op; + } else { + alias = 'Total Count'; + } + } else if (op !== '*') { + alias = op + ' by ' + user; + } else { + alias = user; + } + aliasSuffix = ''; + } timeSeries = { target: alias + aliasSuffix, datapoints: [] @@ -164,7 +194,9 @@ define([ timeSeries.datapoints.push([data.metrics[k], (k - k % 1000)]); } } - series.push(timeSeries); + if( (user !== '*') || (totalCountFlag) ) { + series.push(timeSeries); + } }); return $q.when({data: series}); }; http://git-wip-us.apache.org/repos/asf/ambari/blob/0909d7cd/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/grafana-hdfs-topn.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/grafana-hdfs-topn.json b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/grafana-hdfs-topn.json new file mode 100644 index 0000000..5b90ae9 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/grafana-hdfs-topn.json @@ -0,0 +1,846 @@ +{ + "id": null, + "title": "HDFS - TopN", + "originalTitle": "HDFS - TopN", + "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 to see the HDFS operations per user. 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": 1, + "isNew": true, + "links": [], + "mode": "html", + "span": 12, + "style": {}, + "title": "", + "type": "text" + } + ], + "showTitle": false, + "title": "Description" + }, + { + "collapse": false, + "editable": true, + "height": "250px", + "panels": [ + { + "aliasColors": {}, + "bars": false, + "datasource": null, + "editable": true, + "error": false, + "fill": 0, + "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": 3, + "isNew": true, + "legend": { + "alignAsTable": false, + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": false, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 1, + "points": true, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "Total Count", + "lines": true + } + ], + "span": 6, + "stack": false, + "steppedLine": false, + "targets": [ + { + "aggregator": "max", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "metric": "dfs.NNTopUserOpCounts.windowMs=60000.op=*.TotalCount", + "precision": "default", + "refId": "A", + "seriesAggregator": "none", + "transform": "none" + }, + { + "aggregator": "none", + "alias": "operation by user", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "metric": "dfs.NNTopUserOpCounts.windowMs=60000.op=__%.user=%", + "precision": "default", + "refId": "B", + "seriesAggregator": "none", + "transform": "none" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "TopN - Operations by User - 1min Sliding Window", + "tooltip": { + "shared": false, + "value_type": "individual" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "none", + "short" + ] + }, + { + "aliasColors": {}, + "bars": false, + "datasource": null, + "editable": true, + "error": false, + "fill": 0, + "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": 7, + "isNew": true, + "legend": { + "alignAsTable": false, + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": false, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 1, + "points": true, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "Total Count", + "lines": true + } + ], + "span": 6, + "stack": false, + "steppedLine": false, + "targets": [ + { + "aggregator": "max", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "metric": "dfs.NNTopUserOpCounts.windowMs=300000.op=*.TotalCount", + "precision": "default", + "refId": "A", + "seriesAggregator": "none", + "transform": "none" + }, + { + "aggregator": "none", + "alias": "operation by user", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "metric": "dfs.NNTopUserOpCounts.windowMs=300000.op=__%.user=%", + "precision": "default", + "refId": "B", + "seriesAggregator": "none", + "transform": "none" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "TopN - Operations by User - 5min Sliding Window", + "tooltip": { + "shared": false, + "value_type": "individual" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "none", + "short" + ] + }, + { + "aliasColors": {}, + "bars": false, + "datasource": null, + "editable": true, + "error": false, + "fill": 0, + "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": 8, + "isNew": true, + "legend": { + "alignAsTable": false, + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": false, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 1, + "points": true, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "Total Count", + "lines": true + } + ], + "span": 12, + "stack": false, + "steppedLine": false, + "targets": [ + { + "aggregator": "max", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "metric": "dfs.NNTopUserOpCounts.windowMs=1500000.op=*.TotalCount", + "precision": "default", + "refId": "A", + "seriesAggregator": "none", + "transform": "none" + }, + { + "aggregator": "none", + "alias": "operation by user", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "metric": "dfs.NNTopUserOpCounts.windowMs=1500000.op=__%.user=%", + "precision": "default", + "refId": "B", + "seriesAggregator": "none", + "transform": "none" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "TopN - Operations by User - 25min Sliding Window", + "tooltip": { + "shared": false, + "value_type": "individual" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "none", + "short" + ] + } + ], + "showTitle": true, + "title": "TopN - Operations By User" + }, + { + "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": 5, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "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": 6, + "stack": false, + "steppedLine": false, + "targets": [ + { + "aggregator": "avg", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "metric": "dfs.NNTopUserOpCounts.windowMs=1500000.op=%.TotalCount", + "precision": "default", + "refId": "A", + "seriesAggregator": "none", + "transform": "none" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "TopN - Total Operations Count - 1min Sliding Window", + "tooltip": { + "shared": true, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "short", + "short" + ] + }, + { + "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": 9, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "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": 6, + "stack": false, + "steppedLine": false, + "targets": [ + { + "aggregator": "avg", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "metric": "dfs.NNTopUserOpCounts.windowMs=1500000.op=%.TotalCount", + "precision": "default", + "refId": "A", + "seriesAggregator": "none", + "transform": "none" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "TopN - Total Operations Count - 5min Sliding Window", + "tooltip": { + "shared": true, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "short", + "short" + ] + }, + { + "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": 10, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "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", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "metric": "dfs.NNTopUserOpCounts.windowMs=1500000.op=%.TotalCount", + "precision": "default", + "refId": "A", + "seriesAggregator": "none", + "transform": "none" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "TopN - Total Operations Count - 25min Sliding Window", + "tooltip": { + "shared": true, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "short", + "short" + ] + } + ], + "showTitle": true, + "title": "TopN - Operations Count" + }, + { + "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": 6, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "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": 6, + "stack": false, + "steppedLine": false, + "targets": [ + { + "aggregator": "none", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "metric": "dfs.NNTopUserOpCounts.windowMs=1500000.op=*.user=%.count", + "precision": "default", + "refId": "A", + "seriesAggregator": "none", + "transform": "none" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "TopN - Total Operations Count by User - 1min Sliding Window", + "tooltip": { + "shared": true, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "short", + "short" + ] + }, + { + "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": 11, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "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": 6, + "stack": false, + "steppedLine": false, + "targets": [ + { + "aggregator": "none", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "metric": "dfs.NNTopUserOpCounts.windowMs=1500000.op=*.user=%.count", + "precision": "default", + "refId": "A", + "seriesAggregator": "none", + "transform": "none" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "TopN - Total Operations Count by User - 5min Sliding Window", + "tooltip": { + "shared": true, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "short", + "short" + ] + }, + { + "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": 12, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "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": "none", + "app": "namenode", + "downsampleAggregator": "avg", + "errors": {}, + "metric": "dfs.NNTopUserOpCounts.windowMs=1500000.op=*.user=%.count", + "precision": "default", + "refId": "A", + "seriesAggregator": "none", + "transform": "none" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "TopN - Total Operations Count by User - 25min Sliding Window", + "tooltip": { + "shared": true, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "short", + "short" + ] + } + ], + "showTitle": true, + "title": "TOPN - Total Operations Count by User" + } + ], + "time": { + "from": "now-3h", + "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": "namenode", + "value": "namenode" + }, + "datasource": null, + "hideLabel": true, + "includeAll": false, + "multi": false, + "multiFormat": "glob", + "name": "components", + "options": [ + { + "selected": true, + "text": "namenode", + "value": "namenode" + } + ], + "query": "namenode", + "refresh": false, + "type": "custom" + }, + { + "allFormat": "glob", + "current": { + "text": "All", + "value": "" + }, + "datasource": null, + "includeAll": true, + "multi": true, + "multiFormat": "glob", + "name": "hosts", + "options": [ + { + "text": "All", + "value": "", + "selected": true + } + ], + "query": "hosts", + "refresh": true, + "regex": "", + "type": "query" + } + ] + }, + "annotations": { + "list": [] + }, + "refresh": false, + "schemaVersion": 8, + "version": 26, + "links": [ + { + "asDropdown": true, + "icon": "external link", + "keepTime": true, + "tags": [ + "hdfs" + ], + "title": "HDFS Dashboards", + "type": "dashboards" + } + ] +} \ No newline at end of file
