Monitorando temperatura das CPUs no RHEL / OEL / CentOS

Mesmo quando não podemos monitorar o ar condicionado, podemos monitorar a consequência dele não estar funcionando…

Instale o lm_sensors.

[root@nerv03 ~]# yum -y install lm_sensors
Loaded plugins: langpacks, ulninfo
epel/x86_64/metalink                                                                                                 | 3.7 kB  00:00:00
epel                                                                                                                 | 4.7 kB  00:00:00
ol7_UEKR5                                                                                                            | 1.2 kB  00:00:00
ol7_latest                                                                                                           | 1.4 kB  00:00:00
teamviewer                                                                                                           | 2.5 kB  00:00:00
(1/3): teamviewer/x86_64/primary_db                                                                                  |  33 kB  00:00:00
(2/3): epel/x86_64/updateinfo                                                                                        | 961 kB  00:00:01
(3/3): epel/x86_64/primary_db                                                                                        | 6.6 MB  00:00:33
(1/5): ol7_UEKR5/x86_64/updateinfo                                                                                   |  29 kB  00:00:00
(2/5): ol7_latest/x86_64/updateinfo                                                                                  | 838 kB  00:00:00
(3/5): ol7_UEKR5/x86_64/primary                                                                                      | 2.4 MB  00:00:00
(4/5): ol7_latest/x86_64/primary                                                                                     |  12 MB  00:00:03
(5/5): ol7_latest/x86_64/group                                                                                       | 810 kB  00:00:10
ol7_UEKR5                                                                                                                           125/125
ol7_latest                                                                                                                      12252/12252
Resolving Dependencies
--> Running transaction check
---> Package lm_sensors.x86_64 0:3.4.0-6.20160601gitf9185e5.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================
 Package                      Arch                     Version                                           Repository                    Size
============================================================================================================================================
Installing:
 lm_sensors                   x86_64                   3.4.0-6.20160601gitf9185e5.el7                    ol7_latest                   140 k

Transaction Summary
============================================================================================================================================
Install  1 Package

Total download size: 140 k
Installed size: 426 k
Downloading packages:
lm_sensors-3.4.0-6.20160601gitf9185e5.el7.x86_64.rpm                                                                 | 140 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : lm_sensors-3.4.0-6.20160601gitf9185e5.el7.x86_64                                                                         1/1
  Verifying  : lm_sensors-3.4.0-6.20160601gitf9185e5.el7.x86_64                                                                         1/1

Installed:
  lm_sensors.x86_64 0:3.4.0-6.20160601gitf9185e5.el7

Complete!
[root@nerv03 ~]#

Execute a detecção dos sensores. Responda YES para tudo.

[root@nerv03 ~]# sensors-detect
# sensors-detect revision 3.4.0-6 (2016-06-01)
# System: Login Informatica LTDA LOG-H110M-G [1.0]
# Kernel: 4.14.35-1818.3.3.el7uek.x86_64 x86_64
# Processor: Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz (6/158/9)

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.

