Explorar o código

AMBARI-1466. Optimize ganglia rrd script to be able to respond within reasonable time to queries made by the UI. (mahadev)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1448909 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar %!s(int64=12) %!d(string=hai) anos
pai
achega
112517d675
Modificáronse 2 ficheiros con 19 adicións e 4 borrados
  1. 3 0
      CHANGES.txt
  2. 16 4
      ambari-agent/src/main/puppet/modules/hdp-ganglia/files/rrd.py

+ 3 - 0
CHANGES.txt

@@ -324,6 +324,9 @@ Trunk (unreleased changes):
  AMBARI-1465. Minimize Read and Write locks for createHosts. (Siddharth Wagle
  AMBARI-1465. Minimize Read and Write locks for createHosts. (Siddharth Wagle
  via mahadev)
  via mahadev)
 
 
+ AMBARI-1466. Optimize ganglia rrd script to be able to respond within
+ reasonable time to queries made by the UI. (mahadev)
+
  BUG FIXES
  BUG FIXES
 
 
  AMBARI-1455. Setting App.testMode=true, alwaysGoToInstaller=true does not
  AMBARI-1455. Setting App.testMode=true, alwaysGoToInstaller=true does not

+ 16 - 4
ambari-agent/src/main/puppet/modules/hdp-ganglia/files/rrd.py

@@ -139,6 +139,14 @@ if "pt" in queryString:
 else:
 else:
   pointInTime = False
   pointInTime = False
 
 
+
+host_metrics = ["boottime", "bytes_in", "bytes_out", "cpu_aidle", "cpu_idle",
+                "cpu_nice", "cpu_num", "cpu_speed", "cpu_system", "cpu_user",
+                "cpu_wio", "disk_free", "disk_total", "load_fifteen", "load_five",
+                "load_one", "mem_buffers", "mem_cached", "mem_free", "mem_shared",
+                "mem_total", "part_max_used", "pkts_in", "pkts_out", "proc_run",
+                "proc_total", "swap_free", "swap_total"]
+
 for cluster in clusterParts:
 for cluster in clusterParts:
   for path, dirs, files in os.walk(rrdPath + cluster):
   for path, dirs, files in os.walk(rrdPath + cluster):
     pathParts = path.split("/")
     pathParts = path.split("/")
@@ -146,10 +154,14 @@ for cluster in clusterParts:
       for file in files:
       for file in files:
         for metric in metricParts:
         for metric in metricParts:
           if file.endswith(metric + ".rrd"):
           if file.endswith(metric + ".rrd"):
-
-            printMetric(pathParts[-2], pathParts[-1], file[:-4],
-                os.path.join(path, file), cf, start, end, resolution, pointInTime)
-
+            if not (metric in host_metrics):
+              printMetric(pathParts[-2], pathParts[-1], file[:-4],
+                    os.path.join(path, file), cf, start, end, resolution, pointInTime)
+            else:
+              if (cluster == "HDPSlaves"):
+                 printMetric(pathParts[-2], pathParts[-1], file[:-4],
+                    os.path.join(path, file), cf, start, end, resolution, pointInTime)
+                
 sys.stdout.write("[AMBARI_END]\n")
 sys.stdout.write("[AMBARI_END]\n")
 # write end time
 # write end time
 sys.stdout.write(str(time.mktime(time.gmtime())))
 sys.stdout.write(str(time.mktime(time.gmtime())))