sysom1/sysom_server/sysom_diagnosis/service_scripts/ossre

35 lines
1002 B
Python
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/python3
# coding=utf-8
import json
import sys
###############################################################################
## {
## "service_name":"ossre",
## "instance":"192.168.1.101"
## }
## 解析参数方法:
## sysak ossre_client -d > /dev/null 2>&1 && cat /var/log/sysak/ossre.log
## sysak ossre_client -d > /dev/null 2>&1 实际ossre执行系统诊断命令隐藏控制台输出
## cat /var/log/sysak/ossre.log 是ossre诊断结果json格式
##
###############################################################################
class Param(dict):
def __missing__(self,key):
sys.stderr.write("入参检查失败,没有检查到入参'%s'"%key)
exit(1)
args = Param(json.loads(sys.argv[1]))
result = {}
result['commands'] = []
cmd0 = {}
cmd0['instance'] = args["instance"]
cmd0['cmd'] = "sysak ossre_client -d > /dev/null " + " && " + "cat /var/log/sysak/ossre.log"
result['commands'].append(cmd0)
data = json.dumps(result)
print(data)