File system based sensors implementation for voltage and current sensors#426
Merged
bmridul merged 12 commits intosonic-net:masterfrom Mar 4, 2024
Merged
File system based sensors implementation for voltage and current sensors#426bmridul merged 12 commits intosonic-net:masterfrom
bmridul merged 12 commits intosonic-net:masterfrom
Conversation
Collaborator
|
@Junchao-Mellanox @keboliu could you review |
keboliu
reviewed
Jan 24, 2024
Collaborator
Author
|
@keboliu , Pls recheck |
prgeor
reviewed
Feb 7, 2024
prgeor
reviewed
Feb 7, 2024
prgeor
reviewed
Feb 7, 2024
prgeor
reviewed
Feb 7, 2024
Comment on lines
+70
to
+102
| def get_high_critical_threshold(self): | ||
| """Returns the sensor critical high threshold value""" | ||
| return self.high_thresholds[2] | ||
|
|
||
| def get_low_critical_threshold(self): | ||
| """Returns the sensor critical low threshold value""" | ||
| return self.low_thresholds[2] | ||
|
|
||
| def set_high_critical_threshold(self, value): | ||
| """Sets the sensor critical high threshold value""" | ||
| self.high_thresholds[2] = value | ||
| return True | ||
|
|
||
| def set_low_critical_threshold(self, value): | ||
| """Sets the sensor critical low threshold value""" | ||
| self.low_thresholds[2] = value | ||
| return True | ||
|
|
||
| def get_minimum_recorded(self): | ||
| """Retrieves the minimum recorded sensor measurement""" | ||
| tmp = self.get_value() | ||
| if tmp is None: | ||
| return None | ||
| if self.minimum_sensor is None or tmp < self.minimum_sensor: | ||
| self.minimum_sensor = tmp | ||
| return self.minimum_sensor | ||
|
|
||
| def get_maximum_recorded(self): | ||
| """Retrieves the maximum recorded sensor measurement""" | ||
| tmp = self.get_value() | ||
| if tmp is None: | ||
| return None | ||
| if self.maximum_sensor is None or tmp > self.maximum_sensor: |
Collaborator
There was a problem hiding this comment.
@bmridul can we have these in https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sensor_base.py as the default implementation?
Collaborator
Author
There was a problem hiding this comment.
I looked into this, this would imply creating the private members of this implementation be put in the abstract base class. I think these are better left here.
Collaborator
There was a problem hiding this comment.
@bmridul this part I am still not clear...why most of these APIs are not in base class given that it has nothing to do with FS implement or not
prgeor
reviewed
Feb 7, 2024
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
prgeor
approved these changes
Mar 4, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A file system based sensors implementation for Sensormond. Platforms can provide the sensor definition
in a file and Sensormond can use that to monitor the sensors.
HLD Reference: sonic-net/SONiC#1394
Description
Chassis base class looks for the presence of the file for sensors definition and uses that to built a list of sensor
objects if available.
Motivation and Context
See HLD mentioned above. This provides a simple implementation for platform support for Sensormond if the platforms have only Sysfs based sensors.
How Has This Been Tested?
Unit tested and tested on target.
root@sonic:/usr/local/etc# cat sensors.yaml
voltage_sensors:
sensor: '/sys/bus/i2c/devices/23-0064/hwmon/hwmon49/in9_input'
high_thresholds: [ 3560, 3600, 3630 ]
low_thresholds: [ 2970, 3000, 3040 ]
sensor: '/sys/bus/i2c/devices/23-0064/hwmon/hwmon49/in7_input'
high_thresholds: [ 3560, 3600, 3630 ]
low_thresholds: [ 2970, 3003, 3040 ]
cisco@sonic:~$ show platform volt
Sensor Voltage High TH Low TH Crit High TH Crit Low TH Warning Timestamp
VP3P3_CPU_RTC 3300 mV 3600 3000 3630 3040 False 20231125 20:01:05
VP3P3_CPU_SATA 3286 mV 3600 3003 3630 3040 False 20231125 20:01:05
Additional Information (Optional)