def CheckSSDPerf(self):
     """
     function: check SSD performance
     input : NA
     output: NA
     """
     diskDevList = []
     # Obtain the SSD device
     devList = DefaultValue.obtainSSDDevice()
     # traverse dev
     for dev in devList:
         cmd = "df -P -h | grep %s | awk '{print $6}'" % dev
         (status, output) = subprocess.getstatusoutput(cmd)
         if (status == 0):
             if (output == ""):
                 continue
             diskDirInfo = output.split('\n')
             for diskDir in diskDirInfo:
                 diskDevList.append("%s:%s" % (dev, diskDir))
     # check if SSD disk exists on current node
     if diskDevList == []:
         raise Exception(ErrorCode.GAUSS_530["GAUSS_53005"])
     # Concurrent execution
     pool = ThreadPool(DefaultValue.getCpuSet())
     results = pool.map(self.CheckSingleSSDPerf, diskDevList)
     pool.close()
     pool.join()
Пример #2
0
    def checkSysTable(self):
        primaryDNidList = []
        nodeInfo = self.cluster.getDbNodeByName(self.host)
        CN = nodeInfo.coordinators
        masterDnList = SharedFuncs.getMasterDnNum(self.user, self.mpprcFile)
        for DnInstance in nodeInfo.datanodes:
            if (DnInstance.instanceId in masterDnList):
                primaryDNidList.append(DnInstance)
        if (len(CN) < 1 and len(primaryDNidList) < 1):
            raise CheckNAException(
                "There is no primary database node instance in the "
                "current node.")

        # test database Connection
        for Instance in (CN + primaryDNidList):
            if not Instance:
                continue
            sqlcmd = "select pg_sleep(1);"
            SharedFuncs.runSqlCmd(sqlcmd, self.user, "", Instance.port,
                                  self.tmpPath, self.database, self.mpprcFile)
        outputList = []
        pool = ThreadPool(DefaultValue.getCpuSet())
        results = pool.map(self.checkSingleSysTable, CN + primaryDNidList)
        pool.close()
        pool.join()
        for result in results:
            if (result):
                outputList.append(result)
        outputList.sort()
        return outputList
Пример #3
0
 def checkHostnameMapping(clusterInfo, logFile):
     """
     function: check host name mapping
     input: NA
     output: NA 
     """
     nodes = clusterInfo.getClusterNodeNames()
     if (len(nodes) > 0):
         try:
             pool = ThreadPool(DefaultValue.getCpuSet())
             results = pool.map(OMCommand.checkHostname, nodes)
             pool.close()
             pool.join()
         except Exception as e:
             raise Exception(str(e))
    def doCheck(self):
        outputList = []
        failList = []
        pathList = []
        if (self.cluster):
            paths = self.obtainDataDir(self.cluster.getDbNodeByName(self.host))
        else:
            raise Exception(ErrorCode.GAUSS_530["GAUSS_53013"] % "cluster")
        for path in paths:
            if (path):
                pathList.append(path)
        pool = ThreadPool(DefaultValue.getCpuSet())
        results = pool.map(self.checkLargeFile, pathList)
        pool.close()
        pool.join()

        for outlist, flist in results:
            if (outlist):
                outputList.extend(outlist)
            if (flist):
                failList.extend(flist)

        if (len(outputList) == 0 and len(failList) == 0):
            self.result.rst = ResultStatus.OK
            self.result.val = "No file more than %s" % self.Threshold_SIZE
        else:
            if (len(outputList) > 0):
                self.result.val = "Files more than %s:\n%s" % (
                    self.Threshold_SIZE, "\n".join(outputList))
                if (len(failList) > 0):
                    self.result.val = "Files more than %s:\n%s\n%s" % (
                        self.Threshold_SIZE, "\n".join(outputList),
                        "\n".join(failList))
            else:
                self.result.val = "%s" % ("\n".join(failList))
            self.result.rst = ResultStatus.NG
Пример #5
0
 def checkSpecialChar(self):
     outputList = []
     failList = []
     pathList = []
     paths = self.getDiskPath()
     for path in paths:
         if (not path or not os.path.isdir(path)):
             continue
         else:
             pathList.append(path)
     pool = ThreadPool(DefaultValue.getCpuSet())
     results = pool.map(self.checkSingleSpecialChar, pathList)
     pool.close()
     pool.join()
     for outlist, flist in results:
         if (outlist):
             outputList.extend(outlist)
         if (flist):
             failList.extend(flist)
     if (len(outputList) > 0):
         outputList = DefaultValue.Deduplication(outputList)
     if (failList):
         failList = DefaultValue.Deduplication(failList)
     return outputList, failList