浏览代码

AMBARI-14976 Add Grafana QuickLinks for AMS Service in Ambari Web. (atkach)

Andrii Tkach 9 年之前
父节点
当前提交
a638ccb534

+ 7 - 0
ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml

@@ -161,6 +161,13 @@
         <config-type>storm-site</config-type>
       </excluded-config-types>
 
+      <quickLinksConfigurations>
+        <quickLinksConfiguration>
+          <fileName>quicklinks.json</fileName>
+          <default>true</default>
+        </quickLinksConfiguration>
+      </quickLinksConfigurations>
+
     </service>
   </services>
 </metainfo>

+ 34 - 0
ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/quickLinks/quicklinks.json

@@ -0,0 +1,34 @@
+{
+  "name": "default",
+  "description": "default quick links configuration",
+  "configuration": {
+    "protocol":
+    {
+      "type":"https",
+      "checks":[
+        {
+          "property":"protocol",
+          "desired":"https",
+          "site":"ams-grafana-ini"
+        }
+      ]
+    },
+    "links": [
+      {
+        "name": "metrics_ui_server",
+        "label": "Metrics UI Server",
+        "requires_user_name": "false",
+        "url":"%@://%@:%@",
+        "template":"%@://%@:%@",
+        "port":{
+          "http_property": "port",
+          "http_default_port": "3000",
+          "https_property": "port",
+          "https_default_port": "3000",
+          "regex": "^(\\d+)$",
+          "site": "ams-grafana-ini"
+        }
+      }
+    ]
+  }
+}

+ 2 - 1
ambari-web/app/mappers/service_metrics_mapper.js

@@ -387,7 +387,8 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
       RANGER: [33],
       SPARK: [34],
       ACCUMULO: [35],
-      ATLAS: [36]
+      ATLAS: [36],
+      AMBARI_METRICS: [37]
     };
     if (quickLinks[item.ServiceInfo.service_name])
       finalJson.quick_links = quickLinks[item.ServiceInfo.service_name];

+ 12 - 0
ambari-web/app/models/quick_links.js

@@ -343,6 +343,18 @@ App.QuickLinks.FIXTURES = [
     regex: '^(\\d+)$',
     default_http_port: 21000,
     default_https_port: 21443
+  },
+  {
+    id:37,
+    label:'Metrics UI Server',
+    url:'%@://%@:%@',
+    service_id: 'AMBARI_METRICS',
+    template:'%@://%@:%@',
+    http_config: 'port',
+    site: 'ams-grafana-ini',
+    regex: '^(\\d+)$',
+    default_http_port: 3000,
+    default_https_port: 3000
   }
 
 ];

+ 3 - 0
ambari-web/app/views/common/quick_view_link_view.js

@@ -549,6 +549,9 @@ App.QuickViewLinks = Em.View.extend({
       case "MAPREDUCE2":
         hosts = this.findHosts('HISTORYSERVER', response);
         break;
+      case "AMBARI_METRICS":
+        hosts = this.findHosts('METRICS_GRAFANA', response);
+        break;
       default:
         if (this.getWithDefault('content.hostComponents', []).someProperty('isMaster')) {
           hosts = this.findHosts(this.get('content.hostComponents').findProperty('isMaster').get('componentName'), response);

+ 5 - 0
ambari-web/test/views/common/quick_link_view_test.js

@@ -959,6 +959,11 @@ describe('App.QuickViewLinks', function () {
       expect(quickViewLinks.findHosts.calledWith('HISTORYSERVER', {})).to.be.true;
     });
 
+    it("AMBARI_METRICS service", function() {
+      expect(quickViewLinks.getHosts({}, 'AMBARI_METRICS')).to.eql(['host1']);
+      expect(quickViewLinks.findHosts.calledWith('METRICS_GRAFANA', {})).to.be.true;
+    });
+
     it("custom service without master", function() {
       expect(quickViewLinks.getHosts({}, 'S1')).to.be.empty;
     });