-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File system based sensors implementation for voltage and current sensors #426
Conversation
@Junchao-Mellanox @keboliu could you review |
@keboliu , Pls recheck |
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
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)