https://onitroad.com 更多教程

服务控制

此服务由下面的 init.d 脚本 /etc/init.d/lm_sensors 处理:

# /sbin/service lm_sensors
Usage: -bash {start|stop|status|restart|condrestart}

服务 lm_sensors 将执行命令“sensors”,该命令用于显示所有传感器芯片的所有当前读数,并设置配置文件中指定的所有限制。

配置

lm_sensors 服务使用配置文件 /etc/sysconfig/lm_sensors 来定义 lm_sensors 加载的模块。
运行sensors-detect 来生成配置文件。
默认文件是:

# more /etc/sysconfig/lm_sensors
# This file is used by /etc/rc.d/init.d/lm_sensors and defines the modules to
# be loaded/unloaded. This file is sourced into /etc/rc.d/init.d/lm_sensors.
#
# The format of this file is a shell script that simply defines the modules
# in order as normal variables with the special names:
#    MODULE_0, MODULE_1, MODULE_2, etc.
#
# List the modules that are to be loaded for your system
#
# Generated by sensors-detect on Wed Jan 14 21:46:56 2009
MODULE_0=i2c-i801
MODULE_1=eeprom

另一个配置文件是 /etc/sensors.conf ,它描述了 libsensors 以及所有使用它的程序应该如何将来自内核模块的原始读数转换为实际值。
一个例子如下:

# more /etc/sensors.conf
chip "lm78-*" "lm78-j-*" "lm79-*" "w83781d-*"
    label in0 "VCore 1"
    label in1 "VCore 2"
    label in2 "+3.3V"
    label in3 "+5V"
    label in4 "+12V"
    label in5 "-12V"
    label in6 "-5V"
    compute in3 ((6.8/10)+1)*@ ,  @/((6.8/10)+1)
    compute in4 ((28/10)+1)*@  ,  @/((28/10)+1)
    compute in5 -(210/60.4)*@  ,  -@/(210/60.4)
    compute in6 -(90.9/60.4)*@ ,  -@/(90.9/60.4)
    set in0_min vid*0.95
    set in0_max vid*1.05
    set in1_min vid*0.95
    set in1_max vid*1.05
    set in2_min 3.3 * 0.95
    set in2_max 3.3 * 1.05
    set in3_min 5.0 * 0.95
    set in3_max 5.0 * 1.05
    set in4_min 12 * 0.95
    set in4_max 12 * 1.05
    set in5_max -12 * 0.95
    set in5_min -12 * 1.05
    set in6_max -5 * 0.95
    set in6_min -5 * 1.05

有关更多信息,请参阅sensors.conf(5) 的手册页。

Linux 操作系统“lm_sensors”服务

lm_sensors服务说明

lm_sensors 是一项服务,用于监控 CPU 温度或者风扇速度等硬件。
并非所有系统硬件都为 lm_sensors 服务提供必要的传感器硬件资源。
后来的 lm_sensor 包包括sensors_detect 实用程序,可用于探测硬件提供哪些传感器以及我们需要哪些驱动程序。

lm_sensors 驱动程序包括两组:

  • 为I2C(Inter IC-bus)/SMSbus(系统管理总线)总线提供总线驱动程序;
  • PCI 或者 ISA 总线上的传感器芯片不需要特殊的总线驱动程序。芯片驱动程序用于访问传感器芯片本身。

SMBus 是更通用的 I2C 的特定实现。
事实上,I2C 设备和 SMBus 设备都可以连接到同一 (I2C) 总线。
SMBus(或者 I2C 总线)从主机控制器开始,用于启动 SMBus 上的事务。
从主机接口,各个传感器芯片被称为从设备。

lm_sensors 服务由应用程序、lm_sensors 脚本和几个内核模块组成。
根据内核版本和系统硬件,需要一些内核模块,例如 I2C 内核模块。
前面提到的传感器检测应用程序可用于确定必须加载哪些内核模块。

lm_sensors 由 lm_sensors rpm 包提供。
键入以下命令以安装软件包:

# yum install lm_sensors
日期:2020-09-17 00:14:36 来源:oir作者:oir