You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ga...@apache.org on 2015/10/27 06:49:57 UTC

ambari git commit: AMBARI-13138. Use ranger port value from configs for alerts in Ambari (HDP-2.2)

Repository: ambari
Updated Branches:
  refs/heads/trunk 5857a3ee4 -> f9e73665b


AMBARI-13138. Use ranger port value from configs for alerts in Ambari (HDP-2.2)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f9e73665
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f9e73665
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f9e73665

Branch: refs/heads/trunk
Commit: f9e73665b48c44cb6e8118bb613d81584fddc497
Parents: 5857a3e
Author: Gautam Borad <ga...@apache.org>
Authored: Thu Oct 15 11:26:38 2015 +0530
Committer: Gautam Borad <ga...@apache.com>
Committed: Tue Oct 27 11:19:48 2015 +0530

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog210.java       | 42 ++++++++++++++++++++
 .../common-services/RANGER/0.4.0/alerts.json    | 23 ++++++-----
 .../RANGER/0.4.0/configuration/ranger-site.xml  |  3 +-
 3 files changed, 57 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f9e73665/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
index dc633e3..ac5df7c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
@@ -1289,6 +1289,48 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
                 rootJson.toString(), UUID.randomUUID().toString());
           }
 
+          // update ranger admin alerts from type port(2.2) to web(2.3)
+          AlertDefinitionEntity rangerAdminDefinitionEntity = alertDefinitionDAO.findByName(
+            cluster.getClusterId(), "ranger_admin_process");
+
+          if (rangerAdminDefinitionEntity != null) {
+            String source = rangerAdminDefinitionEntity.getSource();
+            JsonObject rootJson = new JsonParser().parse(source).getAsJsonObject();
+            JsonObject uriJson = new JsonObject();
+            JsonObject reporting = rootJson.getAsJsonObject("reporting");
+            JsonObject ok = reporting.getAsJsonObject("ok");
+            JsonObject warning = reporting.getAsJsonObject("warning");
+            JsonObject critical = reporting.getAsJsonObject("critical");            
+
+            rootJson.remove("type");
+            rootJson.remove("default_port");
+            rootJson.addProperty("type", "WEB");
+
+            uriJson.addProperty("http", "{{admin-properties/policymgr_external_url}}");
+            uriJson.addProperty("https", "{{admin-properties/policymgr_external_url}}");
+            uriJson.addProperty("https_property", "{{ranger-site/http.enabled}}");
+            uriJson.addProperty("https_property_value", "false");
+            uriJson.addProperty("connection_timeout", 5.0f);
+
+            rootJson.remove("uri");
+            rootJson.add("uri", uriJson);
+
+            ok.remove("text");
+            ok.addProperty("text", "HTTP {0} response in {2:.3f}s");
+
+            warning.remove("text");
+            warning.remove("value");
+            warning.addProperty("text", "HTTP {0} response from {1} in {2:.3f}s ({3})");
+
+            critical.remove("text");
+            critical.remove("value");
+            critical.addProperty("text", "Connection failed to {1} ({3})");
+
+            // save the changes
+            updateAlertDefinitionEntitySource("ranger_admin_process",
+              rootJson.toString(), UUID.randomUUID().toString());
+          }
+
           // update oozie web ui alert
           AlertDefinitionEntity oozieWebUIAlertDefinitionEntity = alertDefinitionDAO.findByName(
               cluster.getClusterId(), "oozie_server_webui");

http://git-wip-us.apache.org/repos/asf/ambari/blob/f9e73665/ambari-server/src/main/resources/common-services/RANGER/0.4.0/alerts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/alerts.json b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/alerts.json
index 05ccc1d..62f29eb 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/alerts.json
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/alerts.json
@@ -5,24 +5,27 @@
       {
         "name": "ranger_admin_process",
         "label": "Ranger Admin Process",
-        "description": "This host-level alert is triggered if the Ranger Admin cannot be determined to be up.",
+        "description": "This host-level alert is triggered if the Ranger Admin Web UI is unreachable.",
         "interval": 1,
-        "scope": "HOST",
+        "scope": "ANY",
         "source": {
-          "type": "PORT",
-          "uri": "{{ranger-site/HTTP_SERVICE_PORT}}",
-          "default_port": 6080,
+          "type": "WEB",
+          "uri": {
+              "http": "{{admin-properties/policymgr_external_url}}",
+              "https": "{{admin-properties/policymgr_external_url}}",
+              "https_property": "{{ranger-site/http.enabled}}",
+              "https_property_value": "false",
+              "connection_timeout": 5.0
+            },
           "reporting": {
             "ok": {
-              "text": "TCP OK - {0:.3f}s response on port {1}"
+              "text": "HTTP {0} response in {2:.3f}s"
             },
             "warning": {
-              "text": "TCP OK - {0:.3f}s response on port {1}",
-              "value": 1.5
+              "text": "HTTP {0} response from {1} in {2:.3f}s ({3})"
             },
             "critical": {
-              "text": "Connection failed: {0} to {1}:{2}",
-              "value": 5.0
+              "text": "Connection failed to {1} ({3})"
             }
           }
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f9e73665/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-site.xml b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-site.xml
index 293c925..daab4ec 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-site.xml
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-site.xml
@@ -41,7 +41,8 @@
 
   <property>
     <name>https.attrib.keystorePass</name>
-    <value>ranger</value>
+    <value>xasecure</value>
+    <property-type>PASSWORD</property-type>
     <description>The keystore pass to be used </description>
   </property>