pythonpython-3.xipmi

Error <bound method Node.getCpuPowerUsage of <__main__.Node instance at 0x7f6f60c6b8c0>>


I just want to print the PowerUsage of my system in a python script. My script is part of a monitoring script. and i get the error <bound method Node.getCpuPowerUsage of <__main__.Node instance at 0x7f6f60c6b8c0>>


def getPowerUsage(self):
      self.powerUsage = os.popen("sudo ipmi-oem intelnm get-node-manager-statistics mode=globalpower | awk '$1 == \"Current\" {print $4}'").read().replace("\n", "")
      return self.powerUsage
node1 = Node(0, 0, 0)
node1.getPowerUsage()
node1.getGpuPowerUsage()
node1.getCpuPowerUsage()
print(node1.getPowerUsage)

the output of the command sudo ipmi-oem intelnm get-node-manager-statistics mode=globalpower | awk '$1 == \"Current\" {print $4}'").read().replace("\n", "") looks like this

$sudo ipmi-oem intelnm get-node-manager-statistics mode=globalpower | awk '$1 == \"Current\" {print $4}'").read().replace("\n", "")
 185



Solution

  • Just replace print(node1.getPowerUsage) with print(node1.getPowerUsage()) like gmds said