refactor:修改dign_client容器中引用的配置文件和日志文件路径错误问题

This commit is contained in:
fumingwei
2021-09-02 12:24:51 +08:00
parent 6c7df0ee2c
commit 47575d9020
3 changed files with 8 additions and 8 deletions

View File

@@ -64,7 +64,7 @@ services:
ipv4_address: 192.51.100.4
volumes:
- /opt/tsg/tsg-diagnose/.badssl_cert_dict:/root/cafile_dict
- /opt/tsg/tsg-diagnose/result:/root/result_tsg_diagnose
- /opt/tsg/tsg-diagnose/log:/opt/dign_client/log
- /opt/tsg/tsg-diagnose/etc:/root/etc_tsg_diagnose
- /etc/localtime:/etc/localtime:ro
command:
@@ -77,13 +77,13 @@ services:
arp -i eth0 -s 192.0.2.130 02:42:c0:a8:fd:82
arp -i eth0 -s 192.0.2.131 02:42:C0:A8:FD:83
arp -i eth0 -s 192.0.2.135 02:42:C0:A8:FD:85
mkdir -p /root/result_tsg_diagnose/dign_client
mkdir -p /root/result_tsg_diagnose/conn_traffic_status
mkdir -p /opt/dign_client/log/dign_client
mkdir -p /opt/dign_client/log/conn_traffic_status
cp -rf /root/cafile_dict/certs/sets/current/gen/crt/ca-root.crt /usr/local/share/ca-certificates
update-ca-certificates
cat /opt/dign_client/etc/hosts >> /etc/hosts
echo '0 2 * * * /usr/local/bin/python /opt/dign_client/clear_file_timeout.py' > /etc/crontabs/root
echo '0 2 * * * /usr/local/bin/python /opt/dign_client/clear_file_timeout.py -d /root/result_tsg_diagnose/conn_traffic_status' > /etc/crontabs/root
echo '0 2 * * * /usr/local/bin/python /opt/dign_client/clear_file_timeout.py -d /opt/dign_client/log/conn_traffic_status' > /etc/crontabs/root
crond
python /opt/dign_client/tsg_diagnose.py -l -w NEZHA
tail -f /dev/null

View File

@@ -7,7 +7,7 @@ import argparse
def get_suite_option():
parser = argparse.ArgumentParser(description="Tsg diagnose Tools - clear tsg diagnose result file", epilog = "Example:help")
parser.add_argument('-t','--timeout', type = int, default = 604800,help='Specify the time to delete files that are not accessed in seconds ,the default is 604800 (7 days)')
parser.add_argument('-d','--dictpath', type = str, default = '/root/result_tsg_diagnose/dign_client', help='Specify the folder to delete files, the default is /root/result_tsg_diagnose/dign_client')
parser.add_argument('-d','--dictpath', type = str, default = '/opt/dign_client/log/dign_client', help='Specify the folder to delete files, the default is /opt/dign_client/log/dign_client')
args = parser.parse_args()
return args

View File

@@ -622,7 +622,7 @@ class SSLFileDownloadBuild:
self.client.metric(nzname, nzdict)
def _write_in_logfile(self, sizeStr, connInfoDict):
logNewestPath = "/root/result_tsg_diagnose/conn_traffic_status/conn_traffic_status_" + sizeStr
logNewestPath = "/opt/dign_client/log/conn_traffic_status/conn_traffic_status_" + sizeStr
logPath = logNewestPath + time.strftime("%Y-%m-%d_%H-%M-%S", time.localtime())
connInfoStr = json.dumps(connInfoDict)
with open(logNewestPath,"w+") as f:
@@ -981,7 +981,7 @@ class TsgDiagnoseRun:
parser.add_argument('-c','--count', type = int, default = 1, help='Specifies the count of tsg diagnoses ,range:1-65535')
parser.add_argument('-f','--format', type = str, default = 'txt',help='Specifies the result output format of the tsg diagnose. There two formats: jsontxt, the default is txt.')
parser.add_argument('-w','--write', type = str, default = None,help='Write out result into file or NEZHA. Specifies the output file name or NEZHA.')
parser.add_argument('-p','--configpath', type = str, default = '/root/etc_tsg_diagnose/client.conf',help='Specifies the config file, default /root/etc_tsg_diagnose/client.conf')
parser.add_argument('-p','--configpath', type = str, default = '/opt/dign_client/etc/client.conf',help='Specifies the config file, default /opt/dign_client/etc/client.conf')
parser.add_argument('-l','--loop', action='store_true', default = False, help='Tsg diagnose loop, exit when recv a signal')
args = parser.parse_args()
self.interval = args.interval
@@ -1065,7 +1065,7 @@ class TsgDiagnoseRun:
self._add_suite('test_ssl_firewall_deny_rst')
def _write_suite_result_into_file(self):
resultDict = '/root/result_tsg_diagnose/unittest/'
resultDict = '/opt/dign_client/log/unittest/'
resultNewestPath = resultDict + self.write
resultPath = resultDict + self.write + "." + time.strftime("%Y-%m-%d_%H-%M-%S", time.localtime())
if self.format == 'txt':