1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
import subprocess import colorama from colorama import Fore, Back, Style
colorama.init()
def run_smartctl(disk_id, filter_keyword=None, exclude_keyword=None, is_nvme=False): if is_nvme is True: result = subprocess.check_output(f'sudo nvme smart-log /dev/disk/by-id/{disk_id}', shell=True).decode('utf-8') else: result = subprocess.check_output(f'sudo smartctl -a /dev/disk/by-id/{disk_id}', shell=True).decode('utf-8')
lines = result.splitlines() if filter_keyword: lines = [line for line in lines if filter_keyword.lower() in line.lower()] if exclude_keyword: lines = [line for line in lines if exclude_keyword.lower() not in line.lower()] return '\n'.join(lines)
def print_group_temp(title, disks, keyword="Temperature", exclude=None, is_nvme=False): print(Fore.BLACK + Back.YELLOW + f"💡 {title} Group Temperature:" + Style.RESET_ALL) for disk_id in disks: print(f"{disk_id}:") output = run_smartctl(disk_id, filter_keyword=keyword, exclude_keyword=exclude, is_nvme=is_nvme) print(output) print('-' * max([len(line) for line in output.splitlines()]))
DapuStor_R5100_NVMes = [ "nvme-DAPUSTOR_DPRD3108T0T507T6000_RS5U51A23300B3G9", "nvme-DAPUSTOR_DPRD3108T0T507T6000_RS5U51A23400BZ0J", "nvme-DAPUSTOR_DPRD3108T0T507T6000_RS5U51A23500C6CA", "nvme-DAPUSTOR_DPRD3108T0T507T6000_RS5U51A23500C6MY", "nvme-DAPUSTOR_DPRD3108T0T507T6000_RS5U51A23500C737", "nvme-DAPUSTOR_DPRD3108T0T507T6000_RS5U51A23A00GALG", "nvme-DAPUSTOR_DPRD3108T0T507T6000_RS5U51B236000213", "nvme-DAPUSTOR_DPRD3108T0T507T6000_RS5U51B236000220" ] print_group_temp("DapuStor R5100 NVMe", DapuStor_R5100_NVMes, is_nvme=True) print("\n" * 2)
intel_Optane_900P_NVMes = ["nvme-INTEL_SSDPE21D280GA_PHM28105018M280AGN"] print_group_temp(title="Intel Optane 900P", disks=intel_Optane_900P_NVMes, is_nvme=True) print("\n" * 2)
WD_HC550_SATAs = [ "ata-WDC_WUH721818ALE6L4_2JJRHM8B", "ata-WDC_WUH721818ALE6L4_2JJV06YL", "ata-WDC_WUH721818ALE6L4_2JJWHLPL", "ata-WDC_WUH721818ALE6L4_2VGJV5DA", "ata-WDC_WUH721818ALE6L4_2VGKMM0L", "ata-WDC_WUH721818ALE6L4_2VGL7RYA", "ata-WDC_WUH721818ALE6L4_2VH9S91A", "ata-WDC_WUH721818ALE6L4_3FHDMUTT", "ata-WDC_WUH721818ALE6L4_3WGRYZJJ", "ata-WDC_WUH721818ALE6L4_3WGS00DJ", "ata-WDC_WUH721818ALE6L4_3WJDSE1K", "ata-WDC_WUH721818ALE6L4_4BKMN0LY", "ata-WDC_WUH721818ALE6L4_4BKNLESH", "ata-WDC_WUH721818ALE6L4_4BKY72JZ", "ata-WDC_WUH721818ALE6L4_4EG3BVPY", "ata-WDC_WUH721818ALE6L4_5DGHEM6J", "ata-WDC_WUH721818ALE6L4_5DGPBXWJ", "ata-WDC_WUH721818ALE6L4_5DGPHYHJ", "ata-WDC_WUH721818ALE6L4_6PGEE13U", "ata-WDC_WUH721818ALE6L4_6TGXA6XF", "ata-WDC_WUH721818ALE6L4_6TH0H4RF", "ata-WDC_WUH721818ALE6L4_6TH0J73F", "ata-WDC_WUH721818ALE6L4_6TH0M0MF", "ata-WDC_WUH721818ALE6L4_6TH0M3KF" ] print_group_temp("WD HC550", WD_HC550_SATAs, keyword="Celsius") print("\n" * 2)
Toshiba_MG06S_SASs = [ "scsi-3500003992822e315", "scsi-3500003992822e33d", "scsi-3500003992823697d", "scsi-350000399282392e5" ] print_group_temp("Toshiba MG06S", Toshiba_MG06S_SASs, keyword="Current Drive Temperature:")
|