diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index 9967e2d0..d70ff53c 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -778,6 +778,18 @@ class Command(object): summary['badreadings'] = fallbackreadings return summary + def get_system_power_watts(self): + self.oem_init() + return self._oem.get_system_power_watts(self) + + def get_inlet_temperature(self): + self.oem_init() + return self._oem.get_inlet_temperature(self) + + def get_average_processor_temperature(self): + self.oem_init() + return self._oem.get_average_processor_temperature(self) + def get_sensor_reading(self, sensorname): """Get a sensor reading by name diff --git a/pyghmi/ipmi/oem/generic.py b/pyghmi/ipmi/oem/generic.py index 642cb275..af89bf89 100644 --- a/pyghmi/ipmi/oem/generic.py +++ b/pyghmi/ipmi/oem/generic.py @@ -14,7 +14,7 @@ import pyghmi.exceptions as exc import pyghmi.ipmi.private.constants as event_const - +import struct class OEMHandler(object): """Handler class for OEM capabilities. @@ -41,6 +41,79 @@ class OEMHandler(object): """ return {} + def get_system_power_watts(self, ipmicmd): + # Use DCMI getpower reading command + rsp = ipmicmd.xraw_command(netfn=0x2c, command=2, data=(0xdc, 1, 0, 0)) + wattage = struct.unpack(' 1: + raise Exception('TODO: how to deal with multiple inlets') + self._inlet_name = airinlets[0] + elif extenv: + if len(extenv) > 1: + raise Exception('TODO: how to deal with multiple external environments') + self._inlet_name = extenv[0] + return ipmicmd.get_sensor_reading(self._inlet_name) + def process_event(self, event, ipmicmd, seldata): """Modify an event according with OEM understanding. diff --git a/pyghmi/ipmi/oem/lenovo/energy.py b/pyghmi/ipmi/oem/lenovo/energy.py index ff826e24..b6a5914e 100644 --- a/pyghmi/ipmi/oem/lenovo/energy.py +++ b/pyghmi/ipmi/oem/lenovo/energy.py @@ -28,6 +28,7 @@ class EnergyManager(object): # get the handle (which has always been the same, but just in case self.iana = bytearray(b'\x66\x4a\x00') self._usefapm = False + self._mypowermeters = () try: rsp = ipmicmd.xraw_command(netfn=0x3a, command=0x32, data=[4, 2, 0, 0, 0]) if len(rsp['data']) >= 8: