传感器一本通
一、关于传感器
openUBMC 中有很多的传感器,并且均满足 IPMI规范
目传感器主要有以下两类:
-
门限传感器
-
离散传感器
门限传感器
门限传感器又叫做连续性传感器,表征传感器的值是连续变化的(对比了解:数学中的连续值/曲线),如:温度,电压,功耗,转速等。
门限传感器资源在资源协作接口上体现为两部分:
-
IPMI规范资源:主要用于描述当前的传感器,在CSR进行配置
-
可描述性资源:主要用于提供给北向可读的传感器参数
离散传感器
离散传感器,表征传感器的值是离散的(对比了解:数学中的离散值/曲线),如:运行状态,隔离值等。
SDR
SDR,传感器数据记录(Sensor Data Record),二进制方式存放传感器数据,主要是静态数据。IPMI命令是通过SDR获取传感器信息的。
包含三个主要组成部分:记录头(Record Header)、记录"键"(Record Key)、记录体(Record Body)。
Record Header
所有SDR的 Record Header 格式一致,其中包含一条数据记录的基本信息。
| 字段名称 | 数据大小 | 字段说明 |
|---|---|---|
| RecordId | 2 bytes | 记录编号,唯一标识一条数据记录 |
| SDRVersion | 1 bytes | SDR版本,0x51 |
| RecordType | 1 bytes | 记录类型 full sensor record - 0x01compact sensor record - 0x02device-relative entity association record - 0x09fru device locator - 0x11management controller device locator - 0x12 |
| RecordLength | 1 bytes | 记录长度 |
Record Key
Record Key 用于唯一标识同一类SDR的一条数据信息,不同类的SDR的标识方式不同。
1. full sensor record / compact sensor record
| 字段名称 | 数据大小 | 字段说明 |
|---|---|---|
| OwnerId | 1 bytes | 传感器的归属Id |
| OwnerLun | 1 bytes | 传感器的归属Lun |
| Number | 1 bytes | 传感器编号 |
2. DEA:device-relative entity association record
| 字段名称 | 数据大小 | 字段说明 |
|---|---|---|
| EntityId | 1 bytes | 管理设备的实体标识 |
| EntityInstance | 1 bytes | 管理设备的实体实例 |
| DeviceAddress | 1 bytes | 管理设备的从地址 |
| DeviceChannel | 1 bytes | 管理设备的通道 |
| Flags | 1 bytes | 管理设备关联的设备标记 |
| Entity1Address | 1 bytes | 管理设备关联的第一个设备的地址 |
| Entity1Channel | 1 bytes | 管理设备关联的第一个设备的通道 |
| Entity1Id | 1 bytes | 管理设备关联的第一个设备的实体标识 |
| Entity1Instance | 1 bytes | 管理设备关联的第一个设备的实体实例 |
3. fru device locator
| 字段名称 | 数据大小 | 字段说明 |
|---|---|---|
| AccessAddress | 1 bytes | 管理设备访问地址 |
| FruId | 1 bytes | fru编号 |
| LogicalDevice | 1 bytes | 标识fru为逻辑设备或是物理设备 |
| Channel | 1 bytes | 管理设备的通道 |
4. MCDL:management controller device locator
| 字段名称 | 数据大小 | 字段说明 |
|---|---|---|
| SlaveAddress | 1 bytes | 管理设备的从地址 |
| Channel | 1 bytes | 管理设备的通道 |
| Record Body | ||
| Record Body 为记录的主体内容。 |
| 记录类型 | 记录内容 |
|---|---|
| full sensor record | EntityId、EntityInstance、Initialization、Capabilities、SensorType、ReadingType、AssertMask、DeassertMask、ReadingMask、Unit、BaseUnit、ModifierUnit、Linearization、M、MT、B、BA、Accuracy、RBExp、Analog、NominalReading、NormalMaximum、NormalMinimum、MaximumReading、MinimumReading、UpperNonrecoverable、UpperCritical、UpperNoncritical、LowerNonrecoverable、LowerNoncritical、LowerCritical、PositiveHysteresis、NegativeHysteresis、SensorName |
| compact sensor record | EntityId、EntityInstance、Initialization、Capabilities、SensorType、ReadingType、AssertMask、DeassertMask、DiscreteMask、Unit、BaseUnit、ModifierUnit、RecordSharing、PositiveHysteresis、NegativeHysteresis、SensorName |
| DEA | Address2、Channel2、Entity2Id、Entity2Instance、Address3、Channel3、Entity3Id、Entity3Instance、Address4、Channel4、Entity4Id、Entity4Instance |
| fru device locator | DeviceType、DeviceTypeModifier、FruEntityId、FruEntityInstance |
| MCDL | PowerStateInitialization、Capabilities、EntityId、EntityInstance、DeviceName |
二、配置文档
传感器的配置文档可直接查看文档中心
三、常用接口
待补充
四、常见问题
Q1: 如何查询传感器列表
A:可通过以下 4 种方式查询传感器
1、Web
Web 提供了门限传感器查询
Web 登录后,【系统管理】-【系统信息】-【传感器】,即可查询当前的门限传感器。
2、IPMI
支 IPMI命令查询所有传感器。可通过带内与带外的方式查询,命令为 sensor list 。
-
带内查询:
ipmitool sensor list -
带外查询:
ipmitool -I lanplus -H <host> -p 623 -U <username> -P <password> -C 17 sensor list
3、CLI
支持CLI 命令查询所有传感器
SSH 登录后执行命令 ipmcget -t sensor -d list
4、redfish
支持 redfish 接口查询。通过 get 请求分别查询门限传感器和离散传感器。
-
门限传感器 uri:
redfish/v1/Chassis/:chassisid/ThresholdSensors -
离散传感器 uri:
redfish/v1/Chassis/:chassisid/DiscreteSensors
Q2: 传感器状态的含义是什么
** 状态(status) 与 当前值(value) 的关系如下
1、传感器处于禁止扫描或者扫描异常的状态
| 当前值(value) | 状态(status) |
|---|---|
| na | na |
2、传感器处于使能扫描的状态
| 当前值(value) | 状态(status) |
|---|---|
| 为具体传感器的读值,且不满足任何门限值 | ok |
| 为具体传感器的读值,且满足一般门限值 | nc |
| 为具体传感器的读值,且满足严重门限值 | cr |
| 为具体传感器的读值,且满足紧急门限值 | nr |
Q3: 传感器显示NA/–的原因
1、传感器禁止扫描
查看该连续传感器的资源树属性Status,若为Disabled,则传感器当前为禁止扫描。禁止扫描状态与以下因素有关
(1)与传感器关联的Entity的在位和上电状态相关(绝大多数是该原因)
(2)通过IPMI或CLI接口主动变更传感器使能状态
2、传感器扫描异常
查看该连续传感器的资源树属性ReadingStatus,若其值非0(normal),则表示扫描异常。该属性配置自CSR,要确认扫描异常的原因,则确认配置的数据源的值
注: 配置文档中有说明ReadingStatus各个值的含义
Q4: 组件内部管理的状态 self.sensor_status 以及与传感器状态(Status)的关系?通过什么方式可以获取 self.sensor_status 的内容取值
1、self.sensor_status 为 U8 类型变量,每一位代表一个状态
disable_scanning/disable_all/disable_scanning_local/disable_access_error:0 = disabled; 1 = enabled
disable_override: 0 = false; 1 = true
initial_update_progress:0 = update in progress; 1 = update end
| 状态 | 变更条件 |
|---|---|
| disable_scanning | 只能通过 IPMI 或 CLI 命令变更使能状态,与 disable_all 同步更改 |
| disable_all | 只能通过 IPMI 或 CLI 命令变更使能状态,与 disable_scanning 同步更改 |
| disable_scanning_local | 与传感器关联的 Entity 相关 `Entity 不在位 |
| disable_override | 默认为 false,当 disable_scanning 和 disable_all 被更改时,置为 true |
| disable_access_error | 与读值状态相关SCAN_FAILURE(1)/SCAN_PRE_FAILURE(2):disabledSCAN_NORMAL(0)/SCAN_NOT_ACCESSIBLE(3)/SCAN_NOT_SCANNED(4):enabled |
| initial_update_progress | 与读值状态相关SCAN_NOT_ACCESSIBLE(3)/SCAN_NOT_SCANNED(4):update in progressSCAN_NORMAL(0)/SCAN_FAILURE(1)/SCAN_PRE_FAILURE(2):update end |
| auto_re_arm | 默认为 0, 暂无使用 |
| ignore_if_disable | 默认为 0, 暂无使用 |
2、与传感器状态(Status)的关系
| self.sensor_status | 传感器状态 |
|---|---|
| 默认 | Enabled |
disable_scanning == disabled ordisable_all == disabledor disable_scanning_local == disabled |
Disabled |
3、获取 self.sensor_status 的取值
由于该状态为组件内部管理的变量,因此正常情况无法获知其具体取值,但我们也有特殊途径可以获知,比如 IPMI 命令
• GetSensorEventStatus
0x04 0x2B <sensor number>
关注返回体中除 CompletionCode 外的第一个返回值的高三位
bit7:取值即 disable_all 的取值
bit6:取值即 disable_scanning 的取值
bit5:取值取反即 disable_scanning_local 的取值
• GetSensorReading
0x04 0x2D <sensor number>
关注返回体中除 CompletionCode 外的第二个返回值的高三位
bit7:取值即 disable_all 的取值
bit6:取值即 disable_scanning 的取值
bit5:取值为 1,表示 disable_scanning_local == disabled or disable_access_error == disabled or initial_update_progress == update in progress
Q5: AssertMask、DeassertMask、ReadingMask分别的作用
三种Mask的置位一定是匹配的
1、AssertMask
当且仅当对应掩码置位时,满足对应的门限值才会更新传感器状态及上报事件
[15:12] - 指示通过Get Sensor Reading命令返回哪个lower threshold的比较状态
- [15] - 保留, 0b
- [14] - 返回 lower non-recoverable threshold
- [13] - 返回 lower critical threshold
- [12] - 返回 lower non-critical threshold
[11:0] - 阈值Assertion事件掩码
assertion event for %1 %2 going %3 supported
- [11] - %1=upper, %2=non-recoverable, %3= high
- [10] - %1=upper, %2=non-recoverable, %3= low
- [9] - %1=upper, %2=critical, %3= high
- [8] - %1=upper, %2=critical, %3= low
- [7] - %1=upper, %2=non-critical, %3= high
- [6] - %1=upper, %2=non-critical, %3= low
- [5] - %1=lower, %2=non-recoverable, %3= high
- [4] - %1=lower, %2=non-recoverable, %3= low
- [3] - %1=lower, %2=critical, %3= high
- [2] - %1=lower, %2=critical, %3= low
- [1] - %1=lower, %2=non-critical, %3= high
- [0] - %1=lower, %2=non-critical, %3= low
2、DeassertMask
当且仅当对应掩码置位时,才可恢复对应事件
[15:12] - 指示通过Get Sensor Reading命令返回哪个upper threshold的比较
状态
[15】- 保留,0b
[14] - 返回 upper non-recoverable threshold
[13]- 返回 upper critical threshold
[12】- 返回 upper non-critical threshold
[11:0] - 闽值Assertion事件掩码
assertion event for %1 %2 going %3 supported
[11] – %1=upper, %2=non-recoverable, %3= high
[10] - %1=upper,%2=non-recoverable, %3= low
[9] – %1=upper,%2=critical, %3= high
[8] – %1=upper,%2=critical, %3= low
[7] - %1=upper,%2=non-critical,%3= high
[6] - %1=upper,%2=non-critical, %3= low
[5] - %1=lower,%2=non-recoverable, %3= high
[4] - %1=lower,%2=non-recoverable, %3= low
[3] - %1=lower,%2=critical,%3= high
[2] – %1=lower,%2=critical,%3= Low
[1] - %1=lower,%2=non-critical,%3= high
[0] - %1=lower,%2=non-critical, %3= low
3、ReadingMask
当前仅当对应掩码置位时,北向才可显示对应门限值
[15:8]- 可写的threshold掩码,指示通过Get Sensor Thresholds命令返
回哪个可写的thresholds
[15:14] - 保留,00b
%1 %2 threshold is settable
[13] – %1=upper, %2=non-recoverable
[12] – %1=upper,%2=critical
[11] - %1=upper,%2=non-critical
[10] – %1=lower,%2=non-recoverable
[9] - %1=lower, %2=critical
[8] – %1=lower, %2=non-critical
[7:0] - 可读的threshold掩码,指示通过Get Sensor Thresholds命令返回
哪个可读的thresholds
[7:6]- 保留,00b
%1 %2 threshold is readable
[5] - %1=upper,%2=non-recoverable
[4] – %1=upper, %2=critical
[3] – %1=upper, %2=non-critical
[2] – %1=lower, %2=non-recoverable
[1] – %1=lower, %2=critical
[0] – %1=lower,%2=non-critical
五、历史问题收集
TODO
交流区
例:我想了解传感器状态对应关系
答复: 已补充在第x小结