首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >启用sysstat温度记录

启用sysstat温度记录
EN

Unix & Linux用户
提问于 2022-03-22 21:35:09
回答 1查看 525关注 0票数 0

我正在尝试使sysstat能够获取温度读数,这样我就有了过去的温度信息来诊断将来的主机故障。

我尝试使用这个命令来获取温度信息:

代码语言:javascript
复制
$ sar -m TEMP
Requested activities not available in file /var/log/sysstat/sa22

下面是特区手册页面对此的看法:

代码语言:javascript
复制
-m { keyword [,...] | ALL }
       Report power management statistics.  Note that these statistics depend on sadc's option "-S  POWER"  to
       be collected.

       Possible keywords are CPU, FAN, FREQ, IN, TEMP and USB.

       [...]

       With  the  TEMP  keyword,  statistics about devices temperature are reported.  The following values are
       displayed:

根据这一点,默认情况下不记录电源管理信息(其中温度是其中的一个子集)。因此,我更改了文件/etc/sysstat/sysstat以启用它。我改变了这个:

代码语言:javascript
复制
# Parameters for the system activity data collector (see sadc(8) manual page)
# which are used for the generation of log files.
# By default contains the `-S DISK' option responsible for generating disk
# statisitcs. Use `-S XALL' to collect all available statistics.
SADC_OPTIONS="-S DISK"

这方面:

代码语言:javascript
复制
SADC_OPTIONS="-S DISK,POWER"

sysstat问题跟踪器上的另一个问题是sysstat需要lm传感器才能工作,所以我也安装了这个包。下面是sensors的输出:

代码语言:javascript
复制
$ sensors
acpitz-acpi-0
Adapter: ACPI interface
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:  +89.0°C  (high = +82.0°C, crit = +100.0°C)
Core 0:        +86.0°C  (high = +82.0°C, crit = +100.0°C)
Core 1:        +88.0°C  (high = +82.0°C, crit = +100.0°C)
Core 2:        +89.0°C  (high = +82.0°C, crit = +100.0°C)
Core 3:        +89.0°C  (high = +82.0°C, crit = +100.0°C)
Core 4:        +88.0°C  (high = +82.0°C, crit = +100.0°C)
Core 5:        +87.0°C  (high = +82.0°C, crit = +100.0°C)

nvme-pci-0800
Adapter: PCI adapter
Composite:    +38.9°C  (low  = -273.1°C, high = +84.8°C)
                       (crit = +84.8°C)
Sensor 1:     +38.9°C  (low  = -273.1°C, high = +65261.8°C)
Sensor 2:     +37.9°C  (low  = -273.1°C, high = +65261.8°C)

所以这似乎正确地探测到了我的温度传感器。

我还试着等待十分钟,等待另一个收集发生。(我的系统被配置为每十分钟记录一次,时间:05,:15,:25,等等)

不幸的是,在这之后,我仍然会遇到同样的错误:

代码语言:javascript
复制
$ sar -m TEMP
Requested activities not available in file /var/log/sysstat/sa22
EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2022-03-30 17:33:11

通过三个步骤,我成功地做到了这一点:

  1. 完成上述问题中的所有设置。
  2. 删除当天的sysstat日志文件。root@host:~# sar -m临时请求文件/var/log/sysstat/sar 30 root@host:~# rm /var/log/sysstat/sar 30中不可用的活动。
  3. 运行脚本/usr/lib/sysstat/debian-sa1 1 1 (在非Debian/Ubuntu系统上可能有所不同)

之后,运行sar -m TEMP就能工作了。

票数 1
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/696447

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档