1

I'd like to use IPMI to set machines to PXE boot (i.e. ipmitool -I lan -U username -P password -H ipaddress chassis bootdev pxe) and then power cycle them (i.e. ipmitool -I lan -U username -P password -H ipaddress chassis power cycle). However, I'd like to do this in a python script so I'm trying to use OpenIPMI and its python bindings.

I can't seem to find any documentation on OpenIPMI for a python script and I'm not sure how to correctly apply IPMI commands (making sure the machine is in the right state so the commands don't fail). Can someone please show me some pointers or resources on using OpenIPMI (or an alternative) to operate IPMI commands in python? Thanks!

William
  • 213
  • 6
  • 15
  • You can use the following: https://github.com/kontron/python-ipmi or https://git.openstack.org/cgit/openstack/pyghmi/log/ see also the munin program http://hg.logilab.org/master/munin_ipmi_plugins/file/f2e7c91f5ea7/ipmi_sensor_ – user480918 Jul 28 '18 at 15:25

2 Answers2

2

So while you're trying to figure out the IPMI bindings, why not write simple wrappers for the commandline ipmitool? Later you can figure out how to get the python bindings to work right and sub them in; for now, use subprocess.Popen() and friends.

pjz
  • 10,595
  • 1
  • 32
  • 40
  • I did just that and it seems to work for the moment, but I'm not sure how to tell if a subprocess.Popen() failed. – William Jul 01 '10 at 19:01
  • Use subprocess.check_call(). Or look at the return_code attribute on your subprocess.Popen object after it's finished (use .communicate() or .wait() to make sure it's finished.) – Greg Price Jul 01 '10 at 19:07
1

I was going to write a bit about import the OpenIPMI module and then running help() on it, but that's not going to help much :P

The OpenIPMI Python bindings sadly come with virtually no documentation whatsoever. On quick inspection, the only OpenIPMI package on Fedora that has at least some form of documentation is the OpenIPMI package itself, which has some manpages.

The OpenIPMI-devel package doesn't even have documentation. If you find some documentation - and I admittedly haven't really looked anywhere outside of my own system - I'd be interested!

wzzrd
  • 10,409
  • 2
  • 35
  • 47