Update 2025-12-19 20:23:59
This commit is contained in:
@@ -3,6 +3,14 @@ import subprocess
|
||||
import time
|
||||
from dotenv import load_dotenv
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
import logging
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s [INFO] root: %(message)s',
|
||||
datefmt='%Y-%m-%d %H:%M:%S'
|
||||
)
|
||||
|
||||
# .env 파일 로드
|
||||
load_dotenv()
|
||||
@@ -99,9 +107,9 @@ def fetch_idrac_info(ip_address):
|
||||
f.write(f"01. RAID Settings - Raid ProductName : {get_value(hwinventory, 'ProductName = PERC')}\n")
|
||||
f.write(f"02. RAID Settings - Raid Types : No-Raid mode\n")
|
||||
|
||||
print(f"IP {ip_address} 에 대한 정보를 {output_file} 에 저장했습니다.")
|
||||
logging.info(f"IP {ip_address} 에 대한 정보를 {output_file} 에 저장했습니다.")
|
||||
except Exception as e:
|
||||
print(f"오류 발생: {e}")
|
||||
logging.error(f"오류 발생: {e}")
|
||||
|
||||
# 명령 결과에서 원하는 값 가져오기
|
||||
def get_value(output, key):
|
||||
@@ -117,7 +125,7 @@ start_time = time.time()
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
if len(sys.argv) != 2:
|
||||
print(f"Usage: {sys.argv[0]} <ip_file>")
|
||||
logging.error(f"Usage: {sys.argv[0]} <ip_file>")
|
||||
sys.exit(1)
|
||||
|
||||
ip_file_path = validate_ip_file(sys.argv[1])
|
||||
@@ -138,5 +146,5 @@ elapsed_hours = int(elapsed_time // 3600)
|
||||
elapsed_minutes = int((elapsed_time % 3600) // 60)
|
||||
elapsed_seconds = int(elapsed_time % 60)
|
||||
|
||||
print("정보 수집 완료.")
|
||||
print(f"수집 완료 시간: {elapsed_hours} 시간, {elapsed_minutes} 분, {elapsed_seconds} 초.")
|
||||
logging.info("정보 수집 완료.")
|
||||
logging.info(f"수집 완료 시간: {elapsed_hours} 시간, {elapsed_minutes} 분, {elapsed_seconds} 초.")
|
||||
|
||||
Reference in New Issue
Block a user