Friday, August 7, 2015

How To: Clear Dell iDRAC Job Queue

I'm in the process of deploying 41 new Dell R630 PowerEdge servers in our HPC environment. To help manage the hardware I'm using a new tool (to us anyways), Dell OpenManage Essentials.

OME requires a Microsoft Windows OS, luckily (since we are a Linux shop) it's a snap to install Windows Server 2012 in KVM.

Some of the functionality provided by OME:

  • Reporting and alerting
  • Firmware upgrades
  • Configuration deployment (BIOS settings, iDRAC, RAID, etc...)
  • Bare metal provisioning
While OME is free, some of the features require a license. I've only been using OME for a couple of days so I haven't had a chance to test all of its features, but I have found that configuration requires a license (ex: ability to push a configuration template out to a node(s)). Firmware upgrades and reporting do not require a license.

The first task to be handled by OME, firmware upgrades on all 41 nodes. My initial attempts failed. Reading through the logs revealed that the remote clients couldn't reach TCP port 1278 on the OME server. Firmware upgrades started deploying after opening that TCP 1278 in the Windows firewall.

Each server had a long list of upgrades including BIOS, iDRAC, and the 6 network cards (mix of 10Gbit and 1Gbit). All of the firmware deployed successfully, with the exception of the Ethernet cards. Grrr, back to the scanning the logs.


Results:  
 Downloading Packages.
 Calling InstallFromUri method to Download packages to the iDRAC 
 There are some pending reboot jobs on the iDRAC that maybe block updating the system. It is recommended that you clear all the jobs before updating
 Downloading Package: Network_Firmware_6FD9P_WN64_16.5.20_A00.EXE onto the iDRAC 
 Package download has successfully started and the Job ID is JID_388846411941
 The URI given to the iDRAC to download from: http://192.168.2.69:1278/install_packages/Packages/Network_Firmware_6FD9P_WN64_16.5.20_A00.EXE

Ok, but how do you do this? I didn't see any native way to do this from within OME, so on to Google.

Thanks to this post on Jon Munday's blog, I was able to clear the pending jobs with a little PowerShell for loop action to hit all nodes.

The following command displays the job queue for the range of compute nodes (192.16.2.10 thru 50)

