Browse Source

AMBARI-6257. Ganglia is not coming up on SUSE after cluster install. (aonishuk)

Andrew Onishuk 11 năm trước cách đây
mục cha
commit
4b8eef1a95
18 tập tin đã thay đổi với 113 bổ sung52 xóa
  1. 3 3
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/metainfo.xml
  2. 1 7
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/files/startRrdcached.sh
  3. 10 3
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/scripts/ganglia_server.py
  4. 10 0
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/scripts/params.py
  5. 34 0
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/templates/ganglia.conf.j2
  6. 1 0
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/templates/gangliaEnv.sh.j2
  7. 5 10
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/metainfo.xml
  8. 1 7
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/files/startRrdcached.sh
  9. 6 6
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/scripts/ganglia_server.py
  10. 14 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/scripts/params.py
  11. 2 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/templates/ganglia.conf.j2
  12. 1 0
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/templates/gangliaEnv.sh.j2
  13. 7 3
      ambari-server/src/test/python/stacks/1.3.2/GANGLIA/test_ganglia_server.py
  14. 3 2
      ambari-server/src/test/python/stacks/1.3.2/configs/default.json
  15. 3 2
      ambari-server/src/test/python/stacks/1.3.2/configs/secured.json
  16. 7 3
      ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_server.py
  17. 2 1
      ambari-server/src/test/python/stacks/2.0.6/configs/default.json
  18. 3 2
      ambari-server/src/test/python/stacks/2.0.6/configs/secured.json

+ 3 - 3
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/metainfo.xml

@@ -52,6 +52,9 @@
         <osSpecific>
           <osFamily>any</osFamily>
           <packages>
+            <package>
+              <name>python-rrdtool-1.4.5</name>
+            </package>
             <package>
               <name>libganglia-3.5.0-99</name>
             </package>
@@ -64,9 +67,6 @@
             <package>
               <name>ganglia-web-3.5.7-99.noarch</name>
             </package>
-            <package>
-              <name>python-rrdtool.x86_64</name>
-            </package>
             <package>
               <name>ganglia-gmond-3.5.0-99</name>
             </package>

+ 1 - 7
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/files/startRrdcached.sh

@@ -62,13 +62,7 @@ then
     fi
 
     #Configure Ganglia Web to work with RRDCached
-    GANGLIA_WEB_CONFIG_FILE=""
-    if [ -f /etc/SuSE-release ]
-    then
-      GANGLIA_WEB_CONFIG_FILE=/srv/www/htdocs/ganglia/conf_default.php
-    else
-      GANGLIA_WEB_CONFIG_FILE=/var/www/html/ganglia/conf_default.php
-    fi
+    GANGLIA_WEB_CONFIG_FILE=${GANGLIA_WEB_PATH}/conf_default.php
 
     if [ -f $GANGLIA_WEB_CONFIG_FILE ]
     then

+ 10 - 3
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/scripts/ganglia_server.py

@@ -55,6 +55,7 @@ class GangliaServer(Script):
 
   def configure(self, env):
     import params
+    env.set_params(params)
 
     ganglia.groups_and_users()
     ganglia.config()
@@ -81,11 +82,11 @@ class GangliaServer(Script):
 def change_permission():
   import params
 
-  Directory('/var/lib/ganglia/dwoo',
-            mode=0777,
-            owner=params.gmetad_user,
+  Directory(params.dwoo_path,
+            mode=0755,
             recursive=True
   )
+  Execute(format("chown -R {web_user} {dwoo_path}"))
 
 
 def server_files():
@@ -110,6 +111,12 @@ def server_files():
             recursive=True
   )
 
+  if System.get_instance().os_family == "suse":
+    File( params.ganglia_apache_config_file,
+          content = Template("ganglia.conf.j2"),
+          mode = 0644
+    )
+
 
 if __name__ == "__main__":
   GangliaServer().execute()

+ 10 - 0
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/scripts/params.py

@@ -18,6 +18,7 @@ limitations under the License.
 
 from resource_management import *
 from resource_management.core.system import System
+import os
 
 config = Script.get_config()
 
@@ -93,7 +94,16 @@ for key in ganglia_cluster_names:
       ganglia_clusters.append(x)
 
 
