Initial commit
This commit is contained in:
6
data/scripts/.env
Normal file
6
data/scripts/.env
Normal file
@@ -0,0 +1,6 @@
|
||||
#IDRAC_USER=admin
|
||||
#IDRAC_PASS=tksoWkd12#
|
||||
IDRAC_USER=root
|
||||
IDRAC_PASS=calvin
|
||||
OME_USER=OME
|
||||
OME_PASS=epF!@34
|
||||
142
data/scripts/01-settings.py
Normal file
142
data/scripts/01-settings.py
Normal file
@@ -0,0 +1,142 @@
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
from dotenv import load_dotenv
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
# .env 파일 로드
|
||||
load_dotenv()
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER = os.getenv("IDRAC_USER")
|
||||
IDRAC_PASS = os.getenv("IDRAC_PASS")
|
||||
|
||||
# IP 파일 유효성 검사
|
||||
def validate_ip_file(ip_file_path):
|
||||
if not os.path.isfile(ip_file_path):
|
||||
raise FileNotFoundError(f"IP 파일 {ip_file_path} 이(가) 존재하지 않습니다.")
|
||||
return ip_file_path
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR = "idrac_info"
|
||||
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
def fetch_idrac_info(ip_address):
|
||||
try:
|
||||
# 모든 hwinventory 저장
|
||||
hwinventory = subprocess.getoutput(f"racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} hwinventory")
|
||||
# 모든 샷시 정보 저장
|
||||
getsysinfo = subprocess.getoutput(f"racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} getsysinfo")
|
||||
# 모든 SysProfileSettings 저장
|
||||
SysProfileSettings = subprocess.getoutput(f"racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get bios.SysProfileSettings")
|
||||
# ProcessorSettings 저장
|
||||
ProcessorSettings = subprocess.getoutput(f"racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get bios.ProcSettings")
|
||||
# Memory Settings 저장
|
||||
MemorySettings = subprocess.getoutput(f"racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get bios.MemSettings")
|
||||
# Raid Settings 저장
|
||||
STORAGEController = subprocess.getoutput(f"racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get STORAGE.Controller.1")
|
||||
|
||||
# 서비스 태그 가져오기
|
||||
SVC_TAG = get_value(getsysinfo, "SVC Tag")
|
||||
if not SVC_TAG:
|
||||
raise ValueError(f"IP {ip_address} 에 대한 SVC Tag 가져오기 실패")
|
||||
|
||||
# 출력 파일 작성
|
||||
output_file = os.path.join(OUTPUT_DIR, f"{SVC_TAG}.txt")
|
||||
with open(output_file, 'a', encoding='utf-8') as f:
|
||||
f.write(f"Dell EMC Server Bios,iDRAC,R/C Setting (SVC Tag: {SVC_TAG})\n\n")
|
||||
f.write("------------------------------------------Firware Version 정보------------------------------------------\n")
|
||||
f.write(f"1. SVC Tag : {SVC_TAG}\n")
|
||||
f.write(f"2. Bios Firmware : {get_value(getsysinfo, 'System BIOS Version')}\n")
|
||||
f.write(f"3. iDRAC Firmware Version : {get_value(getsysinfo, 'Firmware Version')}\n")
|
||||
f.write(f"4. NIC Integrated Firmware Version : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get NIC.FrmwImgMenu.1'), '#FamilyVersion')}\n")
|
||||
f.write(f"5. OnBoard NIC Firmware Version : Not Found\n")
|
||||
f.write(f"6. Raid Controller Firmware Version : {get_value(hwinventory, 'ControllerFirmwareVersion')}\n\n")
|
||||
|
||||
f.write("---------------------------------------------Bios 설정 정보----------------------------------------------\n")
|
||||
f.write(f"01. Bios Boot Mode : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get bios.BiosBootSettings'), 'BootMode')}\n")
|
||||
f.write(f"02. System Profile Settings - System Profile : {get_value(SysProfileSettings, 'SysProfile=')}\n")
|
||||
f.write(f"03. System Profile Settings - CPU Power Management : {get_value(SysProfileSettings, 'EnergyPerformanceBias')}\n")
|
||||
f.write(f"04. System Profile Settings - Memory Frequency : {get_value(SysProfileSettings, 'MemFrequency')}\n")
|
||||
f.write(f"05. System Profile Settings - Turbo Boost : {get_value(SysProfileSettings, 'ProcTurboMode')}\n")
|
||||
f.write(f"06. System Profile Settings - C1E : {get_value(SysProfileSettings, 'ProcC1E')}\n")
|
||||
f.write(f"07. System Profile Settings - C-States : {get_value(SysProfileSettings, 'ProcCStates')}\n")
|
||||
f.write(f"08. System Profile Settings - Monitor/Mwait : {get_value(SysProfileSettings, 'MonitorMwait')}\n")
|
||||
f.write(f"09. Processor Settings - Logical Processor : {get_value(ProcessorSettings, 'LogicalProc')}\n")
|
||||
f.write(f"10. Processor Settings - Virtualization Technology : {get_value(ProcessorSettings, 'ProcVirtualization')}\n")
|
||||
f.write(f"11. Processor Settings - LLC Prefetch : {get_value(ProcessorSettings, 'LlcPrefetch')}\n")
|
||||
f.write(f"12. Processor Settings - x2APIC Mode : {get_value(ProcessorSettings, 'ProcX2Apic')}\n")
|
||||
f.write(f"13. Memory Settings - Node Interleaving : {get_value(MemorySettings, 'NodeInterleave')}\n")
|
||||
f.write(f"14. Memory Settings - DIMM Self Healing (Post Package Repair) on Uncorrectable Memory Error : {get_value(MemorySettings, 'PPROnUCE')}\n")
|
||||
f.write(f"15. Memory Settings - Correctable Error Logging : {get_value(MemorySettings, 'CECriticalSEL')}\n")
|
||||
f.write(f"16. System Settings - Thermal Profile Optimization : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get System.ThermalSettings'), 'ThermalProfile')}\n")
|
||||
f.write(f"17. Integrated Devices Settings - SR-IOV Global Enable : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get Bios.IntegratedDevices'), 'SriovGlobalEnable')}\n")
|
||||
f.write(f"18. Miscellaneous Settings - F1/F2 Prompt on Error : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get bios.MiscSettings'), 'ErrPrompt')}\n\n")
|
||||
|
||||
f.write("---------------------------------------------iDRAC 설정 정보----------------------------------------------\n")
|
||||
f.write(f"01. iDRAC Settings - Timezone : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.Time.Timezone'), 'Timezone')}\n")
|
||||
f.write(f"02. iDRAC Settings - IPMI LAN Selection : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.CurrentNIC'), 'ActiveNIC')}\n")
|
||||
f.write(f"03. iDRAC Settings - IPMI IP(IPv4) : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.CurrentIPv4'), 'DHCPEnable')}\n")
|
||||
f.write(f"04. iDRAC Settings - IPMI IP(IPv6) : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.CurrentIPv6'), 'Enable')}\n")
|
||||
f.write(f"05. iDRAC Settings - Redfish Support : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.Redfish.Enable'), 'Enable')}\n")
|
||||
f.write(f"06. iDRAC Settings - SSH Support : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.SSH'), 'Enable')}\n")
|
||||
f.write(f"07. iDRAC Settings - AD User Domain Name : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.USERDomain.1.Name'), 'Name')}\n")
|
||||
f.write(f"08. iDRAC Settings - SC Server Address : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.ActiveDirectory.DomainController1'), 'DomainController1')}\n")
|
||||
f.write(f"09. iDRAC Settings - SE AD RoleGroup Name : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.ADGroup.1.Name'), 'Name')}\n")
|
||||
f.write(f"10. iDRAC Settings - SE AD RoleGroup Domain : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.ADGroup.1.Domain'), 'Domain')}\n")
|
||||
f.write(f"11. iDRAC Settings - SE AD RoleGroup Privilege : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.ADGroup.1.Privilege'), 'Privilege')}\n")
|
||||
f.write(f"12. iDRAC Settings - IDC AD RoleGroup Name : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.ADGroup.2.Name'), 'Name')}\n")
|
||||
f.write(f"13. iDRAC Settings - IDC AD RoleGroup Domain : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.ADGroup.2.Domain'), 'Domain')}\n")
|
||||
f.write(f"14. iDRAC Settings - IDC AD RoleGroup Privilege : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.ADGroup.2.Privilege'), 'Privilege')}\n")
|
||||
f.write(f"15. iDRAC Settings - Remote Log (syslog) : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.SysLog.SysLogEnable'), 'SysLogEnable')}\n")
|
||||
f.write(f"16. iDRAC Settings - syslog server address 1 : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.SysLog.Server1'), 'Server1')}\n")
|
||||
f.write(f"17. iDRAC Settings - syslog server address 2 : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.SysLog.Server2'), 'Server2')}\n")
|
||||
f.write(f"18. iDRAC Settings - syslog server port : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.SysLog.Port'), 'Port')}\n")
|
||||
f.write(f"19. iDRAC Settings - Remote KVM Nonsecure port : {get_value(subprocess.getoutput(f'racadm -r {ip_address} -u {IDRAC_USER} -p {IDRAC_PASS} get iDRAC.VirtualConsole.Port'), 'Port')}\n\n")
|
||||
|
||||
f.write("---------------------------------------------Raid 설정 정보----------------------------------------------\n")
|
||||
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} 에 저장했습니다.")
|
||||
except Exception as e:
|
||||
print(f"오류 발생: {e}")
|
||||
|
||||
# 명령 결과에서 원하는 값 가져오기
|
||||
def get_value(output, key):
|
||||
for line in output.splitlines():
|
||||
if key.lower() in line.lower():
|
||||
return line.split('=')[1].strip()
|
||||
return None
|
||||
|
||||
# 시작 시간 기록
|
||||
start_time = time.time()
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
if len(sys.argv) != 2:
|
||||
print(f"Usage: {sys.argv[0]} <ip_file>")
|
||||
sys.exit(1)
|
||||
|
||||
ip_file_path = validate_ip_file(sys.argv[1])
|
||||
with open(ip_file_path, 'r') as ip_file:
|
||||
ip_addresses = ip_file.read().splitlines()
|
||||
|
||||
# 병렬 처리를 위해 ThreadPoolExecutor 사용
|
||||
max_workers = 100 # 작업 풀 크기 설정
|
||||
with ThreadPoolExecutor(max_workers=max_workers) as executor:
|
||||
executor.map(fetch_idrac_info, ip_addresses)
|
||||
|
||||
# 종료 시간 기록
|
||||
end_time = time.time()
|
||||
|
||||
# 소요 시간 계산
|
||||
elapsed_time = end_time - start_time
|
||||
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} 초.")
|
||||
128
data/scripts/02-set_config.py
Normal file
128
data/scripts/02-set_config.py
Normal file
@@ -0,0 +1,128 @@
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
import time
|
||||
import logging
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
# ─────────────────────────────────────────────
|
||||
# 설정 (필요하면 .env 등에서 읽어와도 됨)
|
||||
IDRAC_USER = os.getenv("IDRAC_USER", "root")
|
||||
IDRAC_PASS = os.getenv("IDRAC_PASS", "calvin")
|
||||
RACADM = os.getenv("RACADM_PATH", "racadm") # PATH에 있으면 'racadm'
|
||||
|
||||
# 로깅
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s - %(levelname)s - %(message)s"
|
||||
)
|
||||
|
||||
def read_ip_list(ip_file: Path):
|
||||
ips = []
|
||||
for line in ip_file.read_text(encoding="utf-8").splitlines():
|
||||
s = line.strip()
|
||||
if s:
|
||||
ips.append(s)
|
||||
return ips
|
||||
|
||||
def preflight(ip: str) -> tuple[bool, str]:
|
||||
"""접속/인증/권한 간단 점검: getsysinfo 호출."""
|
||||
cmd = [RACADM, "-r", ip, "-u", IDRAC_USER, "-p", IDRAC_PASS, "getsysinfo"]
|
||||
try:
|
||||
p = subprocess.run(cmd, capture_output=True, text=True, encoding="utf-8", shell=False, timeout=30)
|
||||
if p.returncode != 0:
|
||||
return False, p.stderr.strip() or p.stdout.strip()
|
||||
return True, ""
|
||||
except Exception as e:
|
||||
return False, str(e)
|
||||
|
||||
def safe_xml_path(src: Path) -> Path:
|
||||
"""
|
||||
racadm이 경로의 공백/한글을 싫어하는 문제 회피:
|
||||
임시 폴더에 ASCII 파일명으로 복사해서 사용.
|
||||
"""
|
||||
tmp_dir = Path(tempfile.gettempdir()) / "idrac_xml"
|
||||
tmp_dir.mkdir(parents=True, exist_ok=True)
|
||||
# ASCII, 공백 제거 파일명
|
||||
dst_name = "config_" + str(int(time.time())) + ".xml"
|
||||
dst = tmp_dir / dst_name
|
||||
shutil.copy2(src, dst)
|
||||
return dst
|
||||
|
||||
def apply_xml(ip: str, xml_path: Path) -> tuple[bool, str]:
|
||||
"""
|
||||
racadm XML 적용. 벤더/세대에 따라
|
||||
'config -f' 또는 'set -t xml -f' 를 씁니다.
|
||||
일반적으로 최신 iDRAC은 config -f 가 잘 동작합니다.
|
||||
"""
|
||||
# 1) 공백/한글 제거된 임시 경로 준비
|
||||
safe_path = safe_xml_path(xml_path)
|
||||
|
||||
# 2) 명령 조립(리스트 인자, shell=False)
|
||||
# 필요 시 아래 둘 중 하나만 사용하세요.
|
||||
cmd = [RACADM, "-r", ip, "-u", IDRAC_USER, "-p", IDRAC_PASS, "config", "-f", str(safe_path)]
|
||||
# 대안:
|
||||
# cmd = [RACADM, "-r", ip, "-u", IDRAC_USER, "-p", IDRAC_PASS, "set", "-t", "xml", "-f", str(safe_path)]
|
||||
|
||||
logging.info("실행 명령(리스트) → %s", " ".join(cmd))
|
||||
try:
|
||||
p = subprocess.run(cmd, capture_output=True, text=True, encoding="utf-8", shell=False, timeout=180)
|
||||
stdout = (p.stdout or "").strip()
|
||||
stderr = (p.stderr or "").strip()
|
||||
|
||||
if p.returncode != 0:
|
||||
msg = f"racadm 실패 (rc={p.returncode})\nSTDOUT:\n{stdout}\nSTDERR:\n{stderr}"
|
||||
return False, msg
|
||||
# 일부 버전은 성공해도 stdout만 출력하고 rc=0
|
||||
return True, stdout or "성공"
|
||||
except Exception as e:
|
||||
return False, f"예외: {e}"
|
||||
finally:
|
||||
# 임시 XML 제거(필요 시 보관하려면 주석처리)
|
||||
try:
|
||||
safe_path.unlink(missing_ok=True)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 3:
|
||||
print("Usage: python 02-set_config.py <ip_file> <xml_file>")
|
||||
sys.exit(1)
|
||||
|
||||
ip_file = Path(sys.argv[1])
|
||||
xml_file = Path(sys.argv[2])
|
||||
|
||||
if not ip_file.is_file():
|
||||
logging.error("IP 파일을 찾을 수 없습니다: %s", ip_file)
|
||||
sys.exit(2)
|
||||
if not xml_file.is_file():
|
||||
logging.error("XML 파일을 찾을 수 없습니다: %s", xml_file)
|
||||
sys.exit(3)
|
||||
|
||||
ips = read_ip_list(ip_file)
|
||||
if not ips:
|
||||
logging.error("IP 목록이 비어있습니다.")
|
||||
sys.exit(4)
|
||||
|
||||
start = time.time()
|
||||
for ip in ips:
|
||||
logging.info("%s에 XML 파일 '%s' 설정 적용 중...", ip, xml_file)
|
||||
|
||||
ok, why = preflight(ip)
|
||||
if not ok:
|
||||
logging.error("%s 사전 점검(getsysinfo) 실패: %s", ip, why)
|
||||
continue
|
||||
|
||||
ok, msg = apply_xml(ip, xml_file)
|
||||
if ok:
|
||||
logging.info("%s 설정 성공: %s", ip, msg)
|
||||
else:
|
||||
logging.error("%s 설정 실패\n%s", ip, msg)
|
||||
|
||||
el = int(time.time() - start)
|
||||
logging.info("전체 설정 소요 시간: %d 시간, %d 분, %d 초.", el // 3600, (el % 3600) // 60, el % 60)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
51
data/scripts/03-tsr_log.py
Normal file
51
data/scripts/03-tsr_log.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
from dotenv import load_dotenv
|
||||
import sys
|
||||
from multiprocessing import Pool
|
||||
|
||||
# 환경 변수 로드
|
||||
load_dotenv() # .env 파일에서 환경 변수 로드
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER, IDRAC_PASS = os.getenv("IDRAC_USER"), os.getenv("IDRAC_PASS")
|
||||
|
||||
# IP 주소 파일 로드 함수
|
||||
def load_ip_file(ip_file_path):
|
||||
if not os.path.isfile(ip_file_path):
|
||||
sys.exit(f"IP file {ip_file_path} does not exist.")
|
||||
with open(ip_file_path, "r") as file:
|
||||
return [line.strip() for line in file if line.strip()]
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
def fetch_idrac_info(idrac_ip):
|
||||
print(f"Collecting TSR report for iDRAC IP: {idrac_ip}")
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["racadm", "-r", idrac_ip, "-u", IDRAC_USER, "-p", IDRAC_PASS, "techsupreport", "collect"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
print(
|
||||
f"Successfully collected TSR report for {idrac_ip}"
|
||||
if result.returncode == 0
|
||||
else f"Failed to collect TSR report for {idrac_ip}: {result.stderr.strip()}"
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Exception occurred for {idrac_ip}: {e}")
|
||||
|
||||
# 메인 함수
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
sys.exit("Usage: python script.py <ip_file>")
|
||||
|
||||
ip_list = load_ip_file(sys.argv[1])
|
||||
start_time = time.time()
|
||||
|
||||
# 병렬로 iDRAC 정보를 가져오는 작업 수행 (최대 10개 동시 처리)
|
||||
with Pool() as pool:
|
||||
pool.map(fetch_idrac_info, ip_list)
|
||||
|
||||
elapsed_time = time.time() - start_time
|
||||
print(f"설정 완료. 수집 완료 시간: {int(elapsed_time // 3600)} 시간, {int((elapsed_time % 3600) // 60)} 분, {int(elapsed_time % 60)} 초.")
|
||||
54
data/scripts/04-tsr_save.py
Normal file
54
data/scripts/04-tsr_save.py
Normal file
@@ -0,0 +1,54 @@
|
||||
import os
|
||||
import subprocess
|
||||
from dotenv import load_dotenv
|
||||
import sys
|
||||
from multiprocessing import Pool
|
||||
|
||||
# 환경 변수 로드
|
||||
load_dotenv() # .env 파일에서 환경 변수 로드
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER = os.getenv("IDRAC_USER")
|
||||
IDRAC_PASS = os.getenv("IDRAC_PASS")
|
||||
OME_USER = os.getenv("OME_USER")
|
||||
OME_PASS = os.getenv("OME_PASS")
|
||||
|
||||
# IP 주소 파일 로드 및 유효성 검사
|
||||
def load_ip_file(ip_file_path):
|
||||
if not os.path.isfile(ip_file_path):
|
||||
sys.exit(f"IP file {ip_file_path} does not exist.")
|
||||
with open(ip_file_path, "r") as file:
|
||||
return [line.strip() for line in file if line.strip()]
|
||||
|
||||
# iDRAC 정보를 가져오는 함수
|
||||
def fetch_idrac_info(idrac_ip):
|
||||
print(f"Collecting TSR report for iDRAC IP: {idrac_ip}")
|
||||
try:
|
||||
result = subprocess.run(
|
||||
[
|
||||
"racadm", "-r", idrac_ip, "-u", IDRAC_USER, "-p", IDRAC_PASS,
|
||||
"techsupreport", "export", "-l", "//10.10.3.251/share/", "-u", OME_USER, "-p", OME_PASS
|
||||
],
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
print(
|
||||
f"Successfully collected TSR report for {idrac_ip}"
|
||||
if result.returncode == 0
|
||||
else f"Failed to collect TSR report for {idrac_ip}: {result.stderr.strip()}"
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Exception occurred for {idrac_ip}: {e}")
|
||||
|
||||
# 메인 함수
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
sys.exit("Usage: python script.py <ip_file>")
|
||||
|
||||
ip_list = load_ip_file(sys.argv[1])
|
||||
|
||||
# 병렬로 iDRAC 정보를 가져오는 작업 수행
|
||||
with Pool() as pool:
|
||||
pool.map(fetch_idrac_info, ip_list)
|
||||
|
||||
print("설정 완료.")
|
||||
51
data/scripts/05-clrsel.py
Normal file
51
data/scripts/05-clrsel.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
from dotenv import load_dotenv
|
||||
import sys
|
||||
from multiprocessing import Pool
|
||||
|
||||
# Load environment variables
|
||||
load_dotenv() # Load variables from .env file
|
||||
|
||||
# Credentials
|
||||
IDRAC_USER, IDRAC_PASS = os.getenv("IDRAC_USER"), os.getenv("IDRAC_PASS")
|
||||
|
||||
# Load IP addresses from file
|
||||
def load_ip_file(ip_file_path):
|
||||
if not os.path.isfile(ip_file_path):
|
||||
sys.exit(f"IP file {ip_file_path} does not exist.")
|
||||
with open(ip_file_path, "r") as file:
|
||||
return [line.strip() for line in file if line.strip()]
|
||||
|
||||
# Clear SEL log for given iDRAC IP
|
||||
def clear_idrac_sel_log(idrac_ip):
|
||||
print(f"Clearing SEL log for iDRAC IP: {idrac_ip}")
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["racadm", "-r", idrac_ip, "-u", IDRAC_USER, "-p", IDRAC_PASS, "clrsel"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
print(
|
||||
f"Successfully cleared SEL log for {idrac_ip}"
|
||||
if result.returncode == 0
|
||||
else f"Failed to clear SEL log for {idrac_ip}: {result.stderr.strip()}"
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Exception occurred for {idrac_ip}: {e}")
|
||||
|
||||
# Main function
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
sys.exit("Usage: python script.py <ip_file>")
|
||||
|
||||
ip_list = load_ip_file(sys.argv[1])
|
||||
start_time = time.time()
|
||||
|
||||
# Execute in parallel using Pool (max 10 simultaneous processes)
|
||||
with Pool(processes=10) as pool:
|
||||
pool.map(clear_idrac_sel_log, ip_list)
|
||||
|
||||
elapsed_time = time.time() - start_time
|
||||
print(f"Log clear 완료. 완료 시간: {int(elapsed_time // 3600)} 시간, {int((elapsed_time % 3600) // 60)} 분, {int(elapsed_time % 60)} 초.")
|
||||
51
data/scripts/06-PowerON.py
Normal file
51
data/scripts/06-PowerON.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
from dotenv import load_dotenv
|
||||
import sys
|
||||
from multiprocessing import Pool
|
||||
|
||||
# Load environment variables
|
||||
load_dotenv() # Load variables from .env file
|
||||
|
||||
# Credentials
|
||||
IDRAC_USER, IDRAC_PASS = os.getenv("IDRAC_USER"), os.getenv("IDRAC_PASS")
|
||||
|
||||
# Load IP addresses from file
|
||||
def load_ip_file(ip_file_path):
|
||||
if not os.path.isfile(ip_file_path):
|
||||
sys.exit(f"IP file {ip_file_path} does not exist.")
|
||||
with open(ip_file_path, "r") as file:
|
||||
return [line.strip() for line in file if line.strip()]
|
||||
|
||||
# Power on the server for given iDRAC IP
|
||||
def poweron_idrac_server(idrac_ip):
|
||||
print(f"Powering on server for iDRAC IP: {idrac_ip}")
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["racadm", "-r", idrac_ip, "-u", IDRAC_USER, "-p", IDRAC_PASS, "serveraction", "powerup"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
print(
|
||||
f"Successfully powered on server for {idrac_ip}"
|
||||
if result.returncode == 0
|
||||
else f"Failed to power on server for {idrac_ip}: {result.stderr.strip()}"
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Exception occurred for {idrac_ip}: {e}")
|
||||
|
||||
# Main function
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
sys.exit("Usage: python script.py <ip_file>")
|
||||
|
||||
ip_list = load_ip_file(sys.argv[1])
|
||||
start_time = time.time()
|
||||
|
||||
# Execute in parallel using Pool (max 10 simultaneous processes)
|
||||
with Pool() as pool:
|
||||
pool.map(poweron_idrac_server, ip_list)
|
||||
|
||||
elapsed_time = time.time() - start_time
|
||||
print(f"Server Power On 완료. 완료 시간: {int(elapsed_time // 3600)} 시간, {int((elapsed_time % 3600) // 60)} 분, {int(elapsed_time % 60)} 초.")
|
||||
51
data/scripts/07-PowerOFF.py
Normal file
51
data/scripts/07-PowerOFF.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
from dotenv import load_dotenv
|
||||
import sys
|
||||
from multiprocessing import Pool
|
||||
|
||||
# Load environment variables
|
||||
load_dotenv() # Load variables from .env file
|
||||
|
||||
# Credentials
|
||||
IDRAC_USER, IDRAC_PASS = os.getenv("IDRAC_USER"), os.getenv("IDRAC_PASS")
|
||||
|
||||
# Load IP addresses from file
|
||||
def load_ip_file(ip_file_path):
|
||||
if not os.path.isfile(ip_file_path):
|
||||
sys.exit(f"IP file {ip_file_path} does not exist.")
|
||||
with open(ip_file_path, "r") as file:
|
||||
return [line.strip() for line in file if line.strip()]
|
||||
|
||||
# Power off the server for given iDRAC IP
|
||||
def poweroff_idrac_server(idrac_ip):
|
||||
print(f"Powering off server for iDRAC IP: {idrac_ip}")
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["racadm", "-r", idrac_ip, "-u", IDRAC_USER, "-p", IDRAC_PASS, "serveraction", "powerdown"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
print(
|
||||
f"Successfully powered off server for {idrac_ip}"
|
||||
if result.returncode == 0
|
||||
else f"Failed to power off server for {idrac_ip}: {result.stderr.strip()}"
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Exception occurred for {idrac_ip}: {e}")
|
||||
|
||||
# Main function
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
sys.exit("Usage: python script.py <ip_file>")
|
||||
|
||||
ip_list = load_ip_file(sys.argv[1])
|
||||
start_time = time.time()
|
||||
|
||||
# Execute in parallel using Pool (max 10 simultaneous processes)
|
||||
with Pool() as pool:
|
||||
pool.map(poweroff_idrac_server, ip_list)
|
||||
|
||||
elapsed_time = time.time() - start_time
|
||||
print(f"Server Power Off 완료. 완료 시간: {int(elapsed_time // 3600)} 시간, {int((elapsed_time % 3600) // 60)} 분, {int(elapsed_time % 60)} 초.")
|
||||
51
data/scripts/08-job_delete_all.py
Normal file
51
data/scripts/08-job_delete_all.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
from dotenv import load_dotenv
|
||||
import sys
|
||||
from multiprocessing import Pool
|
||||
|
||||
# Load environment variables
|
||||
load_dotenv() # Load variables from .env file
|
||||
|
||||
# Credentials
|
||||
IDRAC_USER, IDRAC_PASS = os.getenv("IDRAC_USER"), os.getenv("IDRAC_PASS")
|
||||
|
||||
# Load IP addresses from file
|
||||
def load_ip_file(ip_file_path):
|
||||
if not os.path.isfile(ip_file_path):
|
||||
sys.exit(f"IP file {ip_file_path} does not exist.")
|
||||
with open(ip_file_path, "r") as file:
|
||||
return [line.strip() for line in file if line.strip()]
|
||||
|
||||
# Delete all jobs for given iDRAC IP
|
||||
def delete_all_jobs(idrac_ip):
|
||||
print(f"Deleting all jobs for iDRAC IP: {idrac_ip}")
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["racadm", "-r", idrac_ip, "-u", IDRAC_USER, "-p", IDRAC_PASS, "jobqueue", "delete", "-i", "ALL"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
print(
|
||||
f"Successfully deleted all jobs for {idrac_ip}"
|
||||
if result.returncode == 0
|
||||
else f"Failed to delete jobs for {idrac_ip}: {result.stderr.strip()}"
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Exception occurred for {idrac_ip}: {e}")
|
||||
|
||||
# Main function
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
sys.exit("Usage: python script.py <ip_file>")
|
||||
|
||||
ip_list = load_ip_file(sys.argv[1])
|
||||
start_time = time.time()
|
||||
|
||||
# Execute in parallel using Pool (max 10 simultaneous processes)
|
||||
with Pool() as pool:
|
||||
pool.map(delete_all_jobs, ip_list)
|
||||
|
||||
elapsed_time = time.time() - start_time
|
||||
print(f"Job delete 완료. 완료 시간: {int(elapsed_time // 3600)} 시간, {int((elapsed_time % 3600) // 60)} 분, {int(elapsed_time % 60)} 초.")
|
||||
100
data/scripts/09-Log_Viewer.py
Normal file
100
data/scripts/09-Log_Viewer.py
Normal file
@@ -0,0 +1,100 @@
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
import logging
|
||||
from dotenv import load_dotenv
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
# .env 파일 로드
|
||||
load_dotenv()
|
||||
|
||||
# 로깅 설정
|
||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER = os.getenv("IDRAC_USER")
|
||||
IDRAC_PASS = os.getenv("IDRAC_PASS")
|
||||
|
||||
# IP 파일 유효성 검사 함수
|
||||
def validate_ip_file(ip_file_path):
|
||||
if not os.path.isfile(ip_file_path):
|
||||
raise FileNotFoundError(f"IP 파일 '{ip_file_path}' 이(가) 존재하지 않습니다.")
|
||||
return ip_file_path
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR = "idrac_info"
|
||||
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
||||
|
||||
# iDRAC 정보를 가져오는 함수
|
||||
def fetch_idrac_info(idrac_ip):
|
||||
try:
|
||||
logger.info(f"{idrac_ip}에 대한 샷시 정보 가져오는 중...")
|
||||
getsysinfo_command = [
|
||||
"racadm", "-r", idrac_ip,
|
||||
"-u", IDRAC_USER,
|
||||
"-p", IDRAC_PASS,
|
||||
"getsysinfo"
|
||||
]
|
||||
getsysinfo_result = subprocess.run(getsysinfo_command, capture_output=True, text=True)
|
||||
getsysinfo = getsysinfo_result.stdout
|
||||
|
||||
svc_tag = ""
|
||||
for line in getsysinfo.splitlines():
|
||||
if "SVC Tag" in line:
|
||||
svc_tag = line.split('=')[1].strip()
|
||||
break
|
||||
|
||||
if not svc_tag:
|
||||
logger.error(f"IP: {idrac_ip}에 대한 SVC Tag 가져오기 실패")
|
||||
return
|
||||
|
||||
logger.info(f"{idrac_ip}에 대한 서버 Log 가져오는 중...")
|
||||
viewerlog_command = [
|
||||
"racadm", "-r", idrac_ip,
|
||||
"-u", IDRAC_USER,
|
||||
"-p", IDRAC_PASS,
|
||||
"getsel"
|
||||
]
|
||||
viewerlog_result = subprocess.run(viewerlog_command, capture_output=True, text=True)
|
||||
viewerlog = viewerlog_result.stdout
|
||||
|
||||
output_file = os.path.join(OUTPUT_DIR, f"{svc_tag}.txt")
|
||||
with open(output_file, 'w', encoding='utf-8') as f:
|
||||
f.write(f"Dell Server Log Viewer (SVC Tag: {svc_tag})\n\n")
|
||||
f.write("------------------------------------------Log Viewer------------------------------------------\n")
|
||||
f.write(f"1. SVC Tag : {svc_tag}\n")
|
||||
f.write(f"{viewerlog}\n")
|
||||
|
||||
logger.info(f"{idrac_ip}에 대한 로그 정보가 {output_file}에 저장되었습니다.")
|
||||
except Exception as e:
|
||||
logger.error(f"설정 중 오류 발생: {e}")
|
||||
|
||||
# 소요 시간 계산 함수
|
||||
def calculate_elapsed_time(start_time):
|
||||
elapsed_time = time.time() - start_time
|
||||
hours, remainder = divmod(elapsed_time, 3600)
|
||||
minutes, seconds = divmod(remainder, 60)
|
||||
logger.info(f"전체 작업 소요 시간: {int(hours)} 시간, {int(minutes)} 분, {int(seconds)} 초.")
|
||||
|
||||
# 메인 함수
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
logger.error(f"Usage: {sys.argv[0]} <ip_file>")
|
||||
sys.exit(1)
|
||||
|
||||
ip_file_path = validate_ip_file(sys.argv[1])
|
||||
|
||||
with open(ip_file_path, 'r') as ip_file:
|
||||
ip_addresses = [line.strip() for line in ip_file if line.strip()]
|
||||
|
||||
start_time = time.time()
|
||||
|
||||
# 병렬 처리를 위해 ThreadPoolExecutor 사용
|
||||
max_workers = 100 # 병렬 작업 수 설정
|
||||
with ThreadPoolExecutor(max_workers=max_workers) as executor:
|
||||
executor.map(fetch_idrac_info, ip_addresses)
|
||||
|
||||
calculate_elapsed_time(start_time)
|
||||
64
data/scripts/LOM.Enabled.sh
Normal file
64
data/scripts/LOM.Enabled.sh
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER="root"
|
||||
IDRAC_PASS="calvin"
|
||||
|
||||
# IP 주소 파일 경로 인자 받기
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ip_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP_FILE=$1
|
||||
|
||||
if [ ! -f "$IP_FILE" ]; then
|
||||
echo "IP file $IP_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR="idrac_info"
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
fetch_idrac_info() {
|
||||
local IDRAC_IP=$(cat $IP_FILE)
|
||||
|
||||
# DellEMC Server
|
||||
#local set1=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.MemSettings.CorrEccSmi Disabled)
|
||||
#local set2=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.ProcSettings.ProcVirtualization Disabled)
|
||||
#local set3=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.BiosBootSettings.SetBootOrderEn NIC.PxeDevice.1-1,NIC.PxeDevice.2-1)
|
||||
#local set4=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.NetworkSettings.PxeDev2EnDis Enabled)
|
||||
#local set5=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.PxeDev2Settings.PxeDev2Interface NIC.Integrated.1-2-1)
|
||||
local set6=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.IntegratedDevices.EmbNic1Nic2 Enabled)
|
||||
#local set7=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.SysProfileSettings.SysProfile Custom)
|
||||
#local set8=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.SysProfileSettings.DynamicLinkWidthManagement Unforced)
|
||||
#local set9=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.MiscSettings.ErrPrompt Disabled)
|
||||
local set10=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS jobqueue create BIOS.Setup.1-1 -r forced)
|
||||
|
||||
rm -f $IP_FILE
|
||||
}
|
||||
|
||||
export -f fetch_idrac_info
|
||||
export IDRAC_USER
|
||||
export IDRAC_PASS
|
||||
export OUTPUT_DIR
|
||||
|
||||
# 시작 시간 기록
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
fetch_idrac_info
|
||||
|
||||
# 종료 시간 기록
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
# 소요 시간 계산
|
||||
ELAPSED_TIME=$(($END_TIME - $START_TIME))
|
||||
ELAPSED_HOURS=$(($ELAPSED_TIME / 3600))
|
||||
ELAPSED_MINUTES=$((($ELAPSED_TIME % 3600) / 60))
|
||||
ELAPSED_SECONDS=$(($ELAPSED_TIME % 60))
|
||||
|
||||
echo "설정 완료."
|
||||
echo "수집 완료 시간: $ELAPSED_HOURS 시간, $ELAPSED_MINUTES 분, $ELAPSED_SECONDS 초."
|
||||
64
data/scripts/LOM_Disabled.sh
Normal file
64
data/scripts/LOM_Disabled.sh
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER="root"
|
||||
IDRAC_PASS="calvin"
|
||||
|
||||
# IP 주소 파일 경로 인자 받기
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ip_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP_FILE=$1
|
||||
|
||||
if [ ! -f "$IP_FILE" ]; then
|
||||
echo "IP file $IP_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR="idrac_info"
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
fetch_idrac_info() {
|
||||
local IDRAC_IP=$(cat $IP_FILE)
|
||||
|
||||
# DellEMC Server
|
||||
#local set1=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.MemSettings.CorrEccSmi Disabled)
|
||||
#local set2=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.ProcSettings.ProcVirtualization Disabled)
|
||||
#local set3=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.BiosBootSettings.SetBootOrderEn NIC.PxeDevice.1-1,NIC.PxeDevice.2-1)
|
||||
#local set4=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.NetworkSettings.PxeDev2EnDis Enabled)
|
||||
#local set5=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.PxeDev2Settings.PxeDev2Interface NIC.Integrated.1-2-1)
|
||||
local set6=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.IntegratedDevices.EmbNic1Nic2 DisabledOs)
|
||||
#local set7=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.SysProfileSettings.SysProfile Custom)
|
||||
#local set8=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.SysProfileSettings.DynamicLinkWidthManagement Unforced)
|
||||
#local set9=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set BIOS.MiscSettings.ErrPrompt Disabled)
|
||||
local set10=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS jobqueue create BIOS.Setup.1-1 -r forced)
|
||||
|
||||
rm -f $IP_FILE
|
||||
}
|
||||
|
||||
export -f fetch_idrac_info
|
||||
export IDRAC_USER
|
||||
export IDRAC_PASS
|
||||
export OUTPUT_DIR
|
||||
|
||||
# 시작 시간 기록
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
fetch_idrac_info
|
||||
|
||||
# 종료 시간 기록
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
# 소요 시간 계산
|
||||
ELAPSED_TIME=$(($END_TIME - $START_TIME))
|
||||
ELAPSED_HOURS=$(($ELAPSED_TIME / 3600))
|
||||
ELAPSED_MINUTES=$((($ELAPSED_TIME % 3600) / 60))
|
||||
ELAPSED_SECONDS=$(($ELAPSED_TIME % 60))
|
||||
|
||||
echo "설정 완료."
|
||||
echo "수집 완료 시간: $ELAPSED_HOURS 시간, $ELAPSED_MINUTES 분, $ELAPSED_SECONDS 초."
|
||||
97
data/scripts/LinePLUS-MAC_info.sh
Normal file
97
data/scripts/LinePLUS-MAC_info.sh
Normal file
@@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER="root"
|
||||
IDRAC_PASS="calvin"
|
||||
|
||||
# IP 주소 파일 경로 인자 받기
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ip_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP_FILE=$1
|
||||
|
||||
if [ ! -f "$IP_FILE" ]; then
|
||||
echo "IP file $IP_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR="idrac_info"
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
fetch_idrac_info() {
|
||||
local IDRAC_IP=$(cat $IP_FILE)
|
||||
|
||||
# 모든 hwinventory 저장
|
||||
local getsysinfo=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS getsysinfo)
|
||||
#local swinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS swinventory)
|
||||
local hwinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS hwinventory)
|
||||
|
||||
#서비스 태그 가져오기
|
||||
local SVC_TAG=$(echo "$getsysinfo" | grep -i "SVC Tag" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
#iDRAC MAC 확인
|
||||
local idrac_mac=$(echo "$getsysinfo" | grep -i "MAC Address = " | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
#NIC.Integrated MAC 확인
|
||||
local Integrated_1=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Integrated_2=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-2-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#추가 NIC MAC 확인
|
||||
#local NIC_Slot_1=$(echo "$swinventory" | awk '/FQDD = NIC.Slot.1-1-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
#local NIC_Slot_2=$(echo "$swinventory" | awk '/FQDD = NIC.Slot.1-2-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#OnBoard MAC 확인
|
||||
local Onboard_1=$(echo "$getsysinfo" | grep -P "NIC.Embedded.1-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Onboard_2=$(echo "$getsysinfo" | grep -P "NIC.Embedded.2-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#파트 벤더 확인
|
||||
local memory=$(echo "$hwinventory" | grep -A5 "DIMM" | grep "Manufacturer" | awk -F '=' '{print $2}' | awk '{$1=$1};1' | sort | uniq | cut -c1)
|
||||
local nvme_m2=$(echo "$hwinventory" | grep -A3 "Disk.Direct" | grep "Manufacturer" | awk -F '= ' '{print $2}' | sort | uniq)
|
||||
local ssd=$(echo "$hwinventory" | grep -A3 "Disk.Bay" | grep "Manufacturer" | awk -F '=' '{print $2}' | awk '{$1=$1};1' | sort | uniq | cut -c1)
|
||||
|
||||
# 서비스 태그가 존재하는지 확인
|
||||
if [ -z "$SVC_TAG" ]; then
|
||||
echo "Failed to retrieve SVC Tag for IP: $IDRAC_IP"
|
||||
return
|
||||
fi
|
||||
|
||||
local OUTPUT_FILE="$OUTPUT_DIR/$SVC_TAG.txt"
|
||||
# SVC Tag 확인
|
||||
echo "$SVC_TAG" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_1" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_2" >> "$OUTPUT_FILE"
|
||||
echo "$Onboard_1" >> "$OUTPUT_FILE"
|
||||
echo "$Onboard_2" >> "$OUTPUT_FILE"
|
||||
echo "$idrac_mac" >> "$OUTPUT_FILE"
|
||||
echo "$memory" >> "$OUTPUT_FILE"
|
||||
echo "$ssd" >> "$OUTPUT_FILE"
|
||||
#임시파일 제거
|
||||
rm -f $IP_FILE
|
||||
}
|
||||
|
||||
export -f fetch_idrac_info
|
||||
export IDRAC_USER
|
||||
export IDRAC_PASS
|
||||
export OUTPUT_DIR
|
||||
|
||||
# 시작 시간 기록
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
fetch_idrac_info
|
||||
|
||||
# 종료 시간 기록
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
# 소요 시간 계산
|
||||
ELAPSED_TIME=$(($END_TIME - $START_TIME))
|
||||
ELAPSED_HOURS=$(($ELAPSED_TIME / 3600))
|
||||
ELAPSED_MINUTES=$((($ELAPSED_TIME % 3600) / 60))
|
||||
ELAPSED_SECONDS=$(($ELAPSED_TIME % 60))
|
||||
|
||||
echo "정보 수집 완료."
|
||||
echo "수집 완료 시간: $ELAPSED_HOURS 시간, $ELAPSED_MINUTES 분, $ELAPSED_SECONDS 초."
|
||||
92
data/scripts/PortGUID.py
Normal file
92
data/scripts/PortGUID.py
Normal file
@@ -0,0 +1,92 @@
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from dotenv import load_dotenv
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
|
||||
# .env 파일에서 사용자 이름 및 비밀번호 설정
|
||||
load_dotenv()
|
||||
IDRAC_USER = os.getenv("IDRAC_USER")
|
||||
IDRAC_PASS = os.getenv("IDRAC_PASS")
|
||||
|
||||
def fetch_idrac_info(idrac_ip, output_dir):
|
||||
try:
|
||||
# 서비스 태그 가져오기 (get 제외)
|
||||
cmd_getsysinfo = f"racadm -r {idrac_ip} -u {IDRAC_USER} -p {IDRAC_PASS} getsysinfo"
|
||||
getsysinfo = subprocess.getoutput(cmd_getsysinfo)
|
||||
svc_tag_match = re.search(r"SVC Tag\s*=\s*(\S+)", getsysinfo)
|
||||
svc_tag = svc_tag_match.group(1) if svc_tag_match else None
|
||||
|
||||
if not svc_tag:
|
||||
print(f"Failed to retrieve SVC Tag for IP: {idrac_ip}")
|
||||
return
|
||||
|
||||
# InfiniBand.VndrConfigPage 목록 가져오기
|
||||
cmd_list = f"racadm -r {idrac_ip} -u {IDRAC_USER} -p {IDRAC_PASS} get InfiniBand.VndrConfigPage"
|
||||
output_list = subprocess.getoutput(cmd_list)
|
||||
|
||||
# InfiniBand.VndrConfigPage.<숫자> 및 Key 값 추출
|
||||
matches = re.findall(r"InfiniBand\.VndrConfigPage\.(\d+)\s+\[Key=InfiniBand\.Slot\.(\d+)-\d+#VndrConfigPage]", output_list)
|
||||
|
||||
# 결과를 저장할 파일 생성
|
||||
output_file = os.path.join(output_dir, f"{svc_tag}.txt")
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
with open(output_file, "w") as f:
|
||||
# 서비스 태그 저장
|
||||
f.write(f"{svc_tag}\n")
|
||||
|
||||
# 모든 PortGUID를 저장할 리스트
|
||||
hex_guid_list = []
|
||||
|
||||
# 각 InfiniBand.VndrConfigPage.<숫자> 처리
|
||||
for number, slot in matches:
|
||||
cmd_detail = f"racadm -r {idrac_ip} -u {IDRAC_USER} -p {IDRAC_PASS} get InfiniBand.VndrConfigPage.{number}"
|
||||
output_detail = subprocess.getoutput(cmd_detail)
|
||||
|
||||
# PortGUID 값 추출
|
||||
match_guid = re.search(r"PortGUID=(\S+)", output_detail)
|
||||
port_guid = match_guid.group(1) if match_guid else "Not Found"
|
||||
|
||||
# Slot.<숫자>: <PortGUID> 형식으로 저장
|
||||
f.write(f"Slot.{slot}: {port_guid}\n")
|
||||
|
||||
# PortGUID를 0x 형식으로 변환하여 리스트에 추가
|
||||
if port_guid != "Not Found":
|
||||
hex_guid_list.append(f"0x{port_guid.replace(':', '').upper()}")
|
||||
|
||||
# 모든 PortGUID를 "GUID: 0x<GUID1>;0x<GUID2>" 형식으로 저장
|
||||
if hex_guid_list:
|
||||
f.write(f"GUID: {';'.join(hex_guid_list)}\n")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error processing IP {idrac_ip}: {e}")
|
||||
|
||||
def main(ip_file):
|
||||
if not os.path.isfile(ip_file):
|
||||
print(f"IP file {ip_file} does not exist.")
|
||||
return
|
||||
|
||||
output_dir = "/app/idrac_info/idrac_info"
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
with open(ip_file, "r") as file:
|
||||
ip_addresses = [line.strip() for line in file.readlines()]
|
||||
|
||||
with ThreadPoolExecutor(max_workers=100) as executor:
|
||||
future_to_ip = {executor.submit(fetch_idrac_info, ip, output_dir): ip for ip in ip_addresses}
|
||||
|
||||
for future in as_completed(future_to_ip):
|
||||
try:
|
||||
future.result()
|
||||
except Exception as e:
|
||||
print(f"Error processing task: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python script.py <ip_file>")
|
||||
sys.exit(1)
|
||||
|
||||
ip_file = sys.argv[1]
|
||||
main(ip_file)
|
||||
147
data/scripts/PortGUID_v1.py
Normal file
147
data/scripts/PortGUID_v1.py
Normal file
@@ -0,0 +1,147 @@
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
|
||||
from dotenv import load_dotenv, find_dotenv
|
||||
|
||||
# ─────────────────────────────────────────────────────────────
|
||||
# .env 자동 탐색 로드 (현재 파일 기준 상위 디렉터리까지 검색)
|
||||
load_dotenv(find_dotenv())
|
||||
|
||||
IDRAC_USER = os.getenv("IDRAC_USER")
|
||||
IDRAC_PASS = os.getenv("IDRAC_PASS")
|
||||
|
||||
|
||||
def resolve_output_dir() -> Path:
|
||||
"""
|
||||
실행 위치와 무관하게 결과를 data/idrac_info 밑으로 저장.
|
||||
- 스크립트가 data/scripts/ 에 있다면 → data/idrac_info
|
||||
- 그 외 위치라도 → (스크립트 상위 폴더)/idrac_info
|
||||
"""
|
||||
here = Path(__file__).resolve().parent # .../data/scripts 또는 다른 폴더
|
||||
# case 1: .../data/scripts → data/idrac_info
|
||||
if here.name.lower() == "scripts" and here.parent.name.lower() == "data":
|
||||
base = here.parent # data
|
||||
# case 2: .../scripts (상위가 data가 아닐 때도 상위 폴더를 base로 사용)
|
||||
elif here.name.lower() == "scripts":
|
||||
base = here.parent
|
||||
# case 3: 일반적인 경우: 현재 파일의 상위 폴더
|
||||
else:
|
||||
base = here.parent
|
||||
|
||||
out = base / "idrac_info"
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
return out
|
||||
|
||||
|
||||
def fetch_idrac_info(idrac_ip: str, output_dir: Path) -> None:
|
||||
try:
|
||||
# 서비스 태그 가져오기 (get 제외)
|
||||
cmd_getsysinfo = [
|
||||
"racadm", "-r", idrac_ip, "-u", IDRAC_USER or "", "-p", IDRAC_PASS or "", "getsysinfo"
|
||||
]
|
||||
getsysinfo = subprocess.getoutput(" ".join(cmd_getsysinfo))
|
||||
svc_tag_match = re.search(r"SVC Tag\s*=\s*(\S+)", getsysinfo)
|
||||
svc_tag = svc_tag_match.group(1) if svc_tag_match else None
|
||||
|
||||
if not svc_tag:
|
||||
print(f"Failed to retrieve SVC Tag for IP: {idrac_ip}")
|
||||
return
|
||||
|
||||
# InfiniBand.VndrConfigPage 목록 가져오기
|
||||
cmd_list = [
|
||||
"racadm", "-r", idrac_ip, "-u", IDRAC_USER or "", "-p", IDRAC_PASS or "", "get", "InfiniBand.VndrConfigPage"
|
||||
]
|
||||
output_list = subprocess.getoutput(" ".join(cmd_list))
|
||||
|
||||
# InfiniBand.VndrConfigPage.<숫자> 및 Key 값 추출
|
||||
matches = re.findall(
|
||||
r"InfiniBand\.VndrConfigPage\.(\d+)\s+\[Key=InfiniBand\.Slot\.(\d+)-\d+#VndrConfigPage]",
|
||||
output_list
|
||||
)
|
||||
|
||||
# 결과 저장 파일
|
||||
output_file = output_dir / f"{svc_tag}.txt"
|
||||
|
||||
with output_file.open("w", encoding="utf-8", newline="\n") as f:
|
||||
# 서비스 태그
|
||||
f.write(f"{svc_tag}\n")
|
||||
|
||||
# --- 슬롯/GUID 수집 후 원하는 순서로 기록 ---
|
||||
slot_to_guid: dict[str, str] = {}
|
||||
slots_in_match_order: list[str] = []
|
||||
|
||||
# 각 페이지 상세 조회
|
||||
for number, slot in matches:
|
||||
cmd_detail = [
|
||||
"racadm", "-r", idrac_ip, "-u", IDRAC_USER or "", "-p", IDRAC_PASS or "",
|
||||
"get", f"InfiniBand.VndrConfigPage.{number}"
|
||||
]
|
||||
output_detail = subprocess.getoutput(" ".join(cmd_detail))
|
||||
|
||||
# PortGUID 추출
|
||||
match_guid = re.search(r"PortGUID=(\S+)", output_detail)
|
||||
port_guid = match_guid.group(1) if match_guid else "Not Found"
|
||||
|
||||
s = str(slot)
|
||||
slot_to_guid[s] = port_guid
|
||||
slots_in_match_order.append(s)
|
||||
|
||||
# 검색된 슬롯 개수에 따라 출력 순서 결정
|
||||
total_slots = len(slots_in_match_order)
|
||||
if total_slots == 4:
|
||||
desired_order = ['38', '37', '32', '34']
|
||||
elif total_slots == 10:
|
||||
desired_order = ['38', '39', '37', '36', '32', '33', '34', '35', '31', '40']
|
||||
else:
|
||||
desired_order = slots_in_match_order
|
||||
|
||||
# 지정된 순서대로 파일에 기록 + GUID 요약 생성
|
||||
hex_guid_list: list[str] = []
|
||||
for s in desired_order:
|
||||
guid = slot_to_guid.get(s, "Not Found")
|
||||
f.write(f"Slot.{s}: {guid}\n")
|
||||
if guid != "Not Found":
|
||||
hex_guid_list.append(f"0x{guid.replace(':', '').upper()}")
|
||||
|
||||
if hex_guid_list:
|
||||
f.write(f"GUID: {';'.join(hex_guid_list)}\n")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error processing IP {idrac_ip}: {e}")
|
||||
|
||||
|
||||
def main(ip_file: str) -> None:
|
||||
ip_path = Path(ip_file)
|
||||
if not ip_path.is_file():
|
||||
print(f"IP file {ip_file} does not exist.")
|
||||
return
|
||||
|
||||
output_dir = resolve_output_dir() # ← 여기서 OS 무관 저장 위치 확정 (data/idrac_info)
|
||||
# print(f"[debug] output_dir = {output_dir}") # 필요 시 확인
|
||||
|
||||
with ip_path.open("r", encoding="utf-8") as file:
|
||||
ip_addresses = [line.strip() for line in file if line.strip()]
|
||||
|
||||
# 스레드풀
|
||||
with ThreadPoolExecutor(max_workers=100) as executor:
|
||||
future_to_ip = {executor.submit(fetch_idrac_info, ip, output_dir): ip for ip in ip_addresses}
|
||||
|
||||
for future in as_completed(future_to_ip):
|
||||
ip = future_to_ip[future]
|
||||
try:
|
||||
future.result()
|
||||
print(f"✅ Completed: {ip}")
|
||||
except Exception as e:
|
||||
print(f"❌ Error processing {ip}: {e}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python script.py <ip_file>")
|
||||
sys.exit(1)
|
||||
|
||||
main(sys.argv[1])
|
||||
55
data/scripts/Systemerase.sh
Normal file
55
data/scripts/Systemerase.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER="root"
|
||||
IDRAC_PASS="calvin"
|
||||
|
||||
# IP 주소 파일 경로 인자 받기
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ip_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP_FILE=$1
|
||||
|
||||
if [ ! -f "$IP_FILE" ]; then
|
||||
echo "IP file $IP_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR="idrac_info"
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
fetch_idrac_info() {
|
||||
local IDRAC_IP=$(cat $IP_FILE)
|
||||
|
||||
# DellEMC Server
|
||||
local set=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS systemerase cryptographicerasepd)
|
||||
|
||||
rm -f $IP_FILE
|
||||
}
|
||||
|
||||
export -f fetch_idrac_info
|
||||
export IDRAC_USER
|
||||
export IDRAC_PASS
|
||||
export OUTPUT_DIR
|
||||
|
||||
# 시작 시간 기록
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
fetch_idrac_info
|
||||
|
||||
# 종료 시간 기록
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
# 소요 시간 계산
|
||||
ELAPSED_TIME=$(($END_TIME - $START_TIME))
|
||||
ELAPSED_HOURS=$(($ELAPSED_TIME / 3600))
|
||||
ELAPSED_MINUTES=$((($ELAPSED_TIME % 3600) / 60))
|
||||
ELAPSED_SECONDS=$(($ELAPSED_TIME % 60))
|
||||
|
||||
echo "설정 완료."
|
||||
echo "수집 완료 시간: $ELAPSED_HOURS 시간, $ELAPSED_MINUTES 분, $ELAPSED_SECONDS 초."
|
||||
156
data/scripts/TYPE11_MAC_info.py
Normal file
156
data/scripts/TYPE11_MAC_info.py
Normal file
@@ -0,0 +1,156 @@
|
||||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
|
||||
# ─────────────────────────────────────────────────────────────
|
||||
# 저장 위치: 이 파일이 data/scripts/ 아래 있다면 → data/idrac_info
|
||||
# 그 외 위치여도 이 파일의 상위 폴더에 idrac_info 생성
|
||||
def resolve_output_dir() -> Path:
|
||||
here = Path(__file__).resolve().parent # 예: .../data/scripts
|
||||
if here.name.lower() == "scripts" and here.parent.name.lower() == "data":
|
||||
base = here.parent # data
|
||||
elif here.name.lower() == "scripts":
|
||||
base = here.parent
|
||||
else:
|
||||
base = here.parent
|
||||
out = base / "idrac_info"
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
return out
|
||||
|
||||
|
||||
# ─────────────────────────────────────────────────────────────
|
||||
# 사용자 이름 및 비밀번호 (Bash 스크립트와 동일하게 하드코딩)
|
||||
IDRAC_USER = "root"
|
||||
IDRAC_PASS = "calvin"
|
||||
|
||||
|
||||
def run(cmd: list[str]) -> str:
|
||||
"""racadm 호출을 간단히 실행 (stdout만 수집)"""
|
||||
try:
|
||||
# join하여 getoutput로 호출 (Bash와 비슷한 동작)
|
||||
return subprocess.getoutput(" ".join(cmd))
|
||||
except Exception as e:
|
||||
return f"" # 실패 시 빈 문자열
|
||||
|
||||
|
||||
def parse_single_value(pattern: str, text: str) -> Optional[str]:
|
||||
m = re.search(pattern, text, flags=re.IGNORECASE)
|
||||
return m.group(1).strip() if m else None
|
||||
|
||||
|
||||
def parse_mac_list_from_lines(text: str, fqdd_key: str) -> Optional[str]:
|
||||
"""
|
||||
특정 FQDD 라인을 찾아 MAC 주소를 반환하는 간단한 도우미.
|
||||
(Bash의 grep/awk 파이프를 정규표현식으로 대체)
|
||||
"""
|
||||
# MAC 주소 패턴
|
||||
mac_pat = r"([0-9A-Fa-f]{2}(?::[0-9A-Fa-f]{2}){5})"
|
||||
# 해당 FQDD 문자열이 포함된 줄과 가까운 곳에서 MAC을 찾는 간단한 방식
|
||||
# (원 스크립트는 awk로 이전 줄을 보는 등 상세하지만 여기선 단순화)
|
||||
block_pat = rf"{re.escape(fqdd_key)}.*?{mac_pat}"
|
||||
m = re.search(block_pat, text, flags=re.IGNORECASE | re.DOTALL)
|
||||
if m:
|
||||
return m.group(1)
|
||||
# 라인 전체에서 MAC만 스캔하는 fallback
|
||||
m2 = re.search(mac_pat, text, flags=re.IGNORECASE)
|
||||
return m2.group(1) if m2 else None
|
||||
|
||||
|
||||
def fetch_idrac_info_one(ip: str, output_dir: Path) -> None:
|
||||
# getsysinfo / hwinventory 호출
|
||||
getsysinfo = run(["racadm", "-r", ip, "-u", IDRAC_USER, "-p", IDRAC_PASS, "getsysinfo"])
|
||||
hwinventory = run(["racadm", "-r", ip, "-u", IDRAC_USER, "-p", IDRAC_PASS, "hwinventory"])
|
||||
|
||||
# 서비스 태그
|
||||
svc_tag = parse_single_value(r"SVC\s*Tag\s*=\s*(\S+)", getsysinfo)
|
||||
if not svc_tag:
|
||||
print(f"Failed to retrieve SVC Tag for IP: {ip}")
|
||||
return
|
||||
|
||||
# iDRAC MAC
|
||||
idrac_mac = parse_single_value(r"MAC Address\s*=\s*([0-9A-Fa-f:]{17})", getsysinfo)
|
||||
|
||||
# NIC.Integrated MAC (1-1-1, 1-2-1)
|
||||
integrated_1 = parse_single_value(r"NIC\.Integrated\.1-1-1.*?([0-9A-Fa-f]{2}(?::[0-9A-Fa-f]{2}){5})",
|
||||
getsysinfo)
|
||||
integrated_2 = parse_single_value(r"NIC\.Integrated\.1-2-1.*?([0-9A-Fa-f]{2}(?::[0-9A-Fa-f]{2}){5})",
|
||||
getsysinfo)
|
||||
|
||||
# Onboard MAC (Embedded 1-1-1, 2-1-1)
|
||||
onboard_1 = parse_single_value(r"NIC\.Embedded\.1-1-1.*?([0-9A-Fa-f]{2}(?::[0-9A-Fa-f]{2}){5})",
|
||||
getsysinfo)
|
||||
onboard_2 = parse_single_value(r"NIC\.Embedded\.2-1-1.*?([0-9A-Fa-f]{2}(?::[0-9A-Fa-f]{2}){5})",
|
||||
getsysinfo)
|
||||
|
||||
# 벤더(메모리/SSD) 첫 글자 모음 (원 스크립트는 uniq+sort+cut -c1)
|
||||
# 여기서는 Manufacturer= 값을 수집해 첫 글자만 취합 후 중복 제거.
|
||||
mem_vendors = re.findall(r"DIMM.*?Manufacturer\s*=\s*(.+)", hwinventory, flags=re.IGNORECASE)
|
||||
mem_vendors = [v.strip() for v in mem_vendors if v.strip()]
|
||||
memory = "".join(sorted(set(v[0] for v in mem_vendors if v)))
|
||||
|
||||
ssd_vendors = re.findall(r"Disk\.Bay.*?Manufacturer\s*=\s*(.+)", hwinventory, flags=re.IGNORECASE)
|
||||
ssd_vendors = [v.strip() for v in ssd_vendors if v.strip()]
|
||||
ssd = "".join(sorted(set(v[0] for v in ssd_vendors if v)))
|
||||
|
||||
# 파일 저장
|
||||
out_file = output_dir / f"{svc_tag}.txt"
|
||||
with out_file.open("w", encoding="utf-8", newline="\n") as f:
|
||||
f.write(f"{svc_tag}\n")
|
||||
f.write(f"{integrated_1 or ''}\n")
|
||||
f.write(f"{integrated_2 or ''}\n")
|
||||
f.write(f"{onboard_1 or ''}\n")
|
||||
f.write(f"{onboard_2 or ''}\n")
|
||||
f.write(f"{idrac_mac or ''}\n")
|
||||
f.write(f"{memory}\n")
|
||||
f.write(f"{ssd}\n")
|
||||
|
||||
|
||||
def main(ip_file: str) -> None:
|
||||
ip_path = Path(ip_file)
|
||||
if not ip_path.is_file():
|
||||
print(f"IP file {ip_file} does not exist.")
|
||||
return
|
||||
|
||||
output_dir = resolve_output_dir()
|
||||
|
||||
# Bash 스크립트는 파일 전체를 cat 하여 '하나의 IP'로 사용했지만,
|
||||
# 여기서는 줄 단위로 모두 처리(한 줄만 있어도 동일하게 동작).
|
||||
ips = [line.strip() for line in ip_path.read_text(encoding="utf-8").splitlines() if line.strip()]
|
||||
if not ips:
|
||||
print("No IP addresses found in the file.")
|
||||
return
|
||||
|
||||
# 순차 처리 (필요하면 ThreadPoolExecutor로 병렬화 가능)
|
||||
for ip in ips:
|
||||
try:
|
||||
fetch_idrac_info_one(ip, output_dir)
|
||||
except Exception as e:
|
||||
print(f"Error processing {ip}: {e}")
|
||||
|
||||
# 원본 Bash는 마지막에 입력 파일 삭제: rm -f $IP_FILE
|
||||
try:
|
||||
ip_path.unlink(missing_ok=True)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
print("정보 수집 완료.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys, time
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python script.py <ip_file>")
|
||||
sys.exit(1)
|
||||
|
||||
start = time.time()
|
||||
main(sys.argv[1])
|
||||
end = time.time()
|
||||
elapsed = int(end - start)
|
||||
h, m, s = elapsed // 3600, (elapsed % 3600) // 60, elapsed % 60
|
||||
print(f"수집 완료 시간: {h} 시간, {m} 분, {s} 초.")
|
||||
264
data/scripts/TYPE11_Server_info.py
Normal file
264
data/scripts/TYPE11_Server_info.py
Normal file
@@ -0,0 +1,264 @@
|
||||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
# ─────────────────────────────────────────────────────────────
|
||||
# 저장 위치: 이 파일이 data/scripts/ 아래 있으면 → data/idrac_info
|
||||
# 그 외여도 이 파일의 상위 폴더에 data/idrac_info 생성
|
||||
def resolve_output_dir() -> Path:
|
||||
here = Path(__file__).resolve().parent
|
||||
# 통상 data/scripts/에 둘 경우 data/idrac_info 로 저장
|
||||
if here.name.lower() == "scripts" and here.parent.name.lower() == "data":
|
||||
base = here.parent # data
|
||||
elif (here / "data").is_dir():
|
||||
base = here / "data"
|
||||
else:
|
||||
base = here # 그래도 현재 기준으로 생성
|
||||
out = base / "idrac_info"
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
return out
|
||||
|
||||
|
||||
# ─────────────────────────────────────────────────────────────
|
||||
# 사용자 이름 및 비밀번호 (Bash 스크립트와 동일)
|
||||
IDRAC_USER = "root"
|
||||
IDRAC_PASS = "calvin"
|
||||
|
||||
|
||||
def sh(cmd: list[str] | str) -> str:
|
||||
"""racadm 호출을 간단히 실행 (stdout만 수집)"""
|
||||
if isinstance(cmd, list):
|
||||
cmd = " ".join(cmd)
|
||||
try:
|
||||
return subprocess.getoutput(cmd)
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
|
||||
def grep_value_line(text: str, key: str, after_eq_strip=True) -> str | None:
|
||||
"""
|
||||
Bash에서 `grep -i "<key>" | awk -F '=' '{print $2}' | tr -d '[:space:]'`
|
||||
에 상응하는 간단 추출기.
|
||||
"""
|
||||
# 대소문자 구분 없이 key를 포함하는 라인을 찾음
|
||||
pat = re.compile(re.escape(key), re.IGNORECASE)
|
||||
for line in text.splitlines():
|
||||
if pat.search(line):
|
||||
if after_eq_strip and "=" in line:
|
||||
return line.split("=", 1)[1].strip().replace(" ", "")
|
||||
return line.strip()
|
||||
return None
|
||||
|
||||
|
||||
def parse_after_eq(text: str, key_regex: str, strip_spaces=True) -> str | None:
|
||||
"""
|
||||
정규표현식으로 키를 찾아 '=' 뒤 값을 추출.
|
||||
ex) key_regex=r"System BIOS Version"
|
||||
"""
|
||||
for line in text.splitlines():
|
||||
# [Key=...] 형식의 줄은 건너뛰기
|
||||
if line.strip().startswith('[') and line.strip().endswith(']'):
|
||||
continue
|
||||
|
||||
if re.search(key_regex, line, flags=re.IGNORECASE):
|
||||
if "=" in line:
|
||||
val = line.split("=", 1)[1]
|
||||
return val.strip().replace(" ", "") if strip_spaces else val.strip()
|
||||
return None
|
||||
|
||||
|
||||
def fetch_idrac_info(ip: str, output_dir: Path) -> None:
|
||||
# 원 스크립트 호출 순서 및 동일 항목 수집
|
||||
hwinventory = sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "hwinventory"])
|
||||
getsysinfo = sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "getsysinfo"])
|
||||
sys_profile = sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "bios.SysProfileSettings"])
|
||||
proc_settings = sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "bios.ProcSettings"])
|
||||
mem_settings = sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "bios.MemSettings"])
|
||||
storage_ctrl = sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "STORAGE.Controller.1"])
|
||||
|
||||
svc_tag = parse_after_eq(getsysinfo, r"SVC\s*Tag")
|
||||
bios_fw = parse_after_eq(getsysinfo, r"System\s*BIOS\s*Version")
|
||||
idrac_fw = parse_after_eq(getsysinfo, r"Firmware\s*Version")
|
||||
intel_nic_fw = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "NIC.FrmwImgMenu.1"]),
|
||||
r"#FamilyVersion")
|
||||
onboard_nic_fw = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "NIC.FrmwImgMenu.5"]),
|
||||
r"#FamilyVersion")
|
||||
raid_fw = parse_after_eq(hwinventory, r"ControllerFirmwareVersion")
|
||||
bios_boot_mode = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "bios.BiosBootSettings"]),
|
||||
r"BootMode")
|
||||
|
||||
# SysProfileSettings 세부
|
||||
sysprof_1 = parse_after_eq(sys_profile, r"SysProfile")
|
||||
sysprof_2 = parse_after_eq(sys_profile, r"EnergyPerformanceBias")
|
||||
sysprof_3 = parse_after_eq(sys_profile, r"MemFrequency")
|
||||
sysprof_4 = parse_after_eq(sys_profile, r"ProcTurboMode")
|
||||
sysprof_5 = parse_after_eq(sys_profile, r"ProcC1E")
|
||||
sysprof_6 = parse_after_eq(sys_profile, r"ProcCStates")
|
||||
sysprof_7 = parse_after_eq(sys_profile, r"MonitorMwait")
|
||||
|
||||
# ProcessorSettings
|
||||
proc_1 = parse_after_eq(proc_settings, r"LogicalProc")
|
||||
proc_2 = parse_after_eq(proc_settings, r"ProcVirtualization")
|
||||
proc_3 = parse_after_eq(proc_settings, r"LlcPrefetch")
|
||||
proc_4 = parse_after_eq(proc_settings, r"ProcX2Apic")
|
||||
|
||||
# MemorySettings
|
||||
mem_1 = parse_after_eq(mem_settings, r"NodeInterleave")
|
||||
mem_2 = parse_after_eq(mem_settings, r"PPROnUCE")
|
||||
mem_3 = parse_after_eq(mem_settings, r"CECriticalSEL")
|
||||
|
||||
# System.ThermalSettings
|
||||
system_thermal = sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "System.ThermalSettings"])
|
||||
system_1 = parse_after_eq(system_thermal, r"ThermalProfile", strip_spaces=False)
|
||||
|
||||
# Bios.IntegratedDevices
|
||||
integ_devs = sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "Bios.IntegratedDevices"])
|
||||
integ_1 = parse_after_eq(integ_devs, r"SriovGlobalEnable")
|
||||
|
||||
# bios.MiscSettings
|
||||
misc = sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "bios.MiscSettings"])
|
||||
misc_1 = parse_after_eq(misc, r"ErrPrompt")
|
||||
|
||||
# iDRAC.* 다양한 설정
|
||||
tz = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.Time.Timezone"]),
|
||||
r"Timezone")
|
||||
active_nic = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.CurrentNIC"]),
|
||||
r"ActiveNIC")
|
||||
ipv4_dhcp = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.CurrentIPv4"]),
|
||||
r"DHCPEnable")
|
||||
ipv6_enable = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.CurrentIPv6"]),
|
||||
r"Enable")
|
||||
redfish_enable = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.Redfish.Enable"]),
|
||||
r"Enable")
|
||||
ssh_enable = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.SSH"]),
|
||||
r"Enable")
|
||||
|
||||
ad_user_domain = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.USERDomain.1.Name"]),
|
||||
r"Name")
|
||||
ad_dc1 = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.ActiveDirectory.DomainController1"]),
|
||||
r"DomainController1")
|
||||
ad_grp1_name = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.ADGroup.1.Name"]),
|
||||
r"Name")
|
||||
ad_grp1_domain = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.ADGroup.1.Domain"]),
|
||||
r"Domain")
|
||||
ad_grp1_priv = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.ADGroup.1.Privilege"]),
|
||||
r"Privilege")
|
||||
ad_grp2_name = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.ADGroup.2.Name"]),
|
||||
r"Name")
|
||||
ad_grp2_domain = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.ADGroup.2.Domain"]),
|
||||
r"Domain")
|
||||
ad_grp2_priv = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.ADGroup.2.Privilege"]),
|
||||
r"Privilege")
|
||||
|
||||
syslog_enable = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.SysLog.SysLogEnable"]),
|
||||
r"SysLogEnable")
|
||||
syslog_s1 = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.SysLog.Server1"]),
|
||||
r"Server1")
|
||||
syslog_s2 = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.SysLog.Server2"]),
|
||||
r"Server2")
|
||||
syslog_port = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.SysLog.Port"]),
|
||||
r"Port")
|
||||
kvm_port = parse_after_eq(sh(["racadm", f"-r{ip}", f"-u{IDRAC_USER}", f"-p{IDRAC_PASS}", "get", "iDRAC.VirtualConsole.Port"]),
|
||||
r"Port")
|
||||
|
||||
if not svc_tag:
|
||||
print(f"Failed to retrieve SVC Tag for IP: {ip}")
|
||||
return
|
||||
|
||||
out_file = output_dir / f"{svc_tag}.txt"
|
||||
with out_file.open("w", encoding="utf-8", newline="\n") as f:
|
||||
f.write(f"Dell EMC Server Bios,iDRAC,R/C Setting (SVC Tag: {svc_tag})\n\n")
|
||||
f.write("------------------------------------------Firware Version 정보------------------------------------------\n")
|
||||
f.write(f"1. SVC Tag : {svc_tag}\n")
|
||||
f.write(f"2. Bios Firmware : {bios_fw or ''}\n")
|
||||
f.write(f"3. iDRAC Firmware Version : {idrac_fw or ''}\n")
|
||||
f.write(f"4. NIC Integrated Firmware Version : {intel_nic_fw or ''}\n")
|
||||
f.write(f"5. OnBoard NIC Firmware Version : {onboard_nic_fw or ''}\n")
|
||||
f.write(f"6. Raid Controller Firmware Version : {raid_fw or ''}\n\n")
|
||||
|
||||
f.write("---------------------------------------------Bios 설정 정보----------------------------------------------\n")
|
||||
f.write(f"01. Bios Boot Mode : {bios_boot_mode or ''}\n")
|
||||
f.write(f"02. System Profile Settings - System Profile : {sysprof_1 or ''}\n")
|
||||
f.write(f"03. System Profile Settings - CPU Power Management : {sysprof_2 or ''}\n")
|
||||
f.write(f"04. System Profile Settings - Memory Frequency : {sysprof_3 or ''}\n")
|
||||
f.write(f"05. System Profile Settings - Turbo Boost : {sysprof_4 or ''}\n")
|
||||
f.write(f"06. System Profile Settings - C1E : {sysprof_5 or ''}\n")
|
||||
f.write(f"07. System Profile Settings - C-States : {sysprof_6 or ''}\n")
|
||||
f.write(f"08. System Profile Settings - Monitor/Mwait : {sysprof_7 or ''}\n")
|
||||
f.write(f"09. Processor Settings - Logical Processor : {proc_1 or ''}\n")
|
||||
f.write(f"10. Processor Settings - Virtualization Technology : {proc_2 or ''}\n")
|
||||
f.write(f"11. Processor Settings - LLC Prefetch : {proc_3 or ''}\n")
|
||||
f.write(f"12. Processor Settings - x2APIC Mode : {proc_4 or ''}\n")
|
||||
f.write(f"13. Memory Settings - Node Interleaving : {mem_1 or ''}\n")
|
||||
f.write(f"14. Memory Settings - DIMM Self Healing (Post Package Repair) on Uncorrectable Memory Error : {mem_2 or ''}\n")
|
||||
f.write(f"15. Memory Settings - Correctable Error Logging : {mem_3 or ''}\n")
|
||||
f.write(f"16. System Settings - Thermal Profile Optimization : {system_1 or ''}\n")
|
||||
f.write(f"17. Integrated Devices Settings - SR-IOV Global Enable : {integ_1 or ''}\n")
|
||||
f.write(f"18. Miscellaneous Settings - F1/F2 Prompt on Error : {misc_1 or ''}\n\n")
|
||||
|
||||
f.write("---------------------------------------------iDRAC 설정 정보----------------------------------------------\n")
|
||||
f.write(f"01. iDRAC Settings - Timezone : {tz or ''}\n")
|
||||
f.write(f"02. iDRAC Settings - IPMI LAN Selection : {active_nic or ''}\n")
|
||||
f.write(f"03. iDRAC Settings - IPMI IP(IPv4) : {ipv4_dhcp or ''}\n")
|
||||
f.write(f"04. iDRAC Settings - IPMI IP(IPv6) : {ipv6_enable or ''}\n")
|
||||
f.write(f"05. iDRAC Settings - Redfish Support : {redfish_enable or ''}\n")
|
||||
f.write(f"06. iDRAC Settings - SSH Support : {ssh_enable or ''}\n")
|
||||
f.write(f"07. iDRAC Settings - AD User Domain Name : {ad_user_domain or ''}\n")
|
||||
f.write(f"08. iDRAC Settings - SC Server Address : {ad_dc1 or ''}\n")
|
||||
f.write(f"09. iDRAC Settings - SE AD RoleGroup Name : {ad_grp1_name or ''}\n")
|
||||
f.write(f"10. iDRAC Settings - SE AD RoleGroup Dome인 : {ad_grp1_domain or ''}\n")
|
||||
f.write(f"11. iDRAC Settings - SE AD RoleGroup Privilege : {ad_grp1_priv or ''}\n")
|
||||
f.write(f"12. iDRAC Settings - IDC AD RoleGroup Name : {ad_grp2_name or ''}\n")
|
||||
f.write(f"13. iDRAC Settings - IDC AD RoleGroup Domain : {ad_grp2_domain or ''}\n")
|
||||
f.write(f"14. iDRAC Settings - IDC AD RoleGroup Privilege : {ad_grp2_priv or ''}\n")
|
||||
f.write(f"15. iDRAC Settings - Remote Log (syslog) : {syslog_enable or ''}\n")
|
||||
f.write(f"16. iDRAC Settings - syslog server address 1 : {syslog_s1 or ''}\n")
|
||||
f.write(f"17. iDRAC Settings - syslog server address 2 : {syslog_s2 or ''}\n")
|
||||
f.write(f"18. iDRAC Settings - syslog server port : {syslog_port or ''}\n")
|
||||
f.write(f"19. iDRAC Settings - Remote KVM Nonsecure port : {kvm_port or ''}\n")
|
||||
|
||||
|
||||
def main(ip_file: str) -> None:
|
||||
ip_path = Path(ip_file)
|
||||
if not ip_path.is_file():
|
||||
print(f"Usage: python script.py <ip_file>\nIP file {ip_file} does not exist.")
|
||||
return
|
||||
|
||||
output_dir = resolve_output_dir()
|
||||
|
||||
# 원 Bash는 cat $IP_FILE → 파일 전체를 하나의 IP처럼 사용(=실질적으로 "한 줄 IP")
|
||||
# 여기서는 첫 번째 비어있지 않은 줄만 사용해 동일하게 동작시킵니다.
|
||||
lines = [ln.strip() for ln in ip_path.read_text(encoding="utf-8", errors="ignore").splitlines()]
|
||||
ip = next((ln for ln in lines if ln), None)
|
||||
if not ip:
|
||||
print("No IP address found in the file.")
|
||||
return
|
||||
|
||||
start = time.time()
|
||||
fetch_idrac_info(ip, output_dir)
|
||||
end = time.time()
|
||||
|
||||
# 입력 파일 삭제 (원 Bash의 rm -f $IP_FILE와 동일)
|
||||
try:
|
||||
ip_path.unlink(missing_ok=True)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
elapsed = int(end - start)
|
||||
h, m, s = elapsed // 3600, (elapsed % 3600) // 60, elapsed % 60
|
||||
print("정보 수집 완료.")
|
||||
print(f"수집 완료 시간: {h} 시간, {m} 분, {s} 초.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python script.py <ip_file>")
|
||||
sys.exit(1)
|
||||
main(sys.argv[1])
|
||||
98
data/scripts/TYPE6-MAC_info.sh
Normal file
98
data/scripts/TYPE6-MAC_info.sh
Normal file
@@ -0,0 +1,98 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER="root"
|
||||
IDRAC_PASS="calvin"
|
||||
|
||||
# IP 주소 파일 경로 인자 받기
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ip_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP_FILE=$1
|
||||
|
||||
if [ ! -f "$IP_FILE" ]; then
|
||||
echo "IP file $IP_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR="idrac_info"
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
fetch_idrac_info() {
|
||||
local IDRAC_IP=$(cat $IP_FILE)
|
||||
|
||||
# 모든 hwinventory 저장
|
||||
local getsysinfo=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS getsysinfo)
|
||||
#local swinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS swinventory)
|
||||
local hwinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS hwinventory)
|
||||
|
||||
#서비스 태그 가져오기
|
||||
local SVC_TAG=$(echo "$getsysinfo" | grep -i "SVC Tag" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
#iDRAC MAC 확인
|
||||
local idrac_mac=$(echo "$getsysinfo" | grep -i "MAC Address = " | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
#NIC.Integrated MAC 확인
|
||||
local Integrated_1=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Integrated_2=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-2-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#추가 NIC MAC 확인
|
||||
#local NIC_Slot_1=$(echo "$swinventory" | awk '/FQDD = NIC.Slot.1-1-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
#local NIC_Slot_2=$(echo "$swinventory" | awk '/FQDD = NIC.Slot.1-2-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#OnBoard MAC 확인
|
||||
local Onboard_1=$(echo "$getsysinfo" | grep -P "NIC.Embedded.1-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Onboard_2=$(echo "$getsysinfo" | grep -P "NIC.Embedded.2-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#파트 벤더 확인
|
||||
local memory=$(echo "$hwinventory" | grep -A5 "DIMM" | grep "Manufacturer" | awk -F '=' '{print $2}' | awk '{$1=$1};1' | sort | uniq | cut -c1)
|
||||
local nvme_m2=$(echo "$hwinventory" | grep -A3 "Disk.Direct" | grep "Manufacturer" | awk -F '= ' '{print $2}' | sort | uniq)
|
||||
local ssd=$(echo "$hwinventory" | grep -A3 "Disk.Bay" | grep "Manufacturer" | awk -F '=' '{print $2}' | awk '{$1=$1};1' | sort | uniq | cut -c1)
|
||||
|
||||
# 서비스 태그가 존재하는지 확인
|
||||
if [ -z "$SVC_TAG" ]; then
|
||||
echo "Failed to retrieve SVC Tag for IP: $IDRAC_IP"
|
||||
return
|
||||
fi
|
||||
|
||||
local OUTPUT_FILE="$OUTPUT_DIR/$SVC_TAG.txt"
|
||||
# SVC Tag 확인
|
||||
echo "$SVC_TAG" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_1" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_2" >> "$OUTPUT_FILE"
|
||||
echo "$Onboard_1" >> "$OUTPUT_FILE"
|
||||
echo "$Onboard_2" >> "$OUTPUT_FILE"
|
||||
echo "$idrac_mac" >> "$OUTPUT_FILE"
|
||||
echo "$memory" >> "$OUTPUT_FILE"
|
||||
echo "$nvme_m2" >> "$OUTPUT_FILE"
|
||||
echo "$ssd" >> "$OUTPUT_FILE"
|
||||
#임시파일 제거
|
||||
rm -f $IP_FILE
|
||||
}
|
||||
|
||||
export -f fetch_idrac_info
|
||||
export IDRAC_USER
|
||||
export IDRAC_PASS
|
||||
export OUTPUT_DIR
|
||||
|
||||
# 시작 시간 기록
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
fetch_idrac_info
|
||||
|
||||
# 종료 시간 기록
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
# 소요 시간 계산
|
||||
ELAPSED_TIME=$(($END_TIME - $START_TIME))
|
||||
ELAPSED_HOURS=$(($ELAPSED_TIME / 3600))
|
||||
ELAPSED_MINUTES=$((($ELAPSED_TIME % 3600) / 60))
|
||||
ELAPSED_SECONDS=$(($ELAPSED_TIME % 60))
|
||||
|
||||
echo "정보 수집 완료."
|
||||
echo "수집 완료 시간: $ELAPSED_HOURS 시간, $ELAPSED_MINUTES 분, $ELAPSED_SECONDS 초."
|
||||
314
data/scripts/TYPE6_Server_info.sh
Normal file
314
data/scripts/TYPE6_Server_info.sh
Normal file
@@ -0,0 +1,314 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER="root"
|
||||
IDRAC_PASS="calvin"
|
||||
|
||||
# IP 주소 파일 경로 인자 받기
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ip_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP_FILE=$1
|
||||
|
||||
if [ ! -f "$IP_FILE" ]; then
|
||||
echo "IP file $IP_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR="idrac_info"
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
fetch_idrac_info() {
|
||||
local IDRAC_IP=$(cat $IP_FILE)
|
||||
|
||||
# 모든 hwinventory 저장
|
||||
local hwinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS hwinventory)
|
||||
# 모든 샷시 정보 저장
|
||||
local getsysinfo=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS getsysinfo)
|
||||
# 모든 SysProfileSettings 저장
|
||||
local SysProfileSettings=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get bios.SysProfileSettings)
|
||||
# ProcessorSettings 저장
|
||||
local ProcessorSettings=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get bios.ProcSettings)
|
||||
# Memory Settings 저장
|
||||
local MemorySettings=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get bios.MemSettings)
|
||||
# Raid Settings 저장
|
||||
local STORAGEController=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get STORAGE.Controller.1)
|
||||
|
||||
# 서비스 태그 가져오기
|
||||
local SVC_TAG=$(echo "$getsysinfo" | grep -i "SVC Tag" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# Bios Firmware Version 확인
|
||||
local Bios_firmware=$(echo "$getsysinfo" | grep -i "System BIOS Version" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Firmware Version 확인
|
||||
local iDRAC_firmware=$(echo "$getsysinfo" | grep -i "Firmware Version" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# Intel NIC Firmware Version 확인
|
||||
local Intel_NIC_firmware=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get NIC.FrmwImgMenu.1 | grep -i "#FamilyVersion" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# OnBoard NIC Firmware Version 확인
|
||||
local Onboard_NIC_firmware=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get NIC.FrmwImgMenu.5 | grep -i "#FamilyVersion" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# R/C Firmware Version 확인
|
||||
local Raid_firmware=$(echo "$hwinventory" | grep -i "ControllerFirmwareVersion" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# Bios 설정 Boot Mode 확인
|
||||
local Bios_BootMode=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get bios.BiosBootSettings | grep -i "BootMode" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# Bios SysProfileSettings 설정 정보 확인
|
||||
local SysProFileSettings_info1=$(echo "$SysProfileSettings" | grep -i "SysProfile=" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local SysProFileSettings_info2=$(echo "$SysProfileSettings" | grep -i "EnergyPerformanceBias" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local SysProFileSettings_info3=$(echo "$SysProfileSettings" | grep -i "MemFrequency" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local SysProFileSettings_info4=$(echo "$SysProfileSettings" | grep -i "ProcTurboMode" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local SysProFileSettings_info5=$(echo "$SysProfileSettings" | grep -i "ProcC1E" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local SysProFileSettings_info6=$(echo "$SysProfileSettings" | grep -i "ProcCStates" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local SysProFileSettings_info7=$(echo "$SysProfileSettings" | grep -i "MonitorMwait" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# Processor Settings - Logical Processor
|
||||
local ProcessorSettings_info1=$(echo "$ProcessorSettings" | grep -i "LogicalProc" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local ProcessorSettings_info2=$(echo "$ProcessorSettings" | grep -i "ProcVirtualization" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local ProcessorSettings_info3=$(echo "$ProcessorSettings" | grep -i "LlcPrefetch" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local ProcessorSettings_info4=$(echo "$ProcessorSettings" | grep -i "ProcX2Apic" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# Memory Settings - Node Interleaving
|
||||
local MemorySettings_info1=$(echo "$MemorySettings" | grep -i "NodeInterleave" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local MemorySettings_info2=$(echo "$MemorySettings" | grep -i "PPROnUCE" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local MemorySettings_info3=$(echo "$MemorySettings" | grep -i "CECriticalSEL" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# System Settings - Thermal Profile Optimization
|
||||
local SystemSettings_info1=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get System.ThermalSettings | grep -i "ThermalProfile" | awk -F '=' '{print $2}')
|
||||
# Integrated Devices Settings - SR-IOV Global Enable
|
||||
local IntegratedDevicesSettings_info1=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get Bios.IntegratedDevices | grep -i "SriovGlobalEnable" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# Miscellaneous Settings - F1/F2 Prompt on Error
|
||||
local IMiscellaneousSettings_info1=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get bios.MiscSettings | grep -i "ErrPrompt" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# iDRAC Settings - Timezone
|
||||
local iDRAC_Settings_info1=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.Time.Timezone | grep -i "Timezone" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - IPMI LAN Selection
|
||||
local iDRAC_Settings_info2=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.CurrentNIC | grep -i "ActiveNIC" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - IPMI IP(IPv4)
|
||||
local iDRAC_Settings_info3=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.CurrentIPv4 | grep -i "DHCPEnable" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - IPMI IP(IPv6)
|
||||
local iDRAC_Settings_info4=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.CurrentIPv6 | grep -i "Enable=" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - Redfish Support
|
||||
local iDRAC_Settings_info5=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.Redfish.Enable | grep -i "Enable=" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - SSH Support
|
||||
local iDRAC_Settings_info6=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.SSH | grep -i "Enable=" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - AD User Domain Name
|
||||
local iDRAC_Settings_info7=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.USERDomain.1.Name | grep -i "Name" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - SC Server Address
|
||||
local iDRAC_Settings_info8=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ActiveDirectory.DomainController1 | grep -i "DomainController1" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - SE AD RoleGroup Name
|
||||
local iDRAC_Settings_info9=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ADGroup.1.Name | grep -i "Name" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - SE AD RoleGroup Dome인
|
||||
local iDRAC_Settings_info10=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ADGroup.1.Domain | grep -i "Domain" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - SE AD RoleGroup Privilege
|
||||
local iDRAC_Settings_info11=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ADGroup.1.Privilege | grep -i "Privilege" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - IDC AD RoleGroup name
|
||||
local iDRAC_Settings_info12=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ADGroup.2.Name | grep -i "Name" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - IDC AD RoleGroup Dome인
|
||||
local iDRAC_Settings_info13=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ADGroup.2.Domain | grep -i "Domain" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - IDC AD RoleGroup Privilege
|
||||
local iDRAC_Settings_info14=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ADGroup.2.Privilege | grep -i "Privilege" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - Remote Log (syslog)
|
||||
local iDRAC_Settings_info15=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.SysLog.SysLogEnable | grep -i "SysLogEnable" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - syslog server address 1
|
||||
local iDRAC_Settings_info16=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.SysLog.Server1 | grep -i "Server1" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - syslog server address 2
|
||||
local iDRAC_Settings_info17=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.SysLog.Server2 | grep -i "Server2" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - syslog server port
|
||||
local iDRAC_Settings_info18=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.SysLog.Port | grep -i "Port" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - VirtualConsole Port
|
||||
local iDRAC_Settings_info19=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.VirtualConsole.Port | grep -i "Port" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# RAID Settings - ProductName
|
||||
local RAID_info0=$(echo "$hwinventory" | grep -i "ProductName = PERC" | awk -F '=' '{print $2}')
|
||||
# RAID Settings - ProductName
|
||||
local RAID_info7=$(echo "$hwinventory" | grep -i "ProductName = BOSS" | awk -F '=' '{print $2}')
|
||||
# RAID Settings - RAIDType
|
||||
local RAID_info1=$(echo "$hwinventory" | grep -i "RAIDTypes" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# RAID Settings - StripeSize
|
||||
local RAID_info2=$(echo "$hwinventory" | grep -i "StripeSize" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# RAID Settings - ReadCachePolicy
|
||||
local RAID_info3=$(echo "$hwinventory" | grep -i "ReadCachePolicy" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# RAID Settings - WriteCachePolicy
|
||||
local RAID_info4=$(echo "$hwinventory" | grep -i "WriteCachePolicy" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# RAID Settings - CheckConsistencyMode
|
||||
local RAID_info5=$(echo "$STORAGEController" | grep -i "CheckConsistencyMode" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# RAID Settings - PatrolReadRate
|
||||
local RAID_info6=$(echo "$STORAGEController" | grep -i "PatrolReadRate" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# 서비스 태그가 존재하는지 확인
|
||||
if [ -z "$SVC_TAG" ]; then
|
||||
echo "Failed to retrieve SVC Tag for IP: $IDRAC_IP"
|
||||
return
|
||||
fi
|
||||
|
||||
local OUTPUT_FILE="$OUTPUT_DIR/$SVC_TAG.txt"
|
||||
echo "Dell EMC Server Bios,iDRAC,R/C Setting (SVC Tag: $SVC_TAG)" | tee -a "$OUTPUT_FILE"
|
||||
echo -e "\n" >> "$OUTPUT_FILE"
|
||||
echo "------------------------------------------Firware Version 정보------------------------------------------" >> "$OUTPUT_FILE"
|
||||
# SVC Tag 확인
|
||||
echo "1. SVC Tag : $SVC_TAG" >> "$OUTPUT_FILE"
|
||||
|
||||
# Bios Firmware Version 확인
|
||||
echo "2. Bios Firmware : $Bios_firmware" >> "$OUTPUT_FILE"
|
||||
|
||||
# iDRAC Firmware Version 확인
|
||||
echo "3. iDRAC Firmware Version : $iDRAC_firmware" >> "$OUTPUT_FILE"
|
||||
|
||||
# Intel NIC Firmware Version 확인
|
||||
echo "4. NIC Integrated Firmware Version : $Intel_NIC_firmware" >> "$OUTPUT_FILE"
|
||||
|
||||
# OnBoard NIC Firmware Version 확인
|
||||
echo "5. OnBoard NIC Firmware Version : $Onboard_NIC_firmware" >> "$OUTPUT_FILE"
|
||||
|
||||
# Raid Controller Firmware Version 확인
|
||||
echo "6. Raid Controller Firmware Version : $Raid_firmware" >> "$OUTPUT_FILE"
|
||||
echo -e "\n" >> "$OUTPUT_FILE"
|
||||
|
||||
echo "---------------------------------------------Bios 설정 정보----------------------------------------------" >> "$OUTPUT_FILE"
|
||||
# bios Boot Mode 확인
|
||||
echo "01. Bios Boot Mode : $Bios_BootMode" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - System Profile
|
||||
echo "02. System Profile Settings - System Profile : $SysProFileSettings_info1" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - CPU Power Management
|
||||
echo "03. System Profile Settings - CPU Power Management : $SysProFileSettings_info2" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - Memory Frequency
|
||||
echo "04. System Profile Settings - Memory Frequency : $SysProFileSettings_info3" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - Turbo Boost
|
||||
echo "05. System Profile Settings - Turbo Boost : $SysProFileSettings_info4" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - C1E
|
||||
echo "06. System Profile Settings - C1E : $SysProFileSettings_info5" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - C-States
|
||||
echo "07. System Profile Settings - C-States : $SysProFileSettings_info6" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - C-States
|
||||
echo "08. System Profile Settings - Monitor/Mwait : $SysProFileSettings_info7" >> "$OUTPUT_FILE"
|
||||
|
||||
# Processor Settings - Logical Processor
|
||||
echo "09. Processor Settings - Logical Processor : $ProcessorSettings_info1" >> "$OUTPUT_FILE"
|
||||
|
||||
# Processor Settings - Virtualization Technology
|
||||
echo "10. Processor Settings - Virtualization Technology : $ProcessorSettings_info2" >> "$OUTPUT_FILE"
|
||||
|
||||
# Processor Settings - LLC Prefetch
|
||||
echo "11. Processor Settings - LLC Prefetch : $ProcessorSettings_info3" >> "$OUTPUT_FILE"
|
||||
|
||||
# Processor Settings - x2APIC Mode
|
||||
echo "12. Processor Settings - x2APIC Mode : $ProcessorSettings_info4" >> "$OUTPUT_FILE"
|
||||
|
||||
# Memory Settings - Node Interleaving
|
||||
echo "13. Memory Settings - Node Interleaving : $MemorySettings_info1" >> "$OUTPUT_FILE"
|
||||
|
||||
# Memory Settings - DIMM Self Healing (Post Package Repair) on Uncorrectable Memory Error
|
||||
echo "14. Memory Settings - DIMM Self Healing (Post Package Repair) on Uncorrectable Memory Error : $MemorySettings_info2" >> "$OUTPUT_FILE"
|
||||
|
||||
# Memory Settings - Correctable Error Logging
|
||||
echo "15. Memory Settings - Correctable Error Logging : $MemorySettings_info3" >> "$OUTPUT_FILE"
|
||||
|
||||
# System Settings - Thermal Profile Optimization
|
||||
echo "16. System Settings - Thermal Profile Optimization : $SystemSettings_info1" >> "$OUTPUT_FILE"
|
||||
|
||||
# Integrated Devices Settings - SR-IOV Global Enable
|
||||
echo "17. Integrated Devices Settings - SR-IOV Global Enable : $IntegratedDevicesSettings_info1" >> "$OUTPUT_FILE"
|
||||
|
||||
# Miscellaneous Settings - F1/F2 Prompt on Error
|
||||
echo "18. Miscellaneous Settings - F1/F2 Prompt on Error : $IMiscellaneousSettings_info1" >> "$OUTPUT_FILE"
|
||||
echo -e "\n" >> "$OUTPUT_FILE"
|
||||
|
||||
echo "---------------------------------------------iDRAC 설정 정보----------------------------------------------" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - Timezone
|
||||
echo "01. iDRAC Settings - Timezone : $iDRAC_Settings_info1" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - IPMI LAN Selection
|
||||
echo "02. iDRAC Settings - IPMI LAN Selection : $iDRAC_Settings_info2" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - IPMI IP(IPv4)
|
||||
echo "03. iDRAC Settings - IPMI IP(IPv4) : $iDRAC_Settings_info3" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - IPMI IP(IPv6)
|
||||
echo "04. iDRAC Settings - IPMI IP(IPv6) : $iDRAC_Settings_info4" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - Redfish Support
|
||||
echo "05. iDRAC Settings - Redfish Support : $iDRAC_Settings_info5" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SSH Support
|
||||
echo "06. iDRAC Settings - SSH Support : $iDRAC_Settings_info6" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - AD User Domain Name
|
||||
echo "07. iDRAC Settings - AD User Domain Name : $iDRAC_Settings_info7" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SC Server Address
|
||||
echo "08. iDRAC Settings - SC Server Address : $iDRAC_Settings_info8" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SE AD RoleGroup Name
|
||||
echo "09. iDRAC Settings - SE AD RoleGroup Name : $iDRAC_Settings_info9" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SE AD RoleGroup Dome인
|
||||
echo "10. iDRAC Settings - SE AD RoleGroup Dome인 : $iDRAC_Settings_info10" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SE AD RoleGroup Privilege
|
||||
echo "11. iDRAC Settings - SE AD RoleGroup Privilege : $iDRAC_Settings_info11" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SE IDC RoleGroup Name
|
||||
echo "12. iDRAC Settings - IDC AD RoleGroup Name : $iDRAC_Settings_info12" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SE IDC RoleGroup Dome인
|
||||
echo "13. iDRAC Settings - IDC AD RoleGroup Domain : $iDRAC_Settings_info13" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SE IDC RoleGroup Dome인
|
||||
echo "14. iDRAC Settings - IDC AD RoleGroup Privilege : $iDRAC_Settings_info14" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - Remote Log (syslog)
|
||||
echo "15. iDRAC Settings - Remote Log (syslog) : $iDRAC_Settings_info15" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - Remote Log (syslog)
|
||||
echo "16. iDRAC Settings - syslog server address 1 : $iDRAC_Settings_info16" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - Remote Log (syslog)
|
||||
echo "17. iDRAC Settings - syslog server address 2 : $iDRAC_Settings_info17" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - syslog server port
|
||||
echo "18. iDRAC Settings - syslog server port : $iDRAC_Settings_info18" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - Remote KVM Nonsecure port
|
||||
echo "19. iDRAC Settings - Remote KVM Nonsecure port : $iDRAC_Settings_info19" >> "$OUTPUT_FILE"
|
||||
echo -e "\n" >> "$OUTPUT_FILE"
|
||||
|
||||
echo "---------------------------------------------Raid 설정 정보----------------------------------------------" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - Raid Types
|
||||
echo "01. RAID Settings - Raid ProductName : $RAID_info7, $RAID_info0" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - Raid Types
|
||||
echo "02. RAID Settings - Raid Typest(NVMe) : $RAID_info1" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - StripeSize
|
||||
echo "03. RAID Settings - StripeSize(NVMe) : $RAID_info2" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - ReadCachePolicy
|
||||
echo "04. RAID Settings - ReadCachePolicy(NVMe) : $RAID_info3" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - ReadCachePolicy
|
||||
echo "05. RAID Settings - WriteCachePolicy(NVMe) : $RAID_info4" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - CheckConsistencyMode
|
||||
echo "06. RAID Settings - CheckConsistencyMode : $RAID_info5" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - PatrolReadMode
|
||||
echo "07. RAID Settings - PatrolReadRate : $RAID_info6" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - period
|
||||
echo "08. RAID Settings - period : 168h" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - Power Save
|
||||
echo "09. RAID Settings - Power Save : No" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - JBODMODE
|
||||
echo "10. RAID Settings - JBODMODE : Controller does not support JBOD" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - maxconcurrentpd
|
||||
echo "11. RAID Settings - maxconcurrentpd : 240" >> "$OUTPUT_FILE"
|
||||
|
||||
# 임시 파일 삭제
|
||||
rm -f $IP_FILE
|
||||
}
|
||||
|
||||
export -f fetch_idrac_info
|
||||
export IDRAC_USER
|
||||
export IDRAC_PASS
|
||||
export OUTPUT_DIR
|
||||
|
||||
# 시작 시간 기록
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
fetch_idrac_info
|
||||
|
||||
# 종료 시간 기록
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
# 소요 시간 계산
|
||||
ELAPSED_TIME=$(($END_TIME - $START_TIME))
|
||||
ELAPSED_HOURS=$(($ELAPSED_TIME / 3600))
|
||||
ELAPSED_MINUTES=$((($ELAPSED_TIME % 3600) / 60))
|
||||
ELAPSED_SECONDS=$(($ELAPSED_TIME % 60))
|
||||
|
||||
echo "정보 수집 완료."
|
||||
echo "수집 완료 시간: $ELAPSED_HOURS 시간, $ELAPSED_MINUTES 분, $ELAPSED_SECONDS 초."
|
||||
98
data/scripts/TYPE8A-MAC_info.sh
Normal file
98
data/scripts/TYPE8A-MAC_info.sh
Normal file
@@ -0,0 +1,98 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER="root"
|
||||
IDRAC_PASS="calvin"
|
||||
|
||||
# IP 주소 파일 경로 인자 받기
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ip_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP_FILE=$1
|
||||
|
||||
if [ ! -f "$IP_FILE" ]; then
|
||||
echo "IP file $IP_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR="idrac_info"
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
fetch_idrac_info() {
|
||||
local IDRAC_IP=$(cat $IP_FILE)
|
||||
|
||||
# 모든 hwinventory 저장
|
||||
local getsysinfo=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS getsysinfo)
|
||||
#local swinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS swinventory)
|
||||
local hwinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS hwinventory)
|
||||
|
||||
#서비스 태그 가져오기
|
||||
local SVC_TAG=$(echo "$getsysinfo" | grep -i "SVC Tag" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
#iDRAC MAC 확인
|
||||
local idrac_mac=$(echo "$getsysinfo" | grep -i "MAC Address = " | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
#NIC.Integrated MAC 확인
|
||||
local Integrated_1=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Integrated_2=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-2-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#추가 NIC MAC 확인
|
||||
#local NIC_Slot_1=$(echo "$swinventory" | awk '/FQDD = NIC.Slot.1-1-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
#local NIC_Slot_2=$(echo "$swinventory" | awk '/FQDD = NIC.Slot.1-2-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#OnBoard MAC 확인
|
||||
local Onboard_1=$(echo "$getsysinfo" | grep -P "NIC.Embedded.1-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Onboard_2=$(echo "$getsysinfo" | grep -P "NIC.Embedded.2-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#파트 벤더 확인
|
||||
local memory=$(echo "$hwinventory" | grep -A5 "DIMM" | grep "Manufacturer" | awk -F '=' '{print $2}' | awk '{$1=$1};1' | sort | uniq | cut -c1)
|
||||
local nvme_m2=$(echo "$hwinventory" | grep -A3 "Disk.Direct" | grep "Manufacturer" | awk -F '= ' '{print $2}' | sort | uniq)
|
||||
local ssd=$(echo "$hwinventory" | grep -A3 "Disk.Bay" | grep "Manufacturer" | awk -F '=' '{print $2}' | awk '{$1=$1};1' | sort | uniq | cut -c1)
|
||||
|
||||
# 서비스 태그가 존재하는지 확인
|
||||
if [ -z "$SVC_TAG" ]; then
|
||||
echo "Failed to retrieve SVC Tag for IP: $IDRAC_IP"
|
||||
return
|
||||
fi
|
||||
|
||||
local OUTPUT_FILE="$OUTPUT_DIR/$SVC_TAG.txt"
|
||||
# SVC Tag 확인
|
||||
echo "$SVC_TAG" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_1" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_2" >> "$OUTPUT_FILE"
|
||||
echo "$Onboard_1" >> "$OUTPUT_FILE"
|
||||
echo "$Onboard_2" >> "$OUTPUT_FILE"
|
||||
echo "$idrac_mac" >> "$OUTPUT_FILE"
|
||||
echo "$memory" >> "$OUTPUT_FILE"
|
||||
echo "$nvme_m2" >> "$OUTPUT_FILE"
|
||||
echo "$ssd" >> "$OUTPUT_FILE"
|
||||
#임시파일 제거
|
||||
rm -f $IP_FILE
|
||||
}
|
||||
|
||||
export -f fetch_idrac_info
|
||||
export IDRAC_USER
|
||||
export IDRAC_PASS
|
||||
export OUTPUT_DIR
|
||||
|
||||
# 시작 시간 기록
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
fetch_idrac_info
|
||||
|
||||
# 종료 시간 기록
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
# 소요 시간 계산
|
||||
ELAPSED_TIME=$(($END_TIME - $START_TIME))
|
||||
ELAPSED_HOURS=$(($ELAPSED_TIME / 3600))
|
||||
ELAPSED_MINUTES=$((($ELAPSED_TIME % 3600) / 60))
|
||||
ELAPSED_SECONDS=$(($ELAPSED_TIME % 60))
|
||||
|
||||
echo "정보 수집 완료."
|
||||
echo "수집 완료 시간: $ELAPSED_HOURS 시간, $ELAPSED_MINUTES 분, $ELAPSED_SECONDS 초."
|
||||
316
data/scripts/TYPE8A_Server_info.sh
Normal file
316
data/scripts/TYPE8A_Server_info.sh
Normal file
@@ -0,0 +1,316 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER="root"
|
||||
IDRAC_PASS="calvin"
|
||||
|
||||
# IP 주소 파일 경로 인자 받기
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ip_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP_FILE=$1
|
||||
|
||||
if [ ! -f "$IP_FILE" ]; then
|
||||
echo "IP file $IP_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR="idrac_info"
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
fetch_idrac_info() {
|
||||
local IDRAC_IP=$(cat $IP_FILE)
|
||||
|
||||
# 모든 hwinventory 저장
|
||||
local hwinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS hwinventory)
|
||||
# 모든 샷시 정보 저장
|
||||
local getsysinfo=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS getsysinfo)
|
||||
# 모든 SysProfileSettings 저장
|
||||
local SysProfileSettings=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get bios.SysProfileSettings)
|
||||
# ProcessorSettings 저장
|
||||
local ProcessorSettings=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get bios.ProcSettings)
|
||||
# Memory Settings 저장
|
||||
local MemorySettings=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get bios.MemSettings)
|
||||
# Raid Settings 저장
|
||||
local STORAGEController=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get STORAGE.Controller.1)
|
||||
|
||||
# 서비스 태그 가져오기
|
||||
local SVC_TAG=$(echo "$getsysinfo" | grep -i "SVC Tag" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# Bios Firmware Version 확인
|
||||
local Bios_firmware=$(echo "$getsysinfo" | grep -i "System BIOS Version" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Firmware Version 확인
|
||||
local iDRAC_firmware=$(echo "$getsysinfo" | grep -i "Firmware Version" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# Intel NIC Firmware Version 확인
|
||||
local Intel_NIC_firmware=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get NIC.FrmwImgMenu.1 | grep -i "#FamilyVersion" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# OnBoard NIC Firmware Version 확인
|
||||
local Onboard_NIC_firmware=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get NIC.FrmwImgMenu.5 | grep -i "#FamilyVersion" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# R/C Firmware Version 확인
|
||||
local Raid_firmware=$(echo "$hwinventory" | grep -i "ControllerFirmwareVersion" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# Bios 설정 Boot Mode 확인
|
||||
local Bios_BootMode=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get bios.BiosBootSettings | grep -i "BootMode" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# Bios SysProfileSettings 설정 정보 확인
|
||||
local SysProFileSettings_info1=$(echo "$SysProfileSettings" | grep -i "SysProfile=" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local SysProFileSettings_info2=$(echo "$SysProfileSettings" | grep -i "ProcPwrPerf" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local SysProFileSettings_info3=$(echo "$SysProfileSettings" | grep -i "MemFrequency" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local SysProFileSettings_info4=$(echo "$SysProfileSettings" | grep -i "ProcTurboMode" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local SysProFileSettings_info5=$(echo "$SysProfileSettings" | grep -i "PcieAspmL1" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local SysProFileSettings_info6=$(echo "$SysProfileSettings" | grep -i "ProcCStates" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local SysProFileSettings_info7=$(echo "$SysProfileSettings" | grep -i "DeterminismSlider" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local SysProFileSettings_info8=$(echo "$SysProfileSettings" | grep -i "DynamicLinkWidthManagement" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# Processor Settings - Logical Processor
|
||||
local ProcessorSettings_info1=$(echo "$ProcessorSettings" | grep -i "LogicalProc" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local ProcessorSettings_info2=$(echo "$ProcessorSettings" | grep -i "ProcVirtualization" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local ProcessorSettings_info3=$(echo "$ProcessorSettings" | grep -i "NumaNodesPerSocket" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local ProcessorSettings_info4=$(echo "$ProcessorSettings" | grep -i "ProcX2Apic" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# Memory Settings - Node Interleaving
|
||||
local MemorySettings_info1=$(echo "$MemorySettings" | grep -i "DramRefreshDelay" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local MemorySettings_info2=$(echo "$MemorySettings" | grep -i "PPROnUCE" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
local MemorySettings_info3=$(echo "$MemorySettings" | grep -i "CECriticalSEL" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# System Settings - Thermal Profile Optimization
|
||||
local SystemSettings_info1=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get System.ThermalSettings | grep -i "ThermalProfile" | awk -F '=' '{print $2}')
|
||||
# Integrated Devices Settings - SR-IOV Global Enable
|
||||
local IntegratedDevicesSettings_info1=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get Bios.IntegratedDevices | grep -i "SriovGlobalEnable" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# Miscellaneous Settings - F1/F2 Prompt on Error
|
||||
local IMiscellaneousSettings_info1=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get bios.MiscSettings | grep -i "ErrPrompt" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# iDRAC Settings - Timezone
|
||||
local iDRAC_Settings_info1=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.Time.Timezone | grep -i "Timezone" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - IPMI LAN Selection
|
||||
local iDRAC_Settings_info2=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.CurrentNIC | grep -i "ActiveNIC" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - IPMI IP(IPv4)
|
||||
local iDRAC_Settings_info3=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.CurrentIPv4 | grep -i "DHCPEnable" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - IPMI IP(IPv6)
|
||||
local iDRAC_Settings_info4=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.CurrentIPv6 | grep -i "Enable=" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - Redfish Support
|
||||
local iDRAC_Settings_info5=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.Redfish.Enable | grep -i "Enable=" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - SSH Support
|
||||
local iDRAC_Settings_info6=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.SSH | grep -i "Enable=" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - AD User Domain Name
|
||||
local iDRAC_Settings_info7=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.USERDomain.1.Name | grep -i "Name" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - SC Server Address
|
||||
local iDRAC_Settings_info8=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ActiveDirectory.DomainController1 | grep -i "DomainController1" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - SE AD RoleGroup Name
|
||||
local iDRAC_Settings_info9=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ADGroup.1.Name | grep -i "Name" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - SE AD RoleGroup Dome인
|
||||
local iDRAC_Settings_info10=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ADGroup.1.Domain | grep -i "Domain" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - SE AD RoleGroup Privilege
|
||||
local iDRAC_Settings_info11=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ADGroup.1.Privilege | grep -i "Privilege" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - IDC AD RoleGroup name
|
||||
local iDRAC_Settings_info12=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ADGroup.2.Name | grep -i "Name" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - IDC AD RoleGroup Dome인
|
||||
local iDRAC_Settings_info13=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ADGroup.2.Domain | grep -i "Domain" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - IDC AD RoleGroup Privilege
|
||||
local iDRAC_Settings_info14=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.ADGroup.2.Privilege | grep -i "Privilege" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - Remote Log (syslog)
|
||||
local iDRAC_Settings_info15=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.SysLog.SysLogEnable | grep -i "SysLogEnable" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - syslog server address 1
|
||||
local iDRAC_Settings_info16=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.SysLog.Server1 | grep -i "Server1" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - syslog server address 2
|
||||
local iDRAC_Settings_info17=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.SysLog.Server2 | grep -i "Server2" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - syslog server port
|
||||
local iDRAC_Settings_info18=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.SysLog.Port | grep -i "Port" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# iDRAC Settings - VirtualConsole Port
|
||||
local iDRAC_Settings_info19=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS get iDRAC.VirtualConsole.Port | grep -i "Port" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# RAID Settings - ProductName
|
||||
local RAID_info0=$(echo "$hwinventory" | grep -i "ProductName = PERC" | awk -F '=' '{print $2}')
|
||||
# RAID Settings - RAIDType
|
||||
local RAID_info1=$(echo "$hwinventory" | grep -i "RAIDTypes" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# RAID Settings - StripeSize
|
||||
local RAID_info2=$(echo "$hwinventory" | grep -i "StripeSize" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# RAID Settings - ReadCachePolicy
|
||||
local RAID_info3=$(echo "$hwinventory" | grep -i "ReadCachePolicy" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# RAID Settings - WriteCachePolicy
|
||||
local RAID_info4=$(echo "$hwinventory" | grep -i "WriteCachePolicy" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# RAID Settings - PatrolReadRate
|
||||
local RAID_info5=$(echo "$STORAGEController" | grep -i "CheckConsistencyRate" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
# RAID Settings - PatrolReadRate
|
||||
local RAID_info6=$(echo "$STORAGEController" | grep -i "PatrolReadMode" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
# 서비스 태그가 존재하는지 확인
|
||||
if [ -z "$SVC_TAG" ]; then
|
||||
echo "Failed to retrieve SVC Tag for IP: $IDRAC_IP"
|
||||
return
|
||||
fi
|
||||
|
||||
local OUTPUT_FILE="$OUTPUT_DIR/$SVC_TAG.txt"
|
||||
echo "Dell EMC Server Bios,iDRAC,R/C Setting (SVC Tag: $SVC_TAG)" | tee -a "$OUTPUT_FILE"
|
||||
echo -e "\n" >> "$OUTPUT_FILE"
|
||||
echo "------------------------------------------Firware Version 정보------------------------------------------" >> "$OUTPUT_FILE"
|
||||
# SVC Tag 확인
|
||||
echo "1. SVC Tag : $SVC_TAG" >> "$OUTPUT_FILE"
|
||||
|
||||
# Bios Firmware Version 확인
|
||||
echo "2. Bios Firmware : $Bios_firmware" >> "$OUTPUT_FILE"
|
||||
|
||||
# iDRAC Firmware Version 확인
|
||||
echo "3. iDRAC Firmware Version : $iDRAC_firmware" >> "$OUTPUT_FILE"
|
||||
|
||||
# Intel NIC Firmware Version 확인
|
||||
echo "4. NIC Integrated Firmware Version : $Intel_NIC_firmware" >> "$OUTPUT_FILE"
|
||||
|
||||
# OnBoard NIC Firmware Version 확인
|
||||
echo "5. OnBoard NIC Firmware Version : $Onboard_NIC_firmware" >> "$OUTPUT_FILE"
|
||||
|
||||
# Raid Controller Firmware Version 확인
|
||||
echo "6. Raid Controller Firmware Version : $Raid_firmware" >> "$OUTPUT_FILE"
|
||||
echo -e "\n" >> "$OUTPUT_FILE"
|
||||
|
||||
echo "---------------------------------------------Bios 설정 정보----------------------------------------------" >> "$OUTPUT_FILE"
|
||||
# bios Boot Mode 확인
|
||||
echo "01. Bios Boot Mode : $Bios_BootMode" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - System Profile
|
||||
echo "02. System Profile Settings - System Profile : $SysProFileSettings_info1" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - CPU Power Management
|
||||
echo "03. System Profile Settings - CPU Power Management : $SysProFileSettings_info2" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - Memory Frequency
|
||||
echo "04. System Profile Settings - Memory Frequency : $SysProFileSettings_info3" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - Turbo Boost
|
||||
echo "05. System Profile Settings - Turbo Boost : $SysProFileSettings_info4" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - C1E
|
||||
echo "06. System Profile Settings - PCI ASPM L1 Link Power Management : $SysProFileSettings_info5" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - C-States
|
||||
echo "07. System Profile Settings - C-States : $SysProFileSettings_info6" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - Determinism Slider
|
||||
echo "08. System Profile Settings - Determinism Slider : $SysProFileSettings_info7" >> "$OUTPUT_FILE"
|
||||
|
||||
# SysProfileSettings - Dynamic Link Width Management (DLWM)
|
||||
echo "08. System Profile Settings - Dynamic Link Width Management (DLWM) : $SysProFileSettings_info8" >> "$OUTPUT_FILE"
|
||||
|
||||
# Processor Settings - Logical Processor
|
||||
echo "09. Processor Settings - Logical Processor : $ProcessorSettings_info1" >> "$OUTPUT_FILE"
|
||||
|
||||
# Processor Settings - Virtualization Technology
|
||||
echo "10. Processor Settings - Virtualization Technology : $ProcessorSettings_info2" >> "$OUTPUT_FILE"
|
||||
|
||||
# Processor Settings - NUMA Nodes Per Socket
|
||||
echo "11. Processor Settings - NUMA Nodes Per Socket : $ProcessorSettings_info3" >> "$OUTPUT_FILE"
|
||||
|
||||
# Processor Settings - x2APIC Mode
|
||||
echo "12. Processor Settings - x2APIC Mode : $ProcessorSettings_info4" >> "$OUTPUT_FILE"
|
||||
|
||||
# Memory Settings - Dram Refresh Delayg
|
||||
echo "13. Memory Settings - Dram Refresh Delay : $MemorySettings_info1" >> "$OUTPUT_FILE"
|
||||
|
||||
# Memory Settings - DIMM Self Healing (Post Package Repair) on Uncorrectable Memory Error
|
||||
echo "14. Memory Settings - DIMM Self Healing (Post Package Repair) on Uncorrectable Memory Error : $MemorySettings_info2" >> "$OUTPUT_FILE"
|
||||
|
||||
# Memory Settings - Correctable Error Logging
|
||||
echo "15. Memory Settings - Correctable Error Logging : $MemorySettings_info3" >> "$OUTPUT_FILE"
|
||||
|
||||
# System Settings - Thermal Profile Optimization
|
||||
echo "16. System Settings - Thermal Profile Optimization : $SystemSettings_info1" >> "$OUTPUT_FILE"
|
||||
|
||||
# Integrated Devices Settings - SR-IOV Global Enable
|
||||
echo "17. Integrated Devices Settings - SR-IOV Global Enable : $IntegratedDevicesSettings_info1" >> "$OUTPUT_FILE"
|
||||
|
||||
# Miscellaneous Settings - F1/F2 Prompt on Error
|
||||
echo "18. Miscellaneous Settings - F1/F2 Prompt on Error : $IMiscellaneousSettings_info1" >> "$OUTPUT_FILE"
|
||||
echo -e "\n" >> "$OUTPUT_FILE"
|
||||
|
||||
echo "---------------------------------------------iDRAC 설정 정보----------------------------------------------" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - Timezone
|
||||
echo "01. iDRAC Settings - Timezone : $iDRAC_Settings_info1" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - IPMI LAN Selection
|
||||
echo "02. iDRAC Settings - IPMI LAN Selection : $iDRAC_Settings_info2" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - IPMI IP(IPv4)
|
||||
echo "03. iDRAC Settings - IPMI IP(IPv4) : $iDRAC_Settings_info3" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - IPMI IP(IPv6)
|
||||
echo "04. iDRAC Settings - IPMI IP(IPv6) : $iDRAC_Settings_info4" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - Redfish Support
|
||||
echo "05. iDRAC Settings - Redfish Support : $iDRAC_Settings_info5" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SSH Support
|
||||
echo "06. iDRAC Settings - SSH Support : $iDRAC_Settings_info6" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - AD User Domain Name
|
||||
echo "07. iDRAC Settings - AD User Domain Name : $iDRAC_Settings_info7" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SC Server Address
|
||||
echo "08. iDRAC Settings - SC Server Address : $iDRAC_Settings_info8" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SE AD RoleGroup Name
|
||||
echo "09. iDRAC Settings - SE AD RoleGroup Name : $iDRAC_Settings_info9" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SE AD RoleGroup Dome인
|
||||
echo "10. iDRAC Settings - SE AD RoleGroup Dome인 : $iDRAC_Settings_info10" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SE AD RoleGroup Privilege
|
||||
echo "11. iDRAC Settings - SE AD RoleGroup Privilege : $iDRAC_Settings_info11" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SE IDC RoleGroup Name
|
||||
echo "12. iDRAC Settings - IDC AD RoleGroup Name : $iDRAC_Settings_info12" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SE IDC RoleGroup Dome인
|
||||
echo "13. iDRAC Settings - IDC AD RoleGroup Domain : $iDRAC_Settings_info13" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - SE IDC RoleGroup Dome인
|
||||
echo "14. iDRAC Settings - IDC AD RoleGroup Privilege : $iDRAC_Settings_info14" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - Remote Log (syslog)
|
||||
echo "15. iDRAC Settings - Remote Log (syslog) : $iDRAC_Settings_info15" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - Remote Log (syslog)
|
||||
echo "16. iDRAC Settings - syslog server address 1 : $iDRAC_Settings_info16" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - Remote Log (syslog)
|
||||
echo "17. iDRAC Settings - syslog server address 2 : $iDRAC_Settings_info17" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - syslog server port
|
||||
echo "18. iDRAC Settings - syslog server port : $iDRAC_Settings_info18" >> "$OUTPUT_FILE"
|
||||
# iDRAC Settings - Remote KVM Nonsecure port
|
||||
echo "19. iDRAC Settings - Remote KVM Nonsecure port : $iDRAC_Settings_info19" >> "$OUTPUT_FILE"
|
||||
echo -e "\n" >> "$OUTPUT_FILE"
|
||||
|
||||
# echo "---------------------------------------------Raid 설정 정보----------------------------------------------" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - Raid Types
|
||||
#echo "01. RAID Settings - Raid ProductName : $RAID_info0" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - Raid Types
|
||||
#echo "02. RAID Settings - Raid Typest : $RAID_info1" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - StripeSize
|
||||
#echo "03. RAID Settings - StripeSize : $RAID_info2" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - ReadCachePolicy
|
||||
#echo "04. RAID Settings - ReadCachePolicy : $RAID_info3" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - ReadCachePolicy
|
||||
#echo "05. RAID Settings - WriteCachePolicy : $RAID_info4" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - CheckConsistencyRate
|
||||
#echo "06. RAID Settings - CheckConsistencyRate : $RAID_info5" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - PatrolReadMode
|
||||
#echo "07. RAID Settings - PatrolReadMode : $RAID_info6" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - period
|
||||
#echo "08. RAID Settings - period : 168h" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - Power Save
|
||||
#echo "09. RAID Settings - Power Save : No" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - JBODMODE
|
||||
#echo "10. RAID Settings - JBODMODE : Controller does not support JBOD" >> "$OUTPUT_FILE"
|
||||
# RAID Settings - maxconcurrentpd
|
||||
#echo "11. RAID Settings - maxconcurrentpd : 240" >> "$OUTPUT_FILE"
|
||||
|
||||
# 임시 파일 삭제
|
||||
rm -f $IP_FILE
|
||||
}
|
||||
|
||||
export -f fetch_idrac_info
|
||||
export IDRAC_USER
|
||||
export IDRAC_PASS
|
||||
export OUTPUT_DIR
|
||||
|
||||
# 시작 시간 기록
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
fetch_idrac_info
|
||||
|
||||
# 종료 시간 기록
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
# 소요 시간 계산
|
||||
ELAPSED_TIME=$(($END_TIME - $START_TIME))
|
||||
ELAPSED_HOURS=$(($ELAPSED_TIME / 3600))
|
||||
ELAPSED_MINUTES=$((($ELAPSED_TIME % 3600) / 60))
|
||||
ELAPSED_SECONDS=$(($ELAPSED_TIME % 60))
|
||||
|
||||
echo "정보 수집 완료."
|
||||
echo "수집 완료 시간: $ELAPSED_HOURS 시간, $ELAPSED_MINUTES 분, $ELAPSED_SECONDS 초."
|
||||
120
data/scripts/XE9680_H100_IB_4EA_MAC_info.sh
Normal file
120
data/scripts/XE9680_H100_IB_4EA_MAC_info.sh
Normal file
@@ -0,0 +1,120 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER="root"
|
||||
IDRAC_PASS="calvin"
|
||||
|
||||
# IP 주소 파일 경로 인자 받기
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ip_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP_FILE=$1
|
||||
|
||||
if [ ! -f "$IP_FILE" ]; then
|
||||
echo "IP file $IP_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR="idrac_info"
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
fetch_idrac_info() {
|
||||
local IDRAC_IP=$(cat $IP_FILE)
|
||||
|
||||
# 모든 hwinventory 저장
|
||||
local getsysinfo=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS getsysinfo)
|
||||
local swinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS swinventory)
|
||||
local hwinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS hwinventory)
|
||||
|
||||
#서비스 태그 가져오기
|
||||
local SVC_TAG=$(echo "$getsysinfo" | grep -i "SVC Tag" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
#iDRAC MAC 확인
|
||||
local idrac_mac=$(echo "$getsysinfo" | grep -i "MAC Address = " | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
#NIC.Integrated MAC 확인
|
||||
local Integrated_1=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Integrated_2=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-2-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Integrated_3=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-3-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Integrated_4=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-4-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#NIC.Slot.31 MAC 확인
|
||||
local NICslot31_1=$(echo "$swinventory" | awk '/FQDD = NIC.Slot.31-1-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local NICslot31_2=$(echo "$swinventory" | awk '/FQDD = NIC.Slot.31-2-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#NIC.Slot.40 MAC 확인
|
||||
local NICslot40_1=$(echo "$swinventory" | awk '/FQDD = NIC.Slot.40-1-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local NICslot40_2=$(echo "$swinventory" | awk '/FQDD = NIC.Slot.40-2-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
|
||||
#추가 NIC MAC 확인
|
||||
local InfiniBand_Slot_32=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.32-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local InfiniBand_Slot_34=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.34-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local InfiniBand_Slot_37=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.37-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local InfiniBand_Slot_38=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.38-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
|
||||
#OnBoard MAC 확인
|
||||
local Onboard_1=$(echo "$getsysinfo" | grep -P "NIC.Embedded.1-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Onboard_2=$(echo "$getsysinfo" | grep -P "NIC.Embedded.2-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#파트 벤더 확인
|
||||
local memory=$(echo "$hwinventory" | grep -A5 "DIMM" | grep "Manufacturer" | awk -F '=' '{print $2}' | awk '{$1=$1};1' | sort | uniq | cut -c1)
|
||||
local ssd=$(echo "$hwinventory" | grep -A3 "Disk.Bay" | grep "Manufacturer" | awk -F '=' '{print $2}' | awk '{$1=$1};1' | sort | uniq)
|
||||
|
||||
# 서비스 태그가 존재하는지 확인
|
||||
if [ -z "$SVC_TAG" ]; then
|
||||
echo "Failed to retrieve SVC Tag for IP: $IDRAC_IP"
|
||||
return
|
||||
fi
|
||||
|
||||
local OUTPUT_FILE="$OUTPUT_DIR/$SVC_TAG.txt"
|
||||
# 정보저장
|
||||
echo "$SVC_TAG" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_1" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_2" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_3" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_4" >> "$OUTPUT_FILE"
|
||||
echo "$Onboard_1" >> "$OUTPUT_FILE"
|
||||
echo "$Onboard_2" >> "$OUTPUT_FILE"
|
||||
echo "$NICslot31_1" >> "$OUTPUT_FILE"
|
||||
echo "$NICslot31_2" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_38" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_37" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_32" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_34" >> "$OUTPUT_FILE"
|
||||
echo "$NICslot40_1" >> "$OUTPUT_FILE"
|
||||
echo "$NICslot40_2" >> "$OUTPUT_FILE"
|
||||
echo "$idrac_mac" >> "$OUTPUT_FILE"
|
||||
echo "$memory" >> "$OUTPUT_FILE"
|
||||
echo "$ssd" >> "$OUTPUT_FILE"
|
||||
#임시파일 제거
|
||||
rm -f $IP_FILE
|
||||
}
|
||||
|
||||
export -f fetch_idrac_info
|
||||
export IDRAC_USER
|
||||
export IDRAC_PASS
|
||||
export OUTPUT_DIR
|
||||
|
||||
# 시작 시간 기록
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
fetch_idrac_info
|
||||
|
||||
# 종료 시간 기록
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
# 소요 시간 계산
|
||||
ELAPSED_TIME=$(($END_TIME - $START_TIME))
|
||||
ELAPSED_HOURS=$(($ELAPSED_TIME / 3600))
|
||||
ELAPSED_MINUTES=$((($ELAPSED_TIME % 3600) / 60))
|
||||
ELAPSED_SECONDS=$(($ELAPSED_TIME % 60))
|
||||
|
||||
echo "정보 수집 완료."
|
||||
echo "수집 완료 시간: $ELAPSED_HOURS 시간, $ELAPSED_MINUTES 분, $ELAPSED_SECONDS 초."
|
||||
233
data/scripts/XE9680_H200_IB_10EA_MAC_info.py
Normal file
233
data/scripts/XE9680_H200_IB_10EA_MAC_info.py
Normal file
@@ -0,0 +1,233 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import argparse
|
||||
import concurrent.futures as futures
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import Dict, Optional, Tuple, List
|
||||
|
||||
# ===== 설정: 기본 계정/비밀번호 (환경변수로 덮어쓰기 가능) =====
|
||||
IDRAC_USER = os.getenv("IDRAC_USER", "root")
|
||||
IDRAC_PASS = os.getenv("IDRAC_PASS", "calvin")
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
OUTPUT_DIR = BASE_DIR / "idrac_info"
|
||||
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
MAC_RE = re.compile(r"([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
# --- 유틸: 명령 실행 ---
|
||||
def run(cmd: List[str]) -> Tuple[int, str]:
|
||||
try:
|
||||
p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, check=False)
|
||||
return p.returncode, p.stdout or ""
|
||||
except Exception as e:
|
||||
return 1, f"__EXEC_ERROR__ {e}"
|
||||
|
||||
# --- 파서: getsysinfo/swinventory/hwinventory 에서 필요한 값 추출 ---
|
||||
def extract_first_mac(text: str) -> Optional[str]:
|
||||
m = MAC_RE.search(text)
|
||||
return m.group(0) if m else None
|
||||
|
||||
def parse_svc_tag(getsysinfo: str) -> Optional[str]:
|
||||
# 예: "SVC Tag = ABCDEF2"
|
||||
m = re.search(r"SVC\s*Tag\s*=\s*([^\s]+)", getsysinfo)
|
||||
return m.group(1).strip() if m else None
|
||||
|
||||
def parse_specific_mac_in_getsysinfo(getsysinfo: str, key: str) -> Optional[str]:
|
||||
"""
|
||||
key 예시:
|
||||
- "NIC.Integrated.1-1-1"
|
||||
- "NIC.Embedded.1-1-1"
|
||||
해당 라인에서 MAC 패턴 추출
|
||||
"""
|
||||
for line in getsysinfo.splitlines():
|
||||
if key in line:
|
||||
mac = extract_first_mac(line)
|
||||
if mac:
|
||||
return mac
|
||||
return None
|
||||
|
||||
def parse_idrac_mac(getsysinfo: str) -> Optional[str]:
|
||||
"""
|
||||
원본 스크립트는 "MAC Address = " 를 grep 했습니다.
|
||||
해당 라인(들) 중 첫 MAC을 사용합니다.
|
||||
"""
|
||||
lines = [ln for ln in getsysinfo.splitlines() if "MAC Address" in ln]
|
||||
for ln in lines:
|
||||
mac = extract_first_mac(ln)
|
||||
if mac:
|
||||
return mac
|
||||
return None
|
||||
|
||||
def parse_infiniband_slot_macs_from_swinventory(swinventory: str, slots: List[int]) -> Dict[int, Optional[str]]:
|
||||
"""
|
||||
bash의 awk 트릭(해당 FQDD의 이전 줄에서 MAC 추출)을 그대로 재현:
|
||||
- swinventory 라인을 순회하면서 직전 라인을 prev로 저장
|
||||
- line이 'FQDD = InfiniBand.Slot.<N>-1' 에 매치되면 prev에서 MAC 추출
|
||||
"""
|
||||
want = {s: None for s in slots}
|
||||
prev = ""
|
||||
for line in swinventory.splitlines():
|
||||
m = re.search(r"FQDD\s*=\s*InfiniBand\.Slot\.(\d+)-1", line)
|
||||
if m:
|
||||
slot = int(m.group(1))
|
||||
if slot in want and want[slot] is None:
|
||||
want[slot] = extract_first_mac(prev) # 이전 줄에서 MAC
|
||||
prev = line
|
||||
return want
|
||||
|
||||
def parse_memory_vendor_initials(hwinventory: str) -> str:
|
||||
"""
|
||||
원본: grep -A5 "DIMM" | grep "Manufacturer" | ... | sort | uniq | cut -c1
|
||||
- 간단화: DIMM 근처 5줄 윈도우에서 Manufacturer 라인 모으기
|
||||
- 제조사 첫 글자만 모아 중복 제거, 정렬 후 이어붙임
|
||||
"""
|
||||
lines = hwinventory.splitlines()
|
||||
idxs = [i for i, ln in enumerate(lines) if "DIMM" in ln]
|
||||
vendors: List[str] = []
|
||||
for i in idxs:
|
||||
window = lines[i : i + 6] # 본문 포함 6줄(= -A5)
|
||||
for ln in window:
|
||||
if "Manufacturer" in ln and "=" in ln:
|
||||
v = ln.split("=", 1)[1].strip()
|
||||
if v:
|
||||
vendors.append(v)
|
||||
initials = sorted({v[0] for v in vendors if v})
|
||||
return "".join(initials)
|
||||
|
||||
def parse_ssd_manufacturers(hwinventory: str) -> str:
|
||||
"""
|
||||
원본: grep -A3 "Disk.Bay" | grep "Manufacturer" | uniq
|
||||
- "Disk.Bay" 라인부터 3줄 윈도우 내 Manufacturer 라인 추출, 고유값 join
|
||||
"""
|
||||
lines = hwinventory.splitlines()
|
||||
vendors: List[str] = []
|
||||
for i, ln in enumerate(lines):
|
||||
if "Disk.Bay" in ln:
|
||||
window = lines[i : i + 4]
|
||||
for w in window:
|
||||
if "Manufacturer" in w and "=" in w:
|
||||
v = w.split("=", 1)[1].strip()
|
||||
if v:
|
||||
vendors.append(v)
|
||||
uniq = sorted({v for v in vendors})
|
||||
return ", ".join(uniq)
|
||||
|
||||
# --- 단일 IP 처리 ---
|
||||
def fetch_idrac_info_for_ip(ip: str) -> Tuple[str, bool, str]:
|
||||
"""
|
||||
returns: (ip, success, message)
|
||||
success=True면 파일 저장 완료
|
||||
"""
|
||||
ip = ip.strip()
|
||||
if not ip:
|
||||
return ip, False, "빈 라인"
|
||||
|
||||
# racadm 호출
|
||||
base = ["racadm", "-r", ip, "-u", IDRAC_USER, "-p", IDRAC_PASS]
|
||||
|
||||
rc1, getsysinfo = run(base + ["getsysinfo"])
|
||||
rc2, swinventory = run(base + ["swinventory"])
|
||||
rc3, hwinventory = run(base + ["hwinventory"])
|
||||
|
||||
if rc1 != 0 and rc2 != 0 and rc3 != 0:
|
||||
return ip, False, f"모든 racadm 호출 실패:\n{getsysinfo or ''}\n{swinventory or ''}\n{hwinventory or ''}"
|
||||
|
||||
svc_tag = parse_svc_tag(getsysinfo) if getsysinfo else None
|
||||
if not svc_tag:
|
||||
return ip, False, "서비스 태그(SVC Tag) 추출 실패"
|
||||
|
||||
# 개별 필드 파싱
|
||||
integrated_1 = parse_specific_mac_in_getsysinfo(getsysinfo, "NIC.Integrated.1-1-1") if getsysinfo else None
|
||||
integrated_2 = parse_specific_mac_in_getsysinfo(getsysinfo, "NIC.Integrated.1-2-1") if getsysinfo else None
|
||||
integrated_3 = parse_specific_mac_in_getsysinfo(getsysinfo, "NIC.Integrated.1-3-1") if getsysinfo else None
|
||||
integrated_4 = parse_specific_mac_in_getsysinfo(getsysinfo, "NIC.Integrated.1-4-1") if getsysinfo else None
|
||||
|
||||
onboard_1 = parse_specific_mac_in_getsysinfo(getsysinfo, "NIC.Embedded.1-1-1") if getsysinfo else None
|
||||
onboard_2 = parse_specific_mac_in_getsysinfo(getsysinfo, "NIC.Embedded.2-1-1") if getsysinfo else None
|
||||
|
||||
idrac_mac = parse_idrac_mac(getsysinfo) if getsysinfo else None
|
||||
|
||||
# InfiniBand.Slot.<N>-1 MAC (이전 라인에서 MAC 추출) — 출력 순서 유지
|
||||
desired_slots = [38, 39, 37, 36, 32, 33, 34, 35, 31, 40]
|
||||
slot_macs = parse_infiniband_slot_macs_from_swinventory(swinventory, desired_slots) if swinventory else {s: None for s in desired_slots}
|
||||
|
||||
memory_initials = parse_memory_vendor_initials(hwinventory) if hwinventory else ""
|
||||
ssd_vendors = parse_ssd_manufacturers(hwinventory) if hwinventory else ""
|
||||
|
||||
# 저장
|
||||
out_path = OUTPUT_DIR / f"{svc_tag}.txt"
|
||||
with out_path.open("w", encoding="utf-8") as f:
|
||||
# 원본 스크립트와 동일한 출력 순서
|
||||
f.write(f"{svc_tag}\n")
|
||||
f.write(f"{integrated_1 or ''}\n")
|
||||
f.write(f"{integrated_2 or ''}\n")
|
||||
f.write(f"{integrated_3 or ''}\n")
|
||||
f.write(f"{integrated_4 or ''}\n")
|
||||
f.write(f"{onboard_1 or ''}\n")
|
||||
f.write(f"{onboard_2 or ''}\n")
|
||||
# 슬롯 고정 순서
|
||||
for sl in desired_slots:
|
||||
f.write(f"{slot_macs.get(sl) or ''}\n")
|
||||
f.write(f"{idrac_mac or ''}\n")
|
||||
f.write(f"{memory_initials}\n")
|
||||
f.write(f"{ssd_vendors}\n")
|
||||
|
||||
return ip, True, f"저장: {out_path}"
|
||||
|
||||
# --- 메인 ---
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="iDRAC 정보 수집 (Python 포팅)")
|
||||
parser.add_argument("ip_file", help="IP 주소 목록 파일 (줄 단위)")
|
||||
parser.add_argument("--workers", type=int, default=20, help="병렬 스레드 수 (기본 20)")
|
||||
args = parser.parse_args()
|
||||
|
||||
ip_file = Path(args.ip_file)
|
||||
if not ip_file.exists():
|
||||
print(f"IP 파일이 존재하지 않습니다: {ip_file}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
with ip_file.open("r", encoding="utf-8") as f:
|
||||
ips = [ln.strip() for ln in f if ln.strip()]
|
||||
|
||||
if not ips:
|
||||
print("IP 목록이 비어 있습니다.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
print(f"[시작] 총 {len(ips)}대, workers={args.workers}, IDRAC_USER={IDRAC_USER}")
|
||||
|
||||
t0 = time.time()
|
||||
ok = 0
|
||||
fail = 0
|
||||
|
||||
# 병렬 수집
|
||||
with futures.ThreadPoolExecutor(max_workers=args.workers) as ex:
|
||||
futs = {ex.submit(fetch_idrac_info_for_ip, ip): ip for ip in ips}
|
||||
for fut in futures.as_completed(futs):
|
||||
ip = futs[fut]
|
||||
try:
|
||||
_ip, success, msg = fut.result()
|
||||
prefix = "[OK] " if success else "[FAIL] "
|
||||
print(prefix + ip + " - " + msg)
|
||||
ok += int(success)
|
||||
fail += int(not success)
|
||||
except Exception as e:
|
||||
print(f"[EXC] {ip} - {e}", file=sys.stderr)
|
||||
fail += 1
|
||||
|
||||
dt = int(time.time() - t0)
|
||||
h, r = divmod(dt, 3600)
|
||||
m, s = divmod(r, 60)
|
||||
|
||||
print("\n정보 수집 완료.")
|
||||
print(f"성공 {ok}대 / 실패 {fail}대")
|
||||
print(f"수집 완료 시간: {h} 시간, {m} 분, {s} 초.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
123
data/scripts/XE9680_H200_IB_10EA_MAC_info.sh
Normal file
123
data/scripts/XE9680_H200_IB_10EA_MAC_info.sh
Normal file
@@ -0,0 +1,123 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER="root"
|
||||
IDRAC_PASS="calvin"
|
||||
|
||||
# IP 주소 파일 경로 인자 받기
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ip_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP_FILE=$1
|
||||
|
||||
if [ ! -f "$IP_FILE" ]; then
|
||||
echo "IP file $IP_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR="idrac_info"
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
fetch_idrac_info() {
|
||||
local IDRAC_IP=$(cat $IP_FILE)
|
||||
|
||||
# 모든 hwinventory 저장
|
||||
local getsysinfo=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS getsysinfo)
|
||||
local swinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS swinventory)
|
||||
local hwinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS hwinventory)
|
||||
|
||||
#서비스 태그 가져오기
|
||||
local SVC_TAG=$(echo "$getsysinfo" | grep -i "SVC Tag" | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
#iDRAC MAC 확인
|
||||
local idrac_mac=$(echo "$getsysinfo" | grep -i "MAC Address = " | awk -F '=' '{print $2}' | tr -d '[:space:]')
|
||||
|
||||
#NIC.Integrated MAC 확인
|
||||
local Integrated_1=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Integrated_2=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-2-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Integrated_3=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-3-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Integrated_4=$(echo "$getsysinfo" | grep -i "NIC.Integrated.1-4-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#NIC.Slot.31 MAC 확인
|
||||
#local NICslot31_1=$(echo "$swinventory" | awk '/FQDD = NIC.Slot.31-1-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
#local NICslot31_2=$(echo "$swinventory" | awk '/FQDD = NIC.Slot.31-2-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#추가 NIC MAC 확인
|
||||
local InfiniBand_Slot_31=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.31-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local InfiniBand_Slot_32=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.32-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local InfiniBand_Slot_33=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.33-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local InfiniBand_Slot_34=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.34-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local InfiniBand_Slot_35=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.35-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local InfiniBand_Slot_36=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.36-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local InfiniBand_Slot_37=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.37-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local InfiniBand_Slot_38=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.38-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local InfiniBand_Slot_39=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.39-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local InfiniBand_Slot_40=$(echo "$swinventory" | awk '/FQDD = InfiniBand.Slot.40-1/ {print x; next} {x=$0}' | tail -1 | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
|
||||
#OnBoard MAC 확인
|
||||
local Onboard_1=$(echo "$getsysinfo" | grep -P "NIC.Embedded.1-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
local Onboard_2=$(echo "$getsysinfo" | grep -P "NIC.Embedded.2-1-1" | grep -o -E "([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
#파트 벤더 확인
|
||||
local memory=$(echo "$hwinventory" | grep -A5 "DIMM" | grep "Manufacturer" | awk -F '=' '{print $2}' | awk '{$1=$1};1' | sort | uniq | cut -c1)
|
||||
local ssd=$(echo "$hwinventory" | grep -A3 "Disk.Bay" | grep "Manufacturer" | awk -F '=' '{print $2}' | awk '{$1=$1};1' | sort | uniq)
|
||||
|
||||
# 서비스 태그가 존재하는지 확인
|
||||
if [ -z "$SVC_TAG" ]; then
|
||||
echo "Failed to retrieve SVC Tag for IP: $IDRAC_IP"
|
||||
return
|
||||
fi
|
||||
|
||||
local OUTPUT_FILE="$OUTPUT_DIR/$SVC_TAG.txt"
|
||||
# 정보저장
|
||||
echo "$SVC_TAG" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_1" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_2" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_3" >> "$OUTPUT_FILE"
|
||||
echo "$Integrated_4" >> "$OUTPUT_FILE"
|
||||
echo "$Onboard_1" >> "$OUTPUT_FILE"
|
||||
echo "$Onboard_2" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_38" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_39" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_37" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_36" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_32" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_33" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_34" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_35" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_31" >> "$OUTPUT_FILE"
|
||||
echo "$InfiniBand_Slot_40" >> "$OUTPUT_FILE"
|
||||
echo "$idrac_mac" >> "$OUTPUT_FILE"
|
||||
echo "$memory" >> "$OUTPUT_FILE"
|
||||
echo "$ssd" >> "$OUTPUT_FILE"
|
||||
#임시파일 제거
|
||||
rm -f $IP_FILE
|
||||
}
|
||||
|
||||
export -f fetch_idrac_info
|
||||
export IDRAC_USER
|
||||
export IDRAC_PASS
|
||||
export OUTPUT_DIR
|
||||
|
||||
# 시작 시간 기록
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
fetch_idrac_info
|
||||
|
||||
# 종료 시간 기록
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
# 소요 시간 계산
|
||||
ELAPSED_TIME=$(($END_TIME - $START_TIME))
|
||||
ELAPSED_HOURS=$(($ELAPSED_TIME / 3600))
|
||||
ELAPSED_MINUTES=$((($ELAPSED_TIME % 3600) / 60))
|
||||
ELAPSED_SECONDS=$(($ELAPSED_TIME % 60))
|
||||
|
||||
echo "정보 수집 완료."
|
||||
echo "수집 완료 시간: $ELAPSED_HOURS 시간, $ELAPSED_MINUTES 분, $ELAPSED_SECONDS 초."
|
||||
232
data/scripts/collect_idrac_info.py
Normal file
232
data/scripts/collect_idrac_info.py
Normal file
@@ -0,0 +1,232 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import argparse
|
||||
import concurrent.futures as futures
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import Dict, Optional, Tuple, List
|
||||
|
||||
# ===== 설정: 기본 계정/비밀번호 (환경변수로 덮어쓰기 가능) =====
|
||||
IDRAC_USER = os.getenv("IDRAC_USER", "root")
|
||||
IDRAC_PASS = os.getenv("IDRAC_PASS", "calvin")
|
||||
|
||||
OUTPUT_DIR = Path("idrac_info")
|
||||
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
MAC_RE = re.compile(r"([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}")
|
||||
|
||||
# --- 유틸: 명령 실행 ---
|
||||
def run(cmd: List[str]) -> Tuple[int, str]:
|
||||
try:
|
||||
p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, check=False)
|
||||
return p.returncode, p.stdout or ""
|
||||
except Exception as e:
|
||||
return 1, f"__EXEC_ERROR__ {e}"
|
||||
|
||||
# --- 파서: getsysinfo/swinventory/hwinventory 에서 필요한 값 추출 ---
|
||||
def extract_first_mac(text: str) -> Optional[str]:
|
||||
m = MAC_RE.search(text)
|
||||
return m.group(0) if m else None
|
||||
|
||||
def parse_svc_tag(getsysinfo: str) -> Optional[str]:
|
||||
# 예: "SVC Tag = ABCDEF2"
|
||||
m = re.search(r"SVC\s*Tag\s*=\s*([^\s]+)", getsysinfo)
|
||||
return m.group(1).strip() if m else None
|
||||
|
||||
def parse_specific_mac_in_getsysinfo(getsysinfo: str, key: str) -> Optional[str]:
|
||||
"""
|
||||
key 예시:
|
||||
- "NIC.Integrated.1-1-1"
|
||||
- "NIC.Embedded.1-1-1"
|
||||
해당 라인에서 MAC 패턴 추출
|
||||
"""
|
||||
for line in getsysinfo.splitlines():
|
||||
if key in line:
|
||||
mac = extract_first_mac(line)
|
||||
if mac:
|
||||
return mac
|
||||
return None
|
||||
|
||||
def parse_idrac_mac(getsysinfo: str) -> Optional[str]:
|
||||
"""
|
||||
원본 스크립트는 "MAC Address = " 를 grep 했습니다.
|
||||
해당 라인(들) 중 첫 MAC을 사용합니다.
|
||||
"""
|
||||
lines = [ln for ln in getsysinfo.splitlines() if "MAC Address" in ln]
|
||||
for ln in lines:
|
||||
mac = extract_first_mac(ln)
|
||||
if mac:
|
||||
return mac
|
||||
return None
|
||||
|
||||
def parse_infiniband_slot_macs_from_swinventory(swinventory: str, slots: List[int]) -> Dict[int, Optional[str]]:
|
||||
"""
|
||||
bash의 awk 트릭(해당 FQDD의 이전 줄에서 MAC 추출)을 그대로 재현:
|
||||
- swinventory 라인을 순회하면서 직전 라인을 prev로 저장
|
||||
- line이 'FQDD = InfiniBand.Slot.<N>-1' 에 매치되면 prev에서 MAC 추출
|
||||
"""
|
||||
want = {s: None for s in slots}
|
||||
prev = ""
|
||||
for line in swinventory.splitlines():
|
||||
m = re.search(r"FQDD\s*=\s*InfiniBand\.Slot\.(\d+)-1", line)
|
||||
if m:
|
||||
slot = int(m.group(1))
|
||||
if slot in want and want[slot] is None:
|
||||
want[slot] = extract_first_mac(prev) # 이전 줄에서 MAC
|
||||
prev = line
|
||||
return want
|
||||
|
||||
def parse_memory_vendor_initials(hwinventory: str) -> str:
|
||||
"""
|
||||
원본: grep -A5 "DIMM" | grep "Manufacturer" | ... | sort | uniq | cut -c1
|
||||
- 간단화: DIMM 근처 5줄 윈도우에서 Manufacturer 라인 모으기
|
||||
- 제조사 첫 글자만 모아 중복 제거, 정렬 후 이어붙임
|
||||
"""
|
||||
lines = hwinventory.splitlines()
|
||||
idxs = [i for i, ln in enumerate(lines) if "DIMM" in ln]
|
||||
vendors: List[str] = []
|
||||
for i in idxs:
|
||||
window = lines[i : i + 6] # 본문 포함 6줄(= -A5)
|
||||
for ln in window:
|
||||
if "Manufacturer" in ln and "=" in ln:
|
||||
v = ln.split("=", 1)[1].strip()
|
||||
if v:
|
||||
vendors.append(v)
|
||||
initials = sorted({v[0] for v in vendors if v})
|
||||
return "".join(initials)
|
||||
|
||||
def parse_ssd_manufacturers(hwinventory: str) -> str:
|
||||
"""
|
||||
원본: grep -A3 "Disk.Bay" | grep "Manufacturer" | uniq
|
||||
- "Disk.Bay" 라인부터 3줄 윈도우 내 Manufacturer 라인 추출, 고유값 join
|
||||
"""
|
||||
lines = hwinventory.splitlines()
|
||||
vendors: List[str] = []
|
||||
for i, ln in enumerate(lines):
|
||||
if "Disk.Bay" in ln:
|
||||
window = lines[i : i + 4]
|
||||
for w in window:
|
||||
if "Manufacturer" in w and "=" in w:
|
||||
v = w.split("=", 1)[1].strip()
|
||||
if v:
|
||||
vendors.append(v)
|
||||
uniq = sorted({v for v in vendors})
|
||||
return ", ".join(uniq)
|
||||
|
||||
# --- 단일 IP 처리 ---
|
||||
def fetch_idrac_info_for_ip(ip: str) -> Tuple[str, bool, str]:
|
||||
"""
|
||||
returns: (ip, success, message)
|
||||
success=True면 파일 저장 완료
|
||||
"""
|
||||
ip = ip.strip()
|
||||
if not ip:
|
||||
return ip, False, "빈 라인"
|
||||
|
||||
# racadm 호출
|
||||
base = ["racadm", "-r", ip, "-u", IDRAC_USER, "-p", IDRAC_PASS]
|
||||
|
||||
rc1, getsysinfo = run(base + ["getsysinfo"])
|
||||
rc2, swinventory = run(base + ["swinventory"])
|
||||
rc3, hwinventory = run(base + ["hwinventory"])
|
||||
|
||||
if rc1 != 0 and rc2 != 0 and rc3 != 0:
|
||||
return ip, False, f"모든 racadm 호출 실패:\n{getsysinfo or ''}\n{swinventory or ''}\n{hwinventory or ''}"
|
||||
|
||||
svc_tag = parse_svc_tag(getsysinfo) if getsysinfo else None
|
||||
if not svc_tag:
|
||||
return ip, False, "서비스 태그(SVC Tag) 추출 실패"
|
||||
|
||||
# 개별 필드 파싱
|
||||
integrated_1 = parse_specific_mac_in_getsysinfo(getsysinfo, "NIC.Integrated.1-1-1") if getsysinfo else None
|
||||
integrated_2 = parse_specific_mac_in_getsysinfo(getsysinfo, "NIC.Integrated.1-2-1") if getsysinfo else None
|
||||
integrated_3 = parse_specific_mac_in_getsysinfo(getsysinfo, "NIC.Integrated.1-3-1") if getsysinfo else None
|
||||
integrated_4 = parse_specific_mac_in_getsysinfo(getsysinfo, "NIC.Integrated.1-4-1") if getsysinfo else None
|
||||
|
||||
onboard_1 = parse_specific_mac_in_getsysinfo(getsysinfo, "NIC.Embedded.1-1-1") if getsysinfo else None
|
||||
onboard_2 = parse_specific_mac_in_getsysinfo(getsysinfo, "NIC.Embedded.2-1-1") if getsysinfo else None
|
||||
|
||||
idrac_mac = parse_idrac_mac(getsysinfo) if getsysinfo else None
|
||||
|
||||
# InfiniBand.Slot.<N>-1 MAC (이전 라인에서 MAC 추출) — 출력 순서 유지
|
||||
desired_slots = [38, 39, 37, 36, 32, 33, 34, 35, 31, 40]
|
||||
slot_macs = parse_infiniband_slot_macs_from_swinventory(swinventory, desired_slots) if swinventory else {s: None for s in desired_slots}
|
||||
|
||||
memory_initials = parse_memory_vendor_initials(hwinventory) if hwinventory else ""
|
||||
ssd_vendors = parse_ssd_manufacturers(hwinventory) if hwinventory else ""
|
||||
|
||||
# 저장
|
||||
out_path = OUTPUT_DIR / f"{svc_tag}.txt"
|
||||
with out_path.open("w", encoding="utf-8") as f:
|
||||
# 원본 스크립트와 동일한 출력 순서
|
||||
f.write(f"{svc_tag}\n")
|
||||
f.write(f"{integrated_1 or ''}\n")
|
||||
f.write(f"{integrated_2 or ''}\n")
|
||||
f.write(f"{integrated_3 or ''}\n")
|
||||
f.write(f"{integrated_4 or ''}\n")
|
||||
f.write(f"{onboard_1 or ''}\n")
|
||||
f.write(f"{onboard_2 or ''}\n")
|
||||
# 슬롯 고정 순서
|
||||
for sl in desired_slots:
|
||||
f.write(f"{slot_macs.get(sl) or ''}\n")
|
||||
f.write(f"{idrac_mac or ''}\n")
|
||||
f.write(f"{memory_initials}\n")
|
||||
f.write(f"{ssd_vendors}\n")
|
||||
|
||||
return ip, True, f"저장: {out_path}"
|
||||
|
||||
# --- 메인 ---
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="iDRAC 정보 수집 (Python 포팅)")
|
||||
parser.add_argument("ip_file", help="IP 주소 목록 파일 (줄 단위)")
|
||||
parser.add_argument("--workers", type=int, default=20, help="병렬 스레드 수 (기본 20)")
|
||||
args = parser.parse_args()
|
||||
|
||||
ip_file = Path(args.ip_file)
|
||||
if not ip_file.exists():
|
||||
print(f"IP 파일이 존재하지 않습니다: {ip_file}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
with ip_file.open("r", encoding="utf-8") as f:
|
||||
ips = [ln.strip() for ln in f if ln.strip()]
|
||||
|
||||
if not ips:
|
||||
print("IP 목록이 비어 있습니다.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
print(f"[시작] 총 {len(ips)}대, workers={args.workers}, IDRAC_USER={IDRAC_USER}")
|
||||
|
||||
t0 = time.time()
|
||||
ok = 0
|
||||
fail = 0
|
||||
|
||||
# 병렬 수집
|
||||
with futures.ThreadPoolExecutor(max_workers=args.workers) as ex:
|
||||
futs = {ex.submit(fetch_idrac_info_for_ip, ip): ip for ip in ips}
|
||||
for fut in futures.as_completed(futs):
|
||||
ip = futs[fut]
|
||||
try:
|
||||
_ip, success, msg = fut.result()
|
||||
prefix = "[OK] " if success else "[FAIL] "
|
||||
print(prefix + ip + " - " + msg)
|
||||
ok += int(success)
|
||||
fail += int(not success)
|
||||
except Exception as e:
|
||||
print(f"[EXC] {ip} - {e}", file=sys.stderr)
|
||||
fail += 1
|
||||
|
||||
dt = int(time.time() - t0)
|
||||
h, r = divmod(dt, 3600)
|
||||
m, s = divmod(r, 60)
|
||||
|
||||
print("\n정보 수집 완료.")
|
||||
print(f"성공 {ok}대 / 실패 {fail}대")
|
||||
print(f"수집 완료 시간: {h} 시간, {m} 분, {s} 초.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
55
data/scripts/set_PatrolReadRate.sh
Normal file
55
data/scripts/set_PatrolReadRate.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER="root"
|
||||
IDRAC_PASS="calvin"
|
||||
|
||||
# IP 주소 파일 경로 인자 받기
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ip_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP_FILE=$1
|
||||
|
||||
if [ ! -f "$IP_FILE" ]; then
|
||||
echo "IP file $IP_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR="idrac_info"
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
fetch_idrac_info() {
|
||||
local IDRAC_IP=$(cat $IP_FILE)
|
||||
|
||||
# DellEMC Server
|
||||
local hwinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set storage.Controller.1.PatrolReadRate 9 )
|
||||
|
||||
rm -f $IP_FILE
|
||||
}
|
||||
|
||||
export -f fetch_idrac_info
|
||||
export IDRAC_USER
|
||||
export IDRAC_PASS
|
||||
export OUTPUT_DIR
|
||||
|
||||
# 시작 시간 기록
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
fetch_idrac_info
|
||||
|
||||
# 종료 시간 기록
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
# 소요 시간 계산
|
||||
ELAPSED_TIME=$(($END_TIME - $START_TIME))
|
||||
ELAPSED_HOURS=$(($ELAPSED_TIME / 3600))
|
||||
ELAPSED_MINUTES=$((($ELAPSED_TIME % 3600) / 60))
|
||||
ELAPSED_SECONDS=$(($ELAPSED_TIME % 60))
|
||||
|
||||
echo "설정 완료."
|
||||
echo "수집 완료 시간: $ELAPSED_HOURS 시간, $ELAPSED_MINUTES 분, $ELAPSED_SECONDS 초."
|
||||
55
data/scripts/set_PatrolReadRate_jobs.sh
Normal file
55
data/scripts/set_PatrolReadRate_jobs.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER="root"
|
||||
IDRAC_PASS="calvin"
|
||||
|
||||
# IP 주소 파일 경로 인자 받기
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ip_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP_FILE=$1
|
||||
|
||||
if [ ! -f "$IP_FILE" ]; then
|
||||
echo "IP file $IP_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR="idrac_info"
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
fetch_idrac_info() {
|
||||
local IDRAC_IP=$(cat $IP_FILE)
|
||||
|
||||
# DellEMC Server
|
||||
local hwinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS jobqueue create RAID.Slot.2-1 -r pwrcycle)
|
||||
|
||||
rm -f $IP_FILE
|
||||
}
|
||||
|
||||
export -f fetch_idrac_info
|
||||
export IDRAC_USER
|
||||
export IDRAC_PASS
|
||||
export OUTPUT_DIR
|
||||
|
||||
# 시작 시간 기록
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
fetch_idrac_info
|
||||
|
||||
# 종료 시간 기록
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
# 소요 시간 계산
|
||||
ELAPSED_TIME=$(($END_TIME - $START_TIME))
|
||||
ELAPSED_HOURS=$(($ELAPSED_TIME / 3600))
|
||||
ELAPSED_MINUTES=$((($ELAPSED_TIME % 3600) / 60))
|
||||
ELAPSED_SECONDS=$(($ELAPSED_TIME % 60))
|
||||
|
||||
echo "설정 완료."
|
||||
echo "수집 완료 시간: $ELAPSED_HOURS 시간, $ELAPSED_MINUTES 분, $ELAPSED_SECONDS 초."
|
||||
55
data/scripts/set_VirtualConsole.sh
Normal file
55
data/scripts/set_VirtualConsole.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 사용자 이름 및 비밀번호 설정
|
||||
IDRAC_USER="root"
|
||||
IDRAC_PASS="calvin"
|
||||
|
||||
# IP 주소 파일 경로 인자 받기
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ip_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP_FILE=$1
|
||||
|
||||
if [ ! -f "$IP_FILE" ]; then
|
||||
echo "IP file $IP_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 정보 저장 디렉터리 설정
|
||||
OUTPUT_DIR="idrac_info"
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# iDRAC 정보를 가져오는 함수 정의
|
||||
fetch_idrac_info() {
|
||||
local IDRAC_IP=$(cat $IP_FILE)
|
||||
|
||||
# DellEMC Server
|
||||
local hwinventory=$(racadm -r $IDRAC_IP -u $IDRAC_USER -p $IDRAC_PASS set iDRAC.VirtualConsole.Port 25513)
|
||||
|
||||
rm -f $IP_FILE
|
||||
}
|
||||
|
||||
export -f fetch_idrac_info
|
||||
export IDRAC_USER
|
||||
export IDRAC_PASS
|
||||
export OUTPUT_DIR
|
||||
|
||||
# 시작 시간 기록
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# IP 목록 파일을 읽어 병렬로 작업 수행
|
||||
fetch_idrac_info
|
||||
|
||||
# 종료 시간 기록
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
# 소요 시간 계산
|
||||
ELAPSED_TIME=$(($END_TIME - $START_TIME))
|
||||
ELAPSED_HOURS=$(($ELAPSED_TIME / 3600))
|
||||
ELAPSED_MINUTES=$((($ELAPSED_TIME % 3600) / 60))
|
||||
ELAPSED_SECONDS=$(($ELAPSED_TIME % 60))
|
||||
|
||||
echo "설정 완료."
|
||||
echo "수집 완료 시간: $ELAPSED_HOURS 시간, $ELAPSED_MINUTES 분, $ELAPSED_SECONDS 초."
|
||||
Reference in New Issue
Block a user