mirror of
https://github.com/lkddi/dell-fans-controller-docker.git
synced 2026-05-18 21:57:29 +08:00
完善开源发布配置和使用文档
This commit is contained in:
@@ -7,9 +7,10 @@ from controller.logger import logger
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
host = os.getenv('HOST', "192.168.1.100")
|
||||
username = os.getenv('USERNAME', "root")
|
||||
password = os.getenv('PASSWORD', "your_idrac_password")
|
||||
# 从环境变量读取iDRAC连接信息,开源版本不内置任何真实默认凭据
|
||||
host = os.getenv('HOST')
|
||||
username = os.getenv('USERNAME')
|
||||
password = os.getenv('PASSWORD')
|
||||
if not host:
|
||||
raise RuntimeError('未设置 HOST 环境变量')
|
||||
|
||||
@@ -19,14 +20,17 @@ if __name__ == '__main__':
|
||||
if not password:
|
||||
raise RuntimeError('未设置 PASSWORD 环境变量')
|
||||
|
||||
# 复用控制器实例,避免每轮循环丢失上次设置状态
|
||||
client = FanController(host=host, username=username, password=password)
|
||||
|
||||
while True:
|
||||
try:
|
||||
# 执行一次温度读取和风扇控制周期
|
||||
client.run()
|
||||
time.sleep(60)
|
||||
except Exception as err:
|
||||
logger.error(
|
||||
f'运行控制器失败 {err}. {traceback.format_exc()}'
|
||||
)
|
||||
# iDRAC会话异常时等待下一轮,避免连续请求压垮IPMI服务
|
||||
time.sleep(60)
|
||||
|
||||
Reference in New Issue
Block a user