+ganglia_apache_config_file = "/etc/apache2/conf.d/ganglia.conf"
+ganglia_web_path="/var/www/html/ganglia"
 if System.get_instance().os_family == "suse":
   rrd_py_path = '/srv/www/cgi-bin'
+  dwoo_path = '/var/lib/ganglia-web/dwoo'
+  web_user = "wwwrun"
+  # for upgrade purposes as path to ganglia was changed
+  if not os.path.exists(ganglia_web_path):
+    ganglia_web_path='/srv/www/htdocs/ganglia'
 else:
   rrd_py_path = '/var/www/cgi-bin'
+  dwoo_path = '/var/lib/ganglia/dwoo'
+  web_user = "apache"

+ 34 - 0
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/templates/ganglia.conf.j2

@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+Alias /ganglia "{{ganglia_web_path}}"
+
+<Directory "{{ganglia_web_path}}">
+#  SSLRequireSSL
+   Options None
+   AllowOverride None
+   Order allow,deny
+   Allow from all
+#  Order deny,allow
+#  Deny from all
+#  Allow from 127.0.0.1
+#  AuthName "Ganglia Access"
+#  AuthType Basic
+#  AuthUserFile /etc/ganglia/htpasswd.users
+#  Require valid-user
+</Directory>

+ 1 - 0
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/templates/gangliaEnv.sh.j2

@@ -41,3 +41,4 @@ RRD_ROOTDIR={{rrdcached_base_dir}}
 GMETAD_USER={{gmetad_user}};
 GMOND_USER={{gmond_user}};
 WEBSERVER_GROUP={{webserver_group}};
+GANGLIA_WEB_PATH={{ganglia_web_path}}

+ 5 - 10
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/metainfo.xml

@@ -50,16 +50,11 @@
       </components>
       <osSpecifics>
         <osSpecific>
-          <osFamily>any</osFamily>
+          <osFamily>redhat5,redhat6,suse11</osFamily>
           <packages>
             <package>
-              <name>python-rrdtool</name>
+              <name>python-rrdtool-1.4.5</name>
             </package>
-          </packages>
-        </osSpecific>
-        <osSpecific>
-          <osFamily>redhat5,redhat6,suse11</osFamily>
-          <packages>
             <package>
               <name>libganglia-3.5.0-99</name>
             </package>
@@ -72,9 +67,6 @@
             <package>
               <name>ganglia-web-3.5.7-99.noarch</name>
             </package>
-            <package>
-              <name>python-rrdtool.x86_64</name>
-            </package>
             <package>
               <name>ganglia-gmond-3.5.0-99</name>
             </package>
@@ -86,6 +78,9 @@
         <osSpecific>
           <osFamily>debian12</osFamily>
           <packages>
+            <package>
+              <name>python-rrdtool</name>
+            </package>
             <package>
               <name>gmetad</name>
             </package>

+ 1 - 7
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/files/startRrdcached.sh

@@ -62,13 +62,7 @@ then
     fi
 
     #Configure Ganglia Web to work with RRDCached
-    GANGLIA_WEB_CONFIG_FILE=""
-    if [ -f /etc/SuSE-release ]
-    then
-      GANGLIA_WEB_CONFIG_FILE=/srv/www/htdocs/ganglia/conf_default.php
-    else
-      GANGLIA_WEB_CONFIG_FILE=/var/www/html/ganglia/conf_default.php
-    fi
+    GANGLIA_WEB_CONFIG_FILE=${GANGLIA_WEB_PATH}/conf_default.php
 
     if [ -f $GANGLIA_WEB_CONFIG_FILE ]
     then

+ 6 - 6
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/scripts/ganglia_server.py

@@ -57,6 +57,7 @@ class GangliaServer(Script):
 
   def configure(self, env):
     import params
+    env.set_params(params)
 
     ganglia.groups_and_users()
     ganglia.config()
@@ -78,12 +79,11 @@ class GangliaServer(Script):
 def change_permission():
   import params
 
-  Directory('/var/lib/ganglia/dwoo',
-            mode=0777,
-            owner=params.gmetad_user,
+  Directory(params.dwoo_path,
+            mode=0755,
             recursive=True
   )
-
+  Execute(format("chown -R {web_user} {dwoo_path}"))
 
 def server_files():
   import params
@@ -107,8 +107,8 @@ def server_files():
             recursive=True
   )
   
