commit | f6b7e0a49db00a2286b8d0611133a7318df30bd5 | [log] [tgz] |
---|---|---|
author | Tao Lin <lintao.lc@inspur.com> | Sun Oct 09 09:35:44 2022 +0800 |
committer | Patrick Williams <patrick@stwcx.xyz> | Tue Nov 01 16:16:08 2022 +0000 |
tree | 11a78d4ae759bf56c6abcda343cdc9d5eecc6d5e | |
parent | 91799dbd7bde184f1c7db1525df9329e841512ad [diff] |
Add func for Maximum when sensor from DBus Add function to calculate the maximum value. Tested: in entity-manager/baseboard.json: add virtual sensor use Type=Maximum: ``` { "Exposes": [ { "Name": "NVMe MAX Temp", "Sensors": [ "NVMe 0 Temp", "NVMe 1 Temp", "NVMe 2 Temp", "NVMe 3 Temp", "NVMe 4 Temp" ], "Thresholds": [ { "Direction": "greater than", "Name": "upper critical", "Severity": 1, "Value": 116 }, { "Direction": "less than", "Name": "lower critical", "Severity": 1, "Value": 1 } ], "Type": "Maximum", "Units": "DegreesC" } ], "Logging": "Off", "Name": "NVMe MAX", "Probe": "TRUE", "Type": "NVMe", "xyz.openbmc_project.Inventory.Item.Chassis": {} } ``` in phosphor-virtual-sensor/virtual_sensor_config.json ``` { "Desc": { "Config": "D-Bus", "Type": "Maximum" } } ``` root@NULL:~# busctl tree xyz.openbmc_project.VirtualSensor `-/xyz `-/xyz/openbmc_project `-/xyz/openbmc_project/sensors/temperature |-/xyz/openbmc_project/sensors/temperature/NVMe_MAX_Temp root@NULL:~# ipmitool sensor list | grep -i NVMe NVMe_MAX_Temp |70| degrees C |na| na|1.000|6.000|111.000|116.000|na root@NULL:~# Signed-off-by: Tao Lin <lintao.lc@inspur.com> Change-Id: I620a0ee3c3cc4dbae6485c77fe4e47c62a04a804
phosphor-virtual-sensor reads in virtual_sensor_config.json There are two types of data in this file:
See virtual_sensor_config.json in this repository for an example. Sensors added this way can use any expression that is accepted by exprtk.
For example:
{ "Desc": { "Config": "D-Bus", "Type": "ModifiedMedian" } }
Sensors added this way can only use a set of restricted calculations. At this stage the only type supported is modifiedMedian.
The virtual sensor configuration information needs to be added into the relevant hardware configuration file in entity-manager. This method of adding a virtual sensor allows a recipe that builds for different hardware configurations to have different virtual sensors for each configuration.
The virtual sensor configuration in entity manager follows a different format to the JSON in virtual_sensor_config.json (specified in entity-manager/schemas/VirtualSensor.json).