提交 d85e48df authored 作者: 陈泽健's avatar 陈泽健

补充get_remote_log_with_paramiko函数来获取服务器的日志文件。补充config.json的统一平台测试环境。

上级 0e883139
......@@ -5,5 +5,6 @@
"展厅统一平台巡检": "http://192.168.5.200:38083/#/login",
"展厅讯飞系统巡检": "http://192.168.5.201:8080/#/login",
"长安大学预定测试环境": "https://192.168.5.186/#/login/logindf",
"工商银行项目生产环境": "https://192.168.52.62:20443/#/login/logindf"
"工商银行项目生产环境": "https://192.168.52.62:20443/#/login/logindf",
"统一平台测试环境": "http://192.168.5.164:38083/#/login"
}
\ No newline at end of file
......@@ -395,7 +395,7 @@ class Mqtt:
"startTime": config['startTime'],
"endTime": config['endTime'],
"companyNumber": config['companyNumber'],
"participantList": ["JiaoJiao", "JiaYu", "DuiFangZhengZaiZhangTouFa", "DuoTangMaLaBan", "DaLi", "500mlLingDu", "tt.", "wilbur", "q", "Test40", "Test41", "Test42", "Test43", "Test44", "Test45", "Test46", "Test47", "Test48", "Test49",
"participantList": ["JiaoJiao", "Test40", "Test41", "Test42", "Test43", "Test44", "Test45", "Test46", "Test47", "Test48", "Test49",
"Test50", "Test51", "Test52", "Test53", "Test54", "Test55", "Test56", "Test57", "Test58", "Test59",
"Test60", "Test61", "Test62", "Test63", "Test64", "Test65", "Test66", "Test67", "Test68", "Test69",
"Test70", "Test71", "Test72", "Test73", "Test74", "Test75", "Test76", "Test77", "Test78", "Test79",
......
No preview for this file type
No preview for this file type
......@@ -1925,4 +1925,60 @@ def write_xlsx_data(xlsx_file_path, sheet_name, function_number, test_result, lo
# logging.error(f"保存文件时出错: {e}")
# raise
# finally:
# wb.close()
\ No newline at end of file
# wb.close()
import paramiko
import time
def get_remote_log_with_paramiko(host, username, private_key_path, passphrase, log_path, num_lines=100, timeout=30):
"""
使用 Paramiko 获取远程服务器的日志文件内容.
Args:
host (str): 服务器 IP 地址或域名.
username (str): 用户名.
private_key_path (str): SSH 私钥文件路径.
passphrase (str): 私钥文件的 passphrase.
log_path (str): 日志文件路径.
num_lines (int): 要获取的日志行数 (默认 100).
timeout (int): SSH 命令执行的超时时间(秒).
Returns:
str: 获取的日志内容,如果出错返回 None.
"""
try:
private_key = paramiko.RSAKey.from_private_key_file(private_key_path, password=passphrase)
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(host, username=username, pkey=private_key, timeout=timeout)
command = f"tail -n {num_lines} {log_path}"
print(f"Executing command: {command}")
stdin, stdout, stderr = client.exec_command(command, timeout=timeout)
error = stderr.read().decode('utf-8')
if error:
print(f"Error: {error}")
return None
output = stdout.read().decode('utf-8')
print("Successfully retrieved log content.")
return output
except Exception as e:
print(f"An error occurred: {e}")
return None
finally:
client.close()
if __name__ == "__main__":
host = "192.168.5.218"
username = "root"
private_key_path = "C:\\Users\\29194\\.ssh\\id_rsa" # 替换为你的私钥文件路径
passphrase = "Ubains@123" # 替换为你的 passphrase
log_path = "/var/www/java/api-java-meeting2.0/logs/ubains-INFO-AND-ERROR.log"
log_content = get_remote_log_with_paramiko(host, username, private_key_path, passphrase, log_path)
if log_content:
print(log_content)
else:
print("Failed to retrieve log content.")
\ No newline at end of file
......@@ -280,4 +280,6 @@
76. 2025-04-08
- 缩短元素等待时间,调整展厅巡检视讯会议的会控按钮判断。增加议题文件上传未完成时点击【确定】弹出的确认框补充点击确认操作。
77. 2025-04-09
- 优化read_xlsx_data用例文件读取函数,增加功能类别判断,实现标准版和各项目的区分执行。补充工商银行项目的车牌功能验证。config.json文件增加工商银行生产环境。
\ No newline at end of file
- 优化read_xlsx_data用例文件读取函数,增加功能类别判断,实现标准版和各项目的区分执行。补充工商银行项目的车牌功能验证。config.json文件增加工商银行生产环境。
78. 2025-04-11
- 补充get_remote_log_with_paramiko函数来获取服务器的日志文件。补充config.json的统一平台测试环境。
\ No newline at end of file
......@@ -46,7 +46,7 @@ class AIMeeting:
expented_result = step.get('expented_result')
# 判断页面功能类型
if page_type == "AIMeeting":
if page_type == "CreateMeeting":
if element_type == "input":
# 查询会议
safe_send_keys((locator_type, locator_value), element_value, wd)
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -5,22 +5,22 @@ from 预定系统.Base.base import *
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建会议预约CSV文件的绝对路径
# csv_file_path = os.path.join(current_dir, '../../../测试数据/MQTT模块/富创项目/富创项目_会议预约推送.csv')
csv_file_path = os.path.join(current_dir, '../../../测试数据/MQTT模块/富创项目/富创项目_会议预约推送.csv')
# 构建会议修改CSV文件的绝对路径
# csv_file_path = os.path.join(current_dir, '../../../测试数据/MQTT模块/富创项目/富创项目_会议修改推送.csv')
# # 构建会议删除CSV文件的绝对路径
# csv_file_path = os.path.join(current_dir, '../../../测试数据/MQTT模块/富创项目/富创项目_会议删除推送.csv')
# 底图更新的CSV文件路径
csv_file_path = os.path.join(current_dir, '../../../测试数据/MQTT模块/富创项目/富创项目_门口屏底图更新.csv')
# csv_file_path = os.path.join(current_dir, '../../../测试数据/MQTT模块/富创项目/富创项目_门口屏底图更新.csv')
if __name__ == "__main__":
# 读取配置文件
configs = Mqtt.read_config_from_csv(csv_file_path)
broker_address = "nat.ubainsyun.com"
port = 30413
broker_address = "192.168.1.193"
port = 1883
num_repeats = 1000 # 重复执行的次数
interval_between_repeats = 20 # 每次重复之间的间隔时间(秒)
interval_between_repeats = 0.1 # 每次重复之间的间隔时间(秒)
# 创建 MQTT 客户端实例
mqtt_client = Mqtt(broker_address, port)
......
topic,action,thirdPartyMeetingId,thirdPartyRoomId,conferenceName,messageName,startTime,endTime,companyNumber,signInBeforeMinutes,signEndTime,enableSignOut,signOutMinutesAfterSignIn,signOutAfterEndMinutes
/meeting/message/sync,mod,7565416702283099013,2,表处办公室2号会议室,1富创预约修改,2025-03-13 10:42:00.0,2025-03-13 10:46:00.0,CN-E8V-UBAINS,3,1,1,3,1
\ No newline at end of file
/meeting/message/sync,mod,9565416702283092125,1,表处办公室1号会议室,人脸测试31修改了,2025-04-10 21:00:00.0,2025-04-10 21:02:00.0,CN-E8V-UBAINS,1,1,1,1,1
\ No newline at end of file
topic,action,thirdPartyMeetingId,thirdPartyRoomId,conferenceName,messageName,startTime,endTime,companyNumber
/meeting/message/sync,del,7565416702283087898,1,表处办公室1号会议室,富创预约,2025-03-09 16:31:00.0,2025-03-09 16:43:00.0,CN-JHP-UBAINS
\ No newline at end of file
topic,action,thirdPartyMeetingId,thirdPartyRoomId,conferenceName,messageName,startTime,endTime,companyNumber,signInBeforeMinutes,signEndTime,enableSignOut,signOutMinutesAfterSignIn,signOutAfterEndMinutes
/meeting/message/sync,del,9565416702283092126,1,表处办公室1号会议室,人脸测试3修改了,2025-04-10 19:20:00.0,2025-04-10 19:35:00.0,CN-E8V-UBAINS,30,5,1,10,5
\ No newline at end of file
No preview for this file type
No preview for this file type
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论