The other day I noticed an(other) horribly annoying thing about Dell PowerEdge servers: nothing in the iDRAC settings that is useful to change can be changed without either a reboot or at least resetting the DRAC itself. Obviously rebooting is unacceptable for a production server, unnecessarily painful for virtualization hosts, and might totally clobber your ability to contact the DRAC after a reset if you cannot reach its default address subnet after a reset (192.68.0.20 or something like that is the default address).
It turns out that all this mess is totally unnecessary if one just ignores the (stupid) web interface to the DRAC and the RACADM interface and instead sends straight IPMI commands with a utility like ipmitool. I found a script written by Tanner Stokes that makes the “user string” setting easy to do on the fly, and abstracts away the mess of getting hex values for each string character (IPMI can do anything, but none of it is straight forward). Here is my update of that script:
#!/usr/bin/python3 # This script changes the LCD user string on Dell machines that conform to IPMI 2.0 from subprocess import call from sys import stderr target_host = input ('\nEnter name or IP of target host:\n'); user_string = input('Enter LCD string:\n') hex_string = ' '.join([hex(ord(z)) for z in user_string]) print('\nTrying to change LCD string on {0}...'.format(target_host)) try: retcode = call('/usr/sbin/ipmitool -H {0} -I lan -U root raw 0x6 0x58 193 0 0 {1} {2}'.format(target_host, str(len(user_string)), hex_string), shell=True) if retcode == 0: print('Success!') elif retcode < 0: print('Terminated by signal', -retcode, file=stderr) else: print('Oops! Returned', retcode, file=stderr) except OSError as e: print('Failed with error:', e, file=stderr) # The following supposedly sets the user string to show on the LCD, but # is still broken (probably wrong function number) -CRE # retcode = call('/usr/sbin/ipmitool -H {0} -I lan -U root raw 0x6 0x58 194 0'.format(target_host)) ############################################################################## # Changelog: # # Tanner Stokes - tannr.com - 2010-02-26 # * Original author # # Craig Everett <zxq9@zxq9.com> 2013-12-13 # * Update to Python3 # * Pythonification # * Cosmetic changes
It would be better if it were wrapped in an optional main(), accepted arguments for the target_host and user_string, and accepted the name of an input file to go through — but I’m not excited enough just now to do that. In any case, thanks, Tanner!