hardware: set PDU voltage thresholds
The datasheet says that min/max values are:
- 3V3: 3.17V/3.47V
- 5V: 4.8V/5.25V
- 12V: 11.64V/12.6V
So these values are our critical values and we warn a little bit before
reaching those.
Change-Id: I3b9ded8477c6054218553581414978c92bf0e092
diff --git a/src/ietf-hardware/Factory.cpp b/src/ietf-hardware/Factory.cpp
index ee81212..ea1f97f 100644
--- a/src/ietf-hardware/Factory.cpp
+++ b/src/ietf-hardware/Factory.cpp
@@ -26,7 +26,16 @@
Group pduGroup;
pduGroup.registerDataReader(StaticData("ne:pdu", "ne", {{"class", "iana-hardware:power-supply"}}));
- pduGroup.registerDataReader(SysfsValue<SensorType::VoltageDC>("ne:pdu:voltage-12V", "ne:pdu", pduHwmon, 1));
+ pduGroup.registerDataReader(SysfsValue<SensorType::VoltageDC>("ne:pdu:voltage-12V",
+ "ne:pdu",
+ pduHwmon,
+ 1,
+ Thresholds<int64_t>{
+ .criticalLow = OneThreshold<int64_t>{11640, 50},
+ .warningLow = OneThreshold<int64_t>{11790, 50},
+ .warningHigh = OneThreshold<int64_t>{12450, 50},
+ .criticalHigh = OneThreshold<int64_t>{12600, 50},
+ }));
pduGroup.registerDataReader(SysfsValue<SensorType::Current>("ne:pdu:current-12V", "ne:pdu", pduHwmon, 1));
pduGroup.registerDataReader(SysfsValue<SensorType::Power>("ne:pdu:power-12V", "ne:pdu", pduHwmon, 1));
pduGroup.registerDataReader(SysfsValue<SensorType::Temperature>("ne:pdu:temperature-1",
@@ -60,11 +69,29 @@
.criticalHigh = OneThreshold<int64_t>{45000, 1000},
}));
- pduGroup.registerDataReader(SysfsValue<SensorType::VoltageDC>("ne:pdu:voltage-5V", "ne:pdu", pduHwmon, 2));
+ pduGroup.registerDataReader(SysfsValue<SensorType::VoltageDC>("ne:pdu:voltage-5V",
+ "ne:pdu",
+ pduHwmon,
+ 2,
+ Thresholds<int64_t>{
+ .criticalLow = OneThreshold<int64_t>{4800, 50},
+ .warningLow = OneThreshold<int64_t>{4900, 50},
+ .warningHigh = OneThreshold<int64_t>{5150, 50},
+ .criticalHigh = OneThreshold<int64_t>{5250, 50},
+ }));
pduGroup.registerDataReader(SysfsValue<SensorType::Current>("ne:pdu:current-5V", "ne:pdu", pduHwmon, 2));
pduGroup.registerDataReader(SysfsValue<SensorType::Power>("ne:pdu:power-5V", "ne:pdu", pduHwmon, 2));
- pduGroup.registerDataReader(SysfsValue<SensorType::VoltageDC>("ne:pdu:voltage-3V3", "ne:pdu", pduHwmon, 3));
+ pduGroup.registerDataReader(SysfsValue<SensorType::VoltageDC>("ne:pdu:voltage-3V3",
+ "ne:pdu",
+ pduHwmon,
+ 3,
+ Thresholds<int64_t>{
+ .criticalLow = OneThreshold<int64_t>{3170, 25},
+ .warningLow = OneThreshold<int64_t>{3240, 25},
+ .warningHigh = OneThreshold<int64_t>{3400, 25},
+ .criticalHigh = OneThreshold<int64_t>{3470, 25},
+ }));
pduGroup.registerDataReader(SysfsValue<SensorType::Current>("ne:pdu:current-3V3", "ne:pdu", pduHwmon, 3));
pduGroup.registerDataReader(SysfsValue<SensorType::Power>("ne:pdu:power-3V3", "ne:pdu", pduHwmon, 3));