xref: /openbmc/phosphor-power/phosphor-regulators/docs/sensor_monitoring.md (revision 8b38b177315d40f1f9bc1e4d0784d45ea17cbd5c)
180689db1SShawn McCarney# Sensor Monitoring
280689db1SShawn McCarney
380689db1SShawn McCarney## Overview
480689db1SShawn McCarney
580689db1SShawn McCarneySensor values such as output voltage, output current, and temperature can be
680689db1SShawn McCarneyread from some voltage regulators. Sensor values are measured, actual values
780689db1SShawn McCarneyrather than target values.
880689db1SShawn McCarney
980689db1SShawn McCarneyWhen [regulator monitoring](monitoring.md) is enabled, the `phosphor-regulators`
1080689db1SShawn McCarneyapplication reads sensor values once per second.
1180689db1SShawn McCarney
1280689db1SShawn McCarneyThe sensor values are stored on D-Bus on the BMC, making them available to
1380689db1SShawn McCarneyexternal interfaces like Redfish.
1480689db1SShawn McCarney
1580689db1SShawn McCarney## How sensor monitoring is defined
1680689db1SShawn McCarney
1780689db1SShawn McCarneySensor monitoring is defined for a voltage regulator using the
1880689db1SShawn McCarney[sensor_monitoring](config_file/sensor_monitoring.md) object in the
1980689db1SShawn McCarney[JSON config file](config_file/README.md).
2080689db1SShawn McCarney
2180689db1SShawn McCarneyThis object specifies actions to run, such as
2280689db1SShawn McCarney[pmbus_read_sensor](config_file/pmbus_read_sensor.md).
2380689db1SShawn McCarney
2480689db1SShawn McCarney## How sensors are stored on D-Bus
2580689db1SShawn McCarney
2680689db1SShawn McCarneyThe first time a sensor value is read, a corresponding sensor object is created
2780689db1SShawn McCarneyon D-Bus. On subsequent reads, the existing D-Bus sensor object is updated with
2880689db1SShawn McCarneythe new sensor value.
2980689db1SShawn McCarney
3080689db1SShawn McCarneyThe D-Bus sensor object implements the following interfaces:
3180689db1SShawn McCarney
3280689db1SShawn McCarney- xyz.openbmc_project.Sensor.Value
3380689db1SShawn McCarney- xyz.openbmc_project.State.Decorator.OperationalStatus
3480689db1SShawn McCarney- xyz.openbmc_project.State.Decorator.Availability
3580689db1SShawn McCarney- xyz.openbmc_project.Association.Definitions
3680689db1SShawn McCarney
3780689db1SShawn McCarneyAn existing D-Bus Sensor object is removed from D-Bus if no corresponding sensor
3880689db1SShawn McCarneyvalues are read during monitoring. This can occur in the following cases:
3980689db1SShawn McCarney
4080689db1SShawn McCarney- The regulator has been removed from the system (no longer present).
4180689db1SShawn McCarney- The regulator was replaced, and the new regulator supports a different set of
4280689db1SShawn McCarney  sensors values. For example, temperature_peak is no longer provided.
43*8b38b177SShawn McCarney- The chassis containing the regulator has an incorrect status, such as missing
44*8b38b177SShawn McCarney  or no input power.
4580689db1SShawn McCarney
4680689db1SShawn McCarneyWhen regulator monitoring is disabled, the following changes will be made to all
4780689db1SShawn McCarneyof the D-Bus sensor objects:
4880689db1SShawn McCarney
4980689db1SShawn McCarney- The Value property will be set to NaN.
5080689db1SShawn McCarney- The Available property will be set to false.
5180689db1SShawn McCarney
5280689db1SShawn McCarney## Error handling
5380689db1SShawn McCarney
5480689db1SShawn McCarneyIf an error occurs while reading the sensors for a voltage regulator rail:
5580689db1SShawn McCarney
5680689db1SShawn McCarney- The error will be logged. If the same error occurs repeatedly on a rail, it
5780689db1SShawn McCarney  will only be logged once per system boot.
5880689db1SShawn McCarney- Any remaining actions for the rail will be skipped.
5980689db1SShawn McCarney- The following changes will be made to all D-Bus sensor objects for this rail:
6080689db1SShawn McCarney  - The Value property will be set to NaN.
6180689db1SShawn McCarney  - The Functional property will be set to false.
6280689db1SShawn McCarney- Sensor monitoring will continue with the next rail or voltage regulator.
6380689db1SShawn McCarney- The sensors for this rail will be read again during the next monitoring cycle.
6480689db1SShawn McCarney
6580689db1SShawn McCarneyIf a subsequent attempt to read the sensors for the rail is successful, the
6680689db1SShawn McCarneyfollowing changes will be made to the D-Bus sensor objects:
6780689db1SShawn McCarney
6880689db1SShawn McCarney- The Value property will be set to the new sensor reading.
6980689db1SShawn McCarney- The Functional property will be set to true.
70