コード例 #1
0
ファイル: collect.py プロジェクト: 007shenglong/MyHadoop
 def collectMetrics(self):
     #获取当前集群的状态
     metrics = self.getMetrics()
     meRecord =  metricsRecord(self.recordTime);
     recordKey=["appsCompleted","appsPending","appsRunning",
                "appsFailed","appsKilled","totalMB","allocatedMB",
                "containersAllocated","containersReserved",
                "containersPending","totalNodes","activeNodes"]
     print metrics
     for key in recordKey:
         print metrics['clusterMetrics'][key]
         meRecord.set(key,metrics['clusterMetrics'][key])
     session = database.getSession()
     session.merge(meRecord)
     session.commit()
コード例 #2
0
 def collectMetrics(self):
     #获取当前集群的状态
     metrics = self.getMetrics()
     meRecord = metricsRecord(self.recordTime)
     recordKey = [
         "appsCompleted", "appsPending", "appsRunning", "appsFailed",
         "appsKilled", "totalMB", "allocatedMB", "containersAllocated",
         "containersReserved", "containersPending", "totalNodes",
         "activeNodes"
     ]
     print metrics
     for key in recordKey:
         print metrics['clusterMetrics'][key]
         meRecord.set(key, metrics['clusterMetrics'][key])
     session = database.getSession()
     session.merge(meRecord)
     session.commit()
コード例 #3
0
 def collectMetrics(self):
     #获取当前集群的状态
     metrics = self.getMetrics()
     #recordTime指向上个10分钟的开头时间,所以要往后移动一个10分钟
     meRecord = metricsRecord(self.recordTime + config.collect_interval)
     recordKey = [
         "appsCompleted", "appsPending", "appsRunning", "appsFailed",
         "appsKilled", "totalMB", "availableMB", "allocatedMB",
         "containersAllocated", "totalNodes", "activeNodes"
     ]
     #totalMB=availableMB+allocatedMB
     temp = metrics['clusterMetrics']
     temp["totalMB"] = int(temp["availableMB"]) + int(temp["allocatedMB"])
     for key in recordKey:
         meRecord.set(key, temp[key])
     session = database.getSession()
     session.merge(meRecord)
     session.commit()
コード例 #4
0
ファイル: collect.py プロジェクト: haiyang1987/yarn_monitor
 def collectMetrics(self):
     #获取当前集群的状态
     metrics = self.getMetrics()
     #recordTime指向上个10分钟的开头时间,所以要往后移动一个10分钟
     meRecord =  metricsRecord(self.recordTime+config.collect_interval);
     recordKey=["appsCompleted","appsPending","appsRunning",
                "appsFailed","appsKilled",
                "totalMB","availableMB",
                "allocatedMB","containersAllocated",
                "totalNodes","activeNodes"]
     #totalMB=availableMB+allocatedMB
     temp = metrics['clusterMetrics'];
     temp["totalMB"] = int(temp["availableMB"]) + int (temp["allocatedMB"])
     for key in recordKey:
         meRecord.set(key,temp[key])
     session = database.getSession()
     session.merge(meRecord)
     session.commit()