コード例 #1
0
    def javaProcs(self, list):
        try:
            from ambari_commons.os_windows import run_powershell_script

            code, out, err = run_powershell_script(self.GET_JAVA_PROC_CMD)
            if code == 0:
                splitted_output = out.split(os.linesep)
                for i in [
                        index for index in range(0, len(splitted_output))
                        if (index % 3) == 0
                ]:
                    pid = splitted_output[i]
                    cmd = splitted_output[i + 1]
                    user = splitted_output[i + 2]
                    if not 'AmbariServer' in cmd:
                        if 'java' in cmd:
                            dict = {}
                            dict['pid'] = int(pid)
                            dict['hadoop'] = False
                            for filter in self.PROC_FILTER:
                                if filter in cmd:
                                    dict['hadoop'] = True
                            dict['command'] = cmd.strip()
                            dict['user'] = user
                            list.append(dict)
        except Exception as e:
            pass
        pass
コード例 #2
0
ファイル: HostInfo.py プロジェクト: fanzhidongyzby/ambari
  def javaProcs(self, list):
    try:
      from ambari_commons.os_windows import run_powershell_script

      code, out, err = run_powershell_script(self.GET_JAVA_PROC_CMD)
      if code == 0:
        splitted_output = out.split(os.linesep)
        for i in [index for index in range(0, len(splitted_output)) if (index % 3) == 0]:
          pid = splitted_output[i]
          cmd = splitted_output[i + 1]
          user = splitted_output[i + 2]
          if not 'AmbariServer' in cmd:
            if 'java' in cmd:
              dict = {}
              dict['pid'] = int(pid)
              dict['hadoop'] = False
              for filter in self.PROC_FILTER:
                if filter in cmd:
                  dict['hadoop'] = True
              dict['command'] = cmd.strip()
              dict['user'] = user
              list.append(dict)
    except Exception as e:
      pass
    pass
コード例 #3
0
  def run_command(self):
    from ambari_commons.os_windows import run_powershell_script, CHECK_FIREWALL_SCRIPT

    retcode, out, err = run_powershell_script(CHECK_FIREWALL_SCRIPT)
    self.returncode = retcode
    self.stdoutdata = out
    self.stderrdata = err
コード例 #4
0
ファイル: firewall.py プロジェクト: fanzhidongyzby/ambari
    def run_command(self):
        from ambari_commons.os_windows import run_powershell_script, CHECK_FIREWALL_SCRIPT

        retcode, out, err = run_powershell_script(CHECK_FIREWALL_SCRIPT)
        self.returncode = retcode
        self.stdoutdata = out
        self.stderrdata = err
コード例 #5
0
ファイル: HostInfo.py プロジェクト: fanzhidongyzby/ambari
  def checkIptables(self):
    from ambari_commons.os_windows import run_powershell_script, CHECK_FIREWALL_SCRIPT

    out = run_powershell_script(CHECK_FIREWALL_SCRIPT)
    if out[0] != 0:
      logger.warn("Unable to check firewall status:{0}".format(out[2]))
      return False
    profiles_status = [i for i in out[1].split("\n") if not i == ""]
    if "1" in profiles_status:
      return True
    return False
コード例 #6
0
  def checkIptables(self):
    from ambari_commons.os_windows import run_powershell_script, CHECK_FIREWALL_SCRIPT

    out = run_powershell_script(CHECK_FIREWALL_SCRIPT)
    if out[0] != 0:
      logger.warn("Unable to check firewall status:{0}".format(out[2]))
      return False
    profiles_status = [i for i in out[1].split("\n") if not i == ""]
    if "1" in profiles_status:
      return True
    return False
コード例 #7
0
ファイル: firewall.py プロジェクト: Liujinan001/ambari-2.7.5
  def run_command(self):
    from ambari_commons.os_windows import run_powershell_script, CHECK_FIREWALL_SCRIPT, WinServiceController, SERVICE_STATUS_RUNNING

    if WinServiceController.QueryStatus(self.FIREWALL_SERVICE_NAME) != SERVICE_STATUS_RUNNING:
      self.returncode = 0
      self.stdoutdata = ""
      self.stderrdata = ""
    else:
      retcode, out, err = run_powershell_script(CHECK_FIREWALL_SCRIPT)
      self.returncode = retcode
      self.stdoutdata = out
      self.stderrdata = err
コード例 #8
0
  def run_command(self):
    from ambari_commons.os_windows import run_powershell_script, CHECK_FIREWALL_SCRIPT, WinServiceController, SERVICE_STATUS_RUNNING

    if WinServiceController.QueryStatus(self.FIREWALL_SERVICE_NAME) != SERVICE_STATUS_RUNNING:
      self.returncode = 0
      self.stdoutdata = ""
      self.stderrdata = ""
    else:
      retcode, out, err = run_powershell_script(CHECK_FIREWALL_SCRIPT)
      self.returncode = retcode
      self.stdoutdata = out
      self.stderrdata = err
コード例 #9
0
ファイル: HostInfo.py プロジェクト: fanzhidongyzby/ambari
 def getServiceStatus(self, serivce_name):
   from ambari_commons.os_windows import run_powershell_script
   code, out, err = run_powershell_script(self.SERVICE_STATUS_CMD.format(serivce_name))
   return out, err, code
コード例 #10
0
 def getServiceStatus(self, serivce_name):
     from ambari_commons.os_windows import run_powershell_script
     code, out, err = run_powershell_script(
         self.SERVICE_STATUS_CMD.format(serivce_name))
     return out, err, code