監控 Linux 主機溫度風扇 (lm-sensors)

  • 因為透過 LibreNMS 監控 Linux 實體主機, 會發現預設的 sensors 可能無法正常提供資料或名稱無法正確解析, 可以透過修改或建立感應器設定檔來解決 Exp. /etc/sensors.d/nct6798.conf
  • apt update
    apt install lm-sensors
    sensors-detect --auto

  • 重啟服務

    service kmod restart
    sensors -s

  • 查看結果

    # sensors
    nct6798-isa-02a0
    Adapter: ISA adapter
    in0:                     1.39 V  (min =  +0.00 V, max =  +1.74 V)
    in1:                     1.02 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in2:                     3.41 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in3:                     3.39 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in4:                   984.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
    in5:                   152.00 mV (min =  +0.00 V, max =  +0.00 V)
    in6:                   136.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
    in7:                     3.41 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in8:                     3.18 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in9:                     1.06 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in10:                  160.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
    in11:                  128.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
    in12:                    1.06 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in13:                  160.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
    in14:                    1.50 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    fan1:                     0 RPM  (min =    0 RPM)
    fan2:                  1824 RPM  (min =  800 RPM)
    fan3:                     0 RPM  (min =    0 RPM)
    fan4:                     0 RPM  (min =    0 RPM)
    fan5:                     0 RPM  (min =    0 RPM)
    fan7:                     0 RPM  (min =    0 RPM)
    SYSTIN:                +113.0°C  (high = +80.0°C, hyst = +75.0°C)
                                     (crit = +100.0°C)  sensor = thermistor
    CPUTIN:                 +46.0°C  (high = +80.0°C, hyst = +75.0°C)
                                     (crit = +100.0°C)  sensor = thermistor
    AUXTIN0:               +110.0°C  (high = +80.0°C, hyst = +75.0°C)  ALARM
                                     (crit = +100.0°C)  sensor = thermistor
    AUXTIN1:               +111.0°C  (high = +80.0°C, hyst = +75.0°C)  ALARM
                                     (crit = +100.0°C)  sensor = thermistor
    AUXTIN2:               +111.0°C  (high = +80.0°C, hyst = +75.0°C)  ALARM
                                     (crit = +100.0°C)  sensor = thermistor
    AUXTIN3:                 -1.0°C  (high = +80.0°C, hyst = +75.0°C)
                                     (crit = +100.0°C)  sensor = thermistor
    PECI Agent 0:           +57.5°C  (high =  +1.0°C, hyst = +75.0°C)  ALARM
    AUXTIN4:               +105.0°C  (high = +80.0°C, hyst = +75.0°C)  ALARM
                                     (crit = +100.0°C)
    PCH_CHIP_CPU_MAX_TEMP:   +0.0°C
    PCH_CHIP_TEMP:           +0.0°C
    PCH_CPU_TEMP:            +0.0°C
    PCH_MCH_TEMP:            +0.0°C
    intrusion0:            ALARM
    intrusion1:            ALARM
    beep_enable:           disabled
    
    nvme-pci-0100
    Adapter: PCI adapter
    Composite:    +50.9°C  (low  =  -5.2°C, high = +89.8°C)
                           (crit = +93.8°C)
    
    iwlwifi_1-virtual-0
    Adapter: Virtual device
    temp1:            N/A
    
    coretemp-isa-0000
    Adapter: ISA adapter
    Package id 0:  +58.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 0:        +58.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 4:        +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 8:        +53.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 12:       +50.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 16:       +50.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 20:       +53.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 24:       +50.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 28:       +50.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 32:       +53.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 33:       +53.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 34:       +53.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 35:       +53.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 36:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 37:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 38:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 39:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 40:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 41:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 42:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 43:       +52.0°C  (high = +80.0°C, crit = +100.0°C)

  1. temp3, temp4, temp5, temp6, temp8 都是 0 或很奇怪的數字, 要移除不呈現

     vi /etc/sensors.d/nct6798.conf

    chip "nct6798-isa-*"
        ignore temp3
        ignore temp4
        ignore temp5
        ignore temp6
        ignore temp8
  2. fan1, fan3, fan4, fan5, fan7 都是 0 , 要移除不呈現

     vi /etc/sensors.d/nct6798.conf

    chip "nct6798-isa-*"
        ignore temp3
        ignore temp4
        ignore temp5
        ignore temp6
        ignore temp8
    
        # 忽略未使用的風扇
        ignore fan1
        ignore fan3
        ignore fan4
        ignore fan5
        ignore fan7
  3. 設定 fan2 的顯示名稱為 'CPU FAN', 並設定最小轉數 800 rpm

     vi /etc/sensors.d/nct6798.conf

    chip "nct6798-isa-*"
        ignore temp3
        ignore temp4
        ignore temp5
        ignore temp6
        ignore temp8
    
        # 忽略未使用的風扇
        ignore fan1
        ignore fan3
        ignore fan4
        ignore fan5
        ignore fan7
    
        # 設定 fan2 最小轉速
        set fan2_min 800
        label fan2 "CPU FAN"
  4. 要重新啟動服務

    service kmod restart
    sensors -s

  5. 檢查是否如預期的呈現結果

    sensors
    # sensors
    nct6798-isa-02a0
    Adapter: ISA adapter
    in0:                     1.40 V  (min =  +0.00 V, max =  +1.74 V)
    in1:                     1.02 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in2:                     3.41 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in3:                     3.39 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in4:                   992.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
    in5:                   152.00 mV (min =  +0.00 V, max =  +0.00 V)
    in6:                   136.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
    in7:                     3.41 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in8:                     3.18 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in9:                     1.06 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in10:                  160.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
    in11:                  128.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
    in12:                    1.06 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    in13:                  160.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
    in14:                    1.51 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
    CPU FAN:               1920 RPM  (min =  800 RPM)
    SYSTIN:                +113.0°C  (high = +80.0°C, hyst = +75.0°C)
                                     (crit = +100.0°C)  sensor = thermistor
    CPUTIN:                 +46.0°C  (high = +80.0°C, hyst = +75.0°C)
                                     (crit = +100.0°C)  sensor = thermistor
    PECI Agent 0:           +54.5°C  (high =  +1.0°C, hyst = +75.0°C)  ALARM
    PCH_CHIP_CPU_MAX_TEMP:   +0.0°C
    PCH_CHIP_TEMP:           +0.0°C
    PCH_CPU_TEMP:            +0.0°C
    PCH_MCH_TEMP:            +0.0°C
    intrusion0:            ALARM
    intrusion1:            ALARM
    beep_enable:           disabled
    
    nvme-pci-0100
    Adapter: PCI adapter
    Composite:    +51.9°C  (low  =  -5.2°C, high = +89.8°C)
                           (crit = +93.8°C)
    
    iwlwifi_1-virtual-0
    Adapter: Virtual device
    temp1:            N/A
    
    coretemp-isa-0000
    Adapter: ISA adapter
    Package id 0:  +71.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 0:        +59.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 4:        +50.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 8:        +53.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 12:       +56.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 16:       +70.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 20:       +71.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 24:       +57.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 28:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 32:       +53.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 33:       +53.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 34:       +54.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 35:       +54.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 36:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 37:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 38:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 39:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 40:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 41:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 42:       +52.0°C  (high = +80.0°C, crit = +100.0°C)
    Core 43:       +52.0°C  (high = +80.0°C, crit = +100.0°C)

  • 如果要讓 LibreNMS 看到正確的資料, 需要重新啟動 snmpd

    systemctl restart snmpd

  • tech/lm-sensors.txt
  • 上一次變更: 2025/01/15 11:40
  • jonathan