Some south bridges, CPUs or memory controllers contain embedded sensors.
Do you want to scan for them? This is totally safe. (YES/no):
Silicon Integrated Systems SIS5595...                       No
VIA VT82C686 Integrated Sensors...                          No
VIA VT8231 Integrated Sensors...                            No
AMD K8 thermal sensors...                                   No
AMD Family 10h thermal sensors...                           No
AMD Family 11h thermal sensors...                           No
AMD Family 12h and 14h thermal sensors...                   No
AMD Family 15h thermal sensors...                           No
AMD Family 16h thermal sensors...                           No
AMD Family 17h thermal sensors...                           No
AMD Family 15h power sensors...                             No
AMD Family 16h power sensors...                             No
Intel digital thermal sensor...                             Success!
    (driver `coretemp')
Intel AMB FB-DIMM thermal sensor...                         No
Intel 5500/5520/X58 thermal sensor...                       No
VIA C7 thermal sensor...                                    No
VIA Nano thermal sensor...                                  No

Some Super I/O chips contain embedded sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no):
Probing for Super-I/O at 0x2e/0x2f
Trying family `National Semiconductor/ITE'...               No
Trying family `SMSC'...                                     No
Trying family `VIA/Winbond/Nuvoton/Fintek'...               No
Trying family `ITE'...                                      Yes
Found unknown chip with ID 0x8613
Probing for Super-I/O at 0x4e/0x4f
Trying family `National Semiconductor/ITE'...               No
Trying family `SMSC'...                                     No
Trying family `VIA/Winbond/Nuvoton/Fintek'...               No
Trying family `ITE'...                                      No

Some systems (mainly servers) implement IPMI, a set of common interfaces
through which system health data may be retrieved, amongst other things.
We first try to get the information from SMBIOS. If we don't find it
there, we have to read from arbitrary I/O ports to probe for such
interfaces. This is normally safe. Do you want to scan for IPMI
interfaces? (YES/no):
Probing for `IPMI BMC KCS' at 0xca0...                      No
Probing for `IPMI BMC SMIC' at 0xca8...                     No

Some hardware monitoring chips are accessible through the ISA I/O ports.
We have to write to arbitrary I/O ports to probe them. This is usually
safe though. Yes, you do have ISA I/O ports even if you do not have any
ISA slots! Do you want to scan the ISA I/O ports? (YES/no):
Probing for `National Semiconductor LM78' at 0x290...       No
Probing for `National Semiconductor LM79' at 0x290...       No
Probing for `Winbond W83781D' at 0x290...                   No
Probing for `Winbond W83782D' at 0x290...                   No

Lastly, we can probe the I2C/SMBus adapters for connected hardware
monitoring devices. This is the most risky part, and while it works
reasonably well on most systems, it has been reported to cause trouble
on some systems.
Do you want to probe the I2C/SMBus adapters now? (YES/no):
Found unknown SMBus adapter 8086:a123 at 0000:00:1f.4.
Sorry, no supported PCI bus adapters found.
Module i2c-dev loaded successfully.

Next adapter: i915 gmbus dpc (i2c-0)
Do you want to scan it? (yes/NO/selectively): YES

Next adapter: i915 gmbus dpb (i2c-1)
Do you want to scan it? (yes/NO/selectively): YES

Next adapter: i915 gmbus dpd (i2c-2)
Do you want to scan it? (yes/NO/selectively): YES

Next adapter: DPDDC-D (i2c-3)
Do you want to scan it? (yes/NO/selectively): YES
Client found at address 0x49
Probing for `National Semiconductor LM75'...                No
Probing for `National Semiconductor LM75A'...               No
Probing for `Dallas Semiconductor DS75'...                  No
Probing for `National Semiconductor LM77'...                No
Probing for `Analog Devices ADT7410/ADT7420'...             No
Probing for `Maxim MAX6642'...                              No
Probing for `Texas Instruments TMP435'...                   No
Probing for `National Semiconductor LM73'...                No
Probing for `National Semiconductor LM92'...                No
Probing for `National Semiconductor LM76'...                No
Probing for `Maxim MAX6633/MAX6634/MAX6635'...              No
Probing for `NXP/Philips SA56004'...                        No
Probing for `SMSC EMC1023'...                               No
Probing for `SMSC EMC1043'...                               No
Probing for `SMSC EMC1053'...                               No
Probing for `SMSC EMC1063'...                               No
Client found at address 0x5c
Probing for `Analog Devices ADT7462'...                     No
Probing for `SMSC EMC1072'...                               No
Probing for `SMSC EMC1073'...                               No
Probing for `SMSC EMC1074'...                               No

Next adapter: SMBus I801 adapter at f040 (i2c-4)
Do you want to scan it? (YES/no/selectively):
Client found at address 0x50
Probing for `Analog Devices ADM1033'...                     No
Probing for `Analog Devices ADM1034'...                     No
Probing for `SPD EEPROM'...                                 No
Probing for `EDID EEPROM'...                                No
Client found at address 0x52
Probing for `Analog Devices ADM1033'...                     No
Probing for `Analog Devices ADM1034'...                     No
Probing for `SPD EEPROM'...                                 No


Now follows a summary of the probes I have just done.
Just press ENTER to continue:

Driver `coretemp':
  * Chip `Intel digital thermal sensor' (confidence: 9)

Do you want to overwrite /etc/sysconfig/lm_sensors? (YES/no):
Unloading i2c-dev... OK

[root@nerv03 ~]#

Finalmente, a verificação de temperatura. Esta etapa, ao contrário das anteriores, não precisa ser com root.

[root@nerv03 ~]# sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:        +27.8°C  (crit = +119.0°C)
temp2:        +29.8°C  (crit = +119.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +45.0°C  (high = +80.0°C, crit = +100.0°C)
Core 0:        +39.0°C  (high = +80.0°C, crit = +100.0°C)
Core 1:        +45.0°C  (high = +80.0°C, crit = +100.0°C)
Core 2:        +39.0°C  (high = +80.0°C, crit = +100.0°C)
Core 3:        +43.0°C  (high = +80.0°C, crit = +100.0°C)

[root@nerv03 ~]#

E podemos fazer uma saída mais limpa com grep, awk e sed, o que é necessário para o monitoramento.

[root@nerv03 ~]# sensors | grep Core
Core 0:        +37.0°C  (high = +80.0°C, crit = +100.0°C)
Core 1:        +37.0°C  (high = +80.0°C, crit = +100.0°C)
Core 2:        +37.0°C  (high = +80.0°C, crit = +100.0°C)
Core 3:        +38.0°C  (high = +80.0°C, crit = +100.0°C)
[root@nerv03 ~]# sensors | grep Core | awk '{print $3}'
+34.0°C
+35.0°C
+36.0°C
+38.0°C
[root@nerv03 ~]# sensors | grep Core | awk '{print $3}' | sed 's/\+//'
34.0°C
38.0°C
36.0°C
35.0°C
[root@nerv03 ~]# sensors | grep Core | awk '{print $3}' | sed 's/\+//' | sed 's/°C//'
34.0
35.0
37.0
35.0
[root@nerv03 ~]#

Para verificar qual a CPU com a temperatura mais alta:

[root@nerv03 ~]# sensors | grep Core | awk '{print $3}' | sed 's/\+//' | sed 's/°C//' | sort | tail -1
38.0

E para verificar o que é considerado uma temperatura alta:

[root@nerv03 ~]# sensors | grep Core | awk '{print $6}' | sed 's/\+//' | sed 's/°C,//' | uniq
80.0
[root@nerv03 ~]#

E para verificar o que é considerado uma temperatura crítica:

[root@nerv03 ~]# sensors | grep Core | awk '{print $9}' | sed 's/\+//' | sed 's/°C)//' | uniq
100.0
[root@nerv03 ~]#

One comment

  1. Boa tarde Portilho!

    Muito obrigado por compartilhar 🙂
    Excelente post!
    Abração,

    Wagner Vinicius

Leave a Reply

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

Esse site utiliza o Akismet para reduzir spam. Aprenda como seus dados de comentários são processados.