-  if System.get_instance().os_family == "debian":
-    File( params.ganglia_debian_apache_conf_file,
+  if System.get_instance().os_family in ["debian","suse"]:
+    File( params.ganglia_apache_config_file,
       content = Template("ganglia.conf.j2"),
       mode = 0644
     )

+ 14 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/scripts/params.py

@@ -18,6 +18,7 @@ limitations under the License.
 
 from resource_management import *
 from resource_management.core.system import System
+import os
 
 config = Script.get_config()
 
@@ -50,7 +51,6 @@ rrdcached_delay = default("/configurations/global/rrdcached_delay", 1800)
 rrdcached_write_threads = default("/configurations/global/rrdcached_write_threads", 10)
 
 ganglia_server_host = config["clusterHostInfo"]["ganglia_server_host"][0]
-ganglia_debian_apache_conf_file = "/etc/apache2/conf.d/ganglia.conf"
 
 hostname = config["hostname"]
 namenode_host = set(default("/clusterHostInfo/namenode_host", []))
@@ -133,9 +133,22 @@ if len(gmond_apps) > 0:
     for x in ganglia_cluster_names[gmond_app]:
       ganglia_clusters.append(x)
 
+ganglia_apache_config_file = "/etc/apache2/conf.d/ganglia.conf"
+ganglia_web_path="/var/www/html/ganglia"
 if System.get_instance().os_family == "suse":
   rrd_py_path = '/srv/www/cgi-bin'
+  dwoo_path = '/var/lib/ganglia-web/dwoo'
+  web_user = "wwwrun"
+  # for upgrade purposes as path to ganglia was changed
+  if not os.path.exists(ganglia_web_path):
+    ganglia_web_path='/srv/www/htdocs/ganglia'
+
 elif  System.get_instance().os_family == "redhat":
   rrd_py_path = '/var/www/cgi-bin'
+  dwoo_path = '/var/lib/ganglia/dwoo'
+  web_user = "apache"
 elif  System.get_instance().os_family == "debian":
   rrd_py_path = '/usr/lib/cgi-bin'
+  ganglia_web_path = '/usr/share/ganglia-webfrontend'
+  dwoo_path = '/var/lib/ganglia/dwoo'
+  web_user = "www-data"

+ 2 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/templates/ganglia.conf.j2

@@ -16,9 +16,9 @@
 # under the License.
 #
 
-Alias /ganglia "/usr/share/ganglia-webfrontend"
+Alias /ganglia "{{ganglia_web_path}}"
 
-<Directory "/usr/share/ganglia-webfrontend">
+<Directory "{{ganglia_web_path}}">
 #  SSLRequireSSL
    Options None
    AllowOverride None

+ 1 - 0
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/templates/gangliaEnv.sh.j2

@@ -43,3 +43,4 @@ GMETAD_USER={{gmetad_user}};
 GMOND_USER={{gmond_user}};
 WEBSERVER_GROUP={{webserver_group}};
 MODULES_DIR={{modules_dir}}
+GANGLIA_WEB_PATH={{ganglia_web_path}}

+ 7 - 3
ambari-server/src/test/python/stacks/1.3.2/GANGLIA/test_ganglia_server.py

@@ -168,11 +168,11 @@ class TestGangliaServer(RMFTestCase):
            '/bin',
            '/usr/bin'],
     )
-    self.assertResourceCalled('Directory', '/var/lib/ganglia/dwoo',
-        owner = 'nobody',
+    self.assertResourceCalled('Directory', '/var/lib/ganglia-web/dwoo',
         recursive = True,
-        mode = 0777,
+        mode = 0755,
     )
+    self.assertResourceCalled('Execute', 'chown -R wwwrun /var/lib/ganglia-web/dwoo',)
     self.assertResourceCalled('Directory', '/srv/www/cgi-bin',
         recursive = True,
     )
@@ -187,6 +187,10 @@ class TestGangliaServer(RMFTestCase):
         recursive = True,
         mode = 0755,
     )
