schedmoni: remove unused codes and fix a bug

1 remove the check code: '0' == '0'
2 '-p' change to '-t' , for threads monitor

Signed-off-by: Hailong Liu <liuhailong@linux.alibaba.com>
This commit is contained in:
Hailong Liu 2022-03-17 14:33:55 +08:00
parent 429ce11a2d
commit 4b25f45a20
1 changed files with 4 additions and 7 deletions

View File

@ -15,10 +15,10 @@ import time
## }
## '{"实例IP":"192.168.1.101", "诊断时长":10, "采样阈值":10000, "诊断线程":10002}'
## 解析参数方法:
## sysak schedmoni 10000 -s 10 -p 10002
## sysak schedmoni 10000 -s 10 -t 10002
## 10000 时间阈值, 捕获延迟10000 us的事件
## -s 10 诊断时间10秒
## -p 10002 针对现场10002进行监控
## -t 10002 针对现场10002进行监控
##
######################################################################
args = json.loads(sys.argv[1], encoding="UTF-8")
@ -33,15 +33,12 @@ if arg_time:
arg_thresh = args["采样阈值"]
arg_tid = args["诊断线程"]
if arg_tid:
arg_tid = '-p ' + str(arg_tid)
arg_tid = '-t ' + str(arg_tid)
check_result_cmd = "0"
dump_log_cmd = "cat /var/log/sysak/schedmoni/runslow.log;\
echo \"\";cat /var/log/sysak/schedmoni/nosched.log;"
schedmoni_cmd = "sysak schedmoni "+str(arg_tid)+" "+str(arg_thresh)+" "+str(arg_time)+" 2>/dev/null"
print_result_cmd = "if [ "+check_result_cmd+" = \"0\" ]; then "+\
dump_log_cmd+"else echo \"fail\"; fi"
cmd0['cmd'] = schedmoni_cmd+" && "+print_result_cmd
cmd0['cmd'] = schedmoni_cmd+" && "+dump_log_cmd
result['commands'].append(cmd0)