For ($i=10; $i -lt 51; $i++) { winrm e cimv2/root/dcim/DCIM_LifecycleJob -u:$USER -p:$PASSWORD -SkipCNcheck -SkipCAcheck -r:https://192.168.2.$i/wsman -auth:basic -encoding:utf-8 }
 
The next command clears the queue. Sorry for the long single line, I don't know if PowerShell supports spanning a command across multiple lines like I can do in Bash:

For ($i=10; $i -lt 51; $i++) { winrm invoke DeleteJobQueue "cimv2/root/dcim/DCIM_JobService?CreationClassName=DCIM_JobService+Name=JobService+SystemName=Idrac+SystemCreationClassName=DCIM_ComputerSystem" '@{JobID="JID_CLEARALL"}' -r:https://192.168.2.$i/wsman -u:$USER -p:$PASSWORD -SkipCNCheck -SkipCACheck -auth:basic -encoding:utf-8 -format:pretty }
 


Friday, May 29, 2015

A Linux User's First Time on a Mac

I'm in the process of switching from a Dell XPS 13 (Project Sputnik) ultrabook to a Macbook Pro 13 (Broadwell i7). The battery life on my current laptop was horrible, an hour of real world use with the screen dimmed and killing running applications like Scrooge. Unfortunately, the XPS solders the battery onboard, so it's not easily replaced (if at all?). It still functions great when near power.

You may be thinking, why would you do such a thing if you are a Linux user?

For starters, the specs for the Macbook Pro 13 (Spring 2015) are better than the XPS for a similar cost (how much is of course open to interpretation):
  • Intel 3.1 GHz Core i7-5557U vs  3.0 GHz Core i7-5500U Processor
  • 16 GB (optional) vs 8 GB RAM
  • Intel Iris 6100 vs Intel HD Graphics 5500
  • PCIe based SSD vs SATA
  • Non-touch Retina Display vs touch UltraSharp QHD+ (personally I don't see the value yet in having a touch screen on a Linux laptop, especially considering the screen doesn't completely fold over)
  • Magsafe Power Adapter
  • Proven battery life
I do most of my work via SSH to the Linux systems, so the workstation doesn't have to be Linux, although it makes life much less painful. I figured, what the heck, let's try a BSD like system that has a history of awesome battery life.

Without further ado, here are some of my experiences using a Mac and OSX for the first time as a Linux user.

Useful Applications

  • Oh My Zsh - Trying out Zsh shell as an alternative for Bash for the first time, pretty darn cool.
  • Caffeine - Useful for temporarily preventing the laptop from sleeping (don't kill my SSH or VPN connections, dangit!
  • iTerm2 - Really nice terminal replacement for the builtin OSX terminal. Ton's of features like built in Tmux, search, transparent background, it's own built in auto completion (Cmd ;), etc... This part was what got me searching for a new terminal in the first place "Coming from a Unix world? You'll feel at home with focus follows mouse, copy on select, middle button paste, and keyboard shortcuts to avoid mousing."
  • MagicPrefs - This app lets you configure middle mouse paste functionality on the trackpad (set mine to three finger press)
  • XChat Azure - Excellent IRC client
  • TextWrangler - Extremely nice graphical script editor
  • Microsoft Office 2016 Preview - Because I need it Office work

Graphical Text Editor

I use vi/vim extensively on Linux and now on my Macbook Pro. That said, I do like to edit in a GUI text editor as well. After a good bit of searching around, TextWrangler is the (free) one I've been most happy using.

The way I understand it, TextWrangler is sort of the little brother to the professional product BBEdit, which adds "its extensive professional feature set including Web authoring capabilities and software development tools". I primarily work with Ruby (shell scripts, not Rails), Perl, Bash, Puppet and other system management type scripting, TextWrangler works very well for these.

One thing I found missing that I use regularly in other editors is the ability to duplicate a line without the cumbersome highlight, copy, paste. Many GUI editors provide this ability using a shortcut like Ctrl + d, or in vi, yy p (yank yank paste).

After searching around in the keyboard shortcuts a Google search led me to this post which mentioned creating an "AppleScript" to accomplish the task. What tha?

While the code did work, it left both the original and new lines highlighted, which was a bit annoying. I decided I wanted the cursor to remain where it originally was located. By the way, in TextWrangler, the "cursor" is called the "insertion point" both in the documentation and in AppleScript.

So, here's my updated script (my changes are the single lines following each comment):

tell application "TextWrangler"
  tell window 1
    # Get the current position for the cursor so we can pace it back
    set cursorLoc to characterOffset of selection
    select line the (startLine of the selection)
    copy (contents of the selection) as text to myText
    set the contents of the selection to myText & myText
    # Move the cursor back to the first column with a character
    select insertion point before character cursorLoc
  end tell
end tell  

I searched all over the place to get a hint how to place the cursor back in it's original location. As you can see, AppleScript isn't syntactically like Ruby, Perl, Java, etc... It's pretty funky and totally dynamic based on the application being scripted. TextWrangler provides a dictionary, but I didn't find they contents very helpful.

I finally stumbled on this post that mentions using "characterOffset of selection". Voila! All in all, it's pretty darn cool that the OS provides a simple way to extend the functionality of a GUI app.

Create the script in the AppleScript Editor (either launch it from Spotlight Search (Command Space) or click the script menu next to Help in TextWrangler and "Open Script Editor".

Copy and paste the code above, then save it in the directory
"~/Library/Application\ Support/TextWrangler/Scripts"
as something like DuplicateLine.scpt (the extension will get added automatically).

Next, restart TextWrangler and go to Window -> Palettes -> Scripts, click on DuplicateLine in the list and click Set Shortcut. Set it to whatever, I set mine to Ctrl D. This shortcut is already set to delete line, so I altered that shortcut in preferences to Shift Ctrl D.