diff --git a/requirements.txt b/requirements.txt index dcde8d694..16705651f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -60,7 +60,7 @@ mistune==0.8.4 django-versionlog==1.6.0 # 腾讯云SDK -tencentcloud-sdk-python==3.0.151 +tencentcloud-sdk-python==3.0.1210 # Iam SDK bk-iam==1.1.14 diff --git a/script_tools/agent_tools/agent2/setup_agent.sh b/script_tools/agent_tools/agent2/setup_agent.sh index b5dab148c..88c0e9de0 100755 --- a/script_tools/agent_tools/agent2/setup_agent.sh +++ b/script_tools/agent_tools/agent2/setup_agent.sh @@ -210,9 +210,9 @@ get_pid_by_comm_path () { local _pids pids local pid if [[ "${worker}" == "WORKER" ]]; then - read -r -a _pids <<< "$(ps --no-header -C $comm -o '%P|%p|%a' | awk -F'|' '$1 != 1 && $3 ~ /gse_agent/' | awk -F'|' '{print $2}' | xargs)" + read -r -a _pids <<< "$(ps --no-header -C $comm -o 'ppid,pid,args' | awk '$1 != 1 && $3 ~ /gse_agent/ {print $2}' | xargs)" elif [[ "${worker}" == "MASTER" ]]; then - read -r -a _pids <<< "$(ps --no-header -C $comm -o '%P|%p|%a' | awk -F'|' '$1 == 1 && $3 ~ /gse_agent/' | awk -F'|' '{print $2}' | xargs)" + read -r -a _pids <<< "$(ps --no-header -C $comm -o 'ppid,pid,args' | awk '$1 == 1 && $3 ~ /gse_agent/ {print $2}' | xargs)" else read -r -a _pids <<< "$(ps --no-header -C "$comm" -o pid | xargs)" fi diff --git a/script_tools/gsectl/agent/linux/gsectl b/script_tools/gsectl/agent/linux/gsectl index a43d95ac1..8d9ca1b60 100755 --- a/script_tools/gsectl/agent/linux/gsectl +++ b/script_tools/gsectl/agent/linux/gsectl @@ -629,7 +629,7 @@ get_process_runtime (){ for i in {1..20} do - tmp_gse_master_pid_info=$(ps --no-header -C gse_agent -o '%P' -o '|%p' -o '|%a' | awk -F'|' '$1 == 1 && $3 ~ /gse_agent/' | awk -F'|' '{print $2}' | xargs) + tmp_gse_master_pid_info=$(ps --no-header -C gse_agent -o 'ppid,pid,args' | awk '$1 == 1 && $3 ~ /gse_agent/ {print $2}' | xargs) read -r -a tmp_gse_agent_master_pids <<< "$tmp_gse_master_pid_info" for _pid in "${tmp_gse_agent_master_pids[@]}"; do @@ -666,7 +666,7 @@ __status (){ # 最多等待20s来判断是否真正启动成功 for i in {0..20}; do if [ "$action" == "stop" ];then - if [ $(ps --no-header -C gse_${module} -o '%P' -o '|%p' -o '|%a' |egrep "${WORK_HOME}" |wc -l) -eq 0 ];then + if [ $(ps --no-header -C gse_${module} -o 'ppid,pid,args' |egrep "${WORK_HOME}" |wc -l) -eq 0 ];then echo gse_${module} $action $action success break elif [ $i -eq 20 ];then @@ -732,7 +732,7 @@ _status () { # 初筛,考虑到gse组件的父、子进程都是名为gse_agent的,且它的父进程应该是等于1 # ps的-o参数指定输出字段%P(ppid)、%p(pid)、%a(args) # 所以下面命令是拉出所有进程名为gse_agent,且父进程为1,进程参数包含gse_agent的进程信息 - gse_master_pid_info=$(ps --no-header -C gse_agent -o '%P' -o '|%p' -o '|%a' | awk -F'|' '$1 == 1 && $3 ~ /gse_agent/' | awk -F'|' '{print $2}' | xargs) + gse_master_pid_info=$(ps --no-header -C gse_agent -o 'ppid,pid,args' | awk '$1 == 1 && $3 ~ /gse_agent/ {print $2}' | xargs) read -r -a gse_agent_master_pids <<< "$gse_master_pid_info" if [[ -z "$gse_agent_master_pids" ]]; then