+    self.assertResourceCalled('File', '/etc/apache2/conf.d/ganglia.conf',
+                              content = Template('ganglia.conf.j2'),
+                              mode = 0644,
+                              )
     self.assertResourceCalled('File', '/etc/ganglia/gmetad.conf',
         owner = 'root',
         group = 'hadoop',

+ 3 - 2
ambari-server/src/test/python/stacks/1.3.2/configs/default.json

@@ -157,8 +157,9 @@
             "proxyuser_group": "users", 
             "zk_user": "zookeeper", 
             "namenode_formatted_mark_dir": "/var/run/hadoop/hdfs/namenode/formatted/", 
-            "rrdcached_base_dir": "/var/lib/ganglia/rrds", 
-            "syncLimit": "5", 
+            "rrdcached_base_dir": "/var/lib/ganglia/rrds",
+            "ganglia_web_path": "/var/www/html/ganglia",
+            "syncLimit": "5",
             "oozie_pid_dir": "/var/run/oozie", 
             "hbase_regionserver_heapsize": "1024m", 
             "dtnode_heapsize": "1024m", 

+ 3 - 2
ambari-server/src/test/python/stacks/1.3.2/configs/secured.json

@@ -201,8 +201,9 @@
             "hadoop_heapsize": "1024", 
             "hbase_regionserver_primary_name": "hbase", 
             "zk_user": "zookeeper", 
-            "rrdcached_base_dir": "/var/lib/ganglia/rrds", 
-            "keytab_path": "/etc/security/keytabs", 
+            "rrdcached_base_dir": "/var/lib/ganglia/rrds",
+            "ganglia_web_path": "/var/www/html/ganglia",
+            "keytab_path": "/etc/security/keytabs",
             "hive_pid_dir": "/var/run/hive", 
             "webhcat_server": "c6402.ambari.apache.org", 
             "zk_data_dir": "/hadoop/zookeeper", 

+ 7 - 3
ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_server.py

@@ -158,11 +158,11 @@ class TestGangliaServer(RMFTestCase):
            '/bin',
            '/usr/bin'],
     )
-    self.assertResourceCalled('Directory', '/var/lib/ganglia/dwoo',
-        owner = 'nobody',
+    self.assertResourceCalled('Directory', '/var/lib/ganglia-web/dwoo',
         recursive = True,
-        mode = 0777,
+        mode = 0755,
     )
+    self.assertResourceCalled('Execute', 'chown -R wwwrun /var/lib/ganglia-web/dwoo',)
     self.assertResourceCalled('Directory', '/srv/www/cgi-bin',
         recursive = True,
     )
@@ -177,6 +177,10 @@ class TestGangliaServer(RMFTestCase):
                               recursive = True,
                               mode = 0755,
                               )
+    self.assertResourceCalled('File', '/etc/apache2/conf.d/ganglia.conf',
+                              content = Template('ganglia.conf.j2'),
+                              mode = 0644,
+                              )
     self.assertResourceCalled('File', '/etc/ganglia/gmetad.conf',
         owner = 'root',
         group = 'hadoop',

+ 2 - 1
ambari-server/src/test/python/stacks/2.0.6/configs/default.json

@@ -218,7 +218,8 @@
             "hbase_pid_dir": "/var/run/hbase", 
             "proxyuser_group": "users", 
             "zk_user": "zookeeper", 
-            "rrdcached_base_dir": "/var/lib/ganglia/rrds", 
+            "rrdcached_base_dir": "/var/lib/ganglia/rrds",
+            "ganglia_web_path": "/var/www/html/ganglia",
             "syncLimit": "5", 
             "storm_pid_dir": "/var/run/storm", 
             "oozie_pid_dir": "/var/run/oozie", 

+ 3 - 2
ambari-server/src/test/python/stacks/2.0.6/configs/secured.json

@@ -268,8 +268,9 @@
             "hadoop_heapsize": "1024", 
             "hbase_regionserver_primary_name": "hbase", 
             "zk_user": "zookeeper", 
-            "rrdcached_base_dir": "/var/lib/ganglia/rrds", 
-            "jobhistory_keytab": "/etc/security/keytabs/jhs.service.keytab", 
+            "rrdcached_base_dir": "/var/lib/ganglia/rrds",
+            "ganglia_web_path": "/var/www/html/ganglia",
+            "jobhistory_keytab": "/etc/security/keytabs/jhs.service.keytab",
             "hive_pid_dir": "/var/run/hive", 
             "webhcat_server": "c6402.ambari.apache.org", 
             "zk_data_dir": "/hadoop/zookeeper",