cleanCommand = '' if (commAndPath.find('/') == -1) or (commAndPath[0] == '['): cleanCommand = commAndPath else: res2 = re.search('(.*/)([^/]+)',commAndPath) if (res2): cleanCommand = res2.group(2) else: continue if hostOSH == None: hostOSH = modeling.createOshByCmdbIdString('host', hostId) if packageToCmdLine != None and commAndPath: logger.debug('getting package name for ', commAndPath) pkgName = file_ver_lib.getLinuxPackageName(client, commAndPath) if pkgName: packageToCmdLine[pkgName] = commAndPath commandLine = cleanCommand + ' ' + cleanArgs addProcess(pdu, hostId, cleanCommand, pid, commandLine, commAndPath, cleanArgs, processList, discoverProcesses, myVec, hostOSH, startuptime, owner) else: logger.debug("Process line '%s' does not match the pattern, ignoring" % line) pdu.flushHostProcesses(hostId) if pid2Process is not None: pid2Process.putAll(pdu.getProcessCmdMap()) finally: if pdu != None:
def getPackageNameByProcess(self, process): if process and process.executablePath: return file_ver_lib.getLinuxPackageName(self._getShell(), process.executablePath)