Deployment Solution

 View Only

Put IPMI or DRAC Comands in a Job (even custom commands!) with DS for Dell Servers. 

Dec 18, 2006 11:41 AM

Deployment Solution for Dell Severs contains a very powerful feature that often goes unnoticed, - Power Control. This feature isn't just for the "Power Hungry Network Administrators" but can make life a lot easier for anyone involved with data centers, or individuals managing servers from a distance.

Dell Servers (and many other brands of servers) have power control features that allow you to communicate with the motherboard and remotely and hard reset, power off, power on, read sensor values, turn on it's identity feature and other various functions.

Deployment Solution for Dell Servers version 2.0SP1 adds some of these features to the Deployment Solution Console through the right clicking of computers and going to "Power Control", but what if you want to have these commands sent on a schedule, or access other "hidden" commands besides controlling the power state? Without knowledge of the underlying database or embedded utilities, this would be a difficult task, but I've done the work for you. Here's how to do it!

We will be covering the following commands:

DRAC

  • Power On
  • Power Off
  • Hard Reset
  • Hard Reset the DRAC card
  • Get System event log

IPMI

  • Power On
  • Power Off
  • Hard Reset
  • Turn on/off the Identity feature (indicator light on front of chassis)
  • Get health sensor information (temperature, fan speeds, etc)
  • Retrieve the firmware System Event Log

Other features are available for both DRAC and IPMI that will not be specifically covered. Other IPMI features include writing an asset tag to the FRU chassis, configuring BMC Serial port, setting watchdog timer parameters, or sending any IPMI commands via hex value and many others will not be explained specifically, but are done in a very similar way (consult Dell\atools\power\ipmiutil\UsersGuide.txt for details). Other DRAC features include getting sensor info, viewing the system event log, setting RAC information among many others. Syntax for the racadm utility can be found at Tools->Dell Tools->Dell DTK – Command Line User Reference or by executing the command on the command line.

While it is not necessary that these commands run on your DS console, this is easiest because if you have Deployment Solution for Dell Severs already installed, all the necessary IPMI tools and the database are already in place. If you have a firewalled environment where your Deployment Console cannot access the machines directly except through aclient, see "Firewalled Environment Setup" towards the end of this document.

I should probably mention that in order for these scripts to be effective you must have the existing power control entries in the database for the machines you intend to run these scripts on. This is part of the setup of Deployment Solution for Dell Servers. To add these entries go to Tools->Dell Tools->Configuration Utility and then to the Power Control tab. Perform a discovery for DRAC or BMC controllers using a given IP address range, username and password. I like to speed up discovers by changing the PowerControlDiscoveryBreadth tag in Dell\atools\DellConfig.xml from 15 to 100. After performing discovers you can look through the log to see which entries were added.

Pre-requisites: Deployment Solutions for Dell Servers 2.0SP1 installed on Deployment Solution version 6.8 or newer! Also, we are assuming you have already added your machines to the database using the Configuration Utility under Tools->Dell Tools>Power Control.

Section I – Import the "DRAC-IPMI-Action.bin" job file.

  • Step 1: Right click on "Jobs" in the Job pane.
  • Step 2: Click on "Import"
  • Step 3: Navigate to the "DRAC-IPMI-action.bin" file you downloaded from this article & Press OK to import.

This job is a template to perform IPMI and DRAC commands. It contains two scripts, one for IPMI and one for DRAC. Depending on what type of entry you entered in the database, Deployment Solution will run the proper script. If no entries exist, the script will fail to run.

Section II -- How to customize this generic job to do predefined actions:

We will use as an example a "Hard Reset" command for DRAC and IPMI. This job will allow you to hard-reset a machine via IPMI or DRAC (whichever it has) whether or not it has an OS on it. Perform the following steps:

  • Step 1: Make a copy of the DRAC/IPMI Action job you just imported. Name it "Hard Reset"
  • Step 2: With the job selected, look at the "Condition" field under the job details pane. You will see two options "If DRAC entry exists", and "If IPMI entry exists". Toggling this field will allow you to see the respective script that will run under those two circumstances. Let's start with DRAC. With "If DRAC exists" selected click on "Run Script" and press modify.
  • Step 3: Make sure the password is set to the password that has been set in your DRAC configuration.
  • Step 4: Browse through the example DRAC Commands and uncomment the line (delete the double colon) under "Hard Reset Machine".
  • Step 5: Press Next and then Finish.
  • Step 6: Let's Modify the IPMI script now. Toggle the Condition field to "If IPMI entry Exists". Click "Run Script" and then Modify.
  • Step 7: Browse through the example IPMI commands and uncomment the line under "Hard Reset Machine". Note: You do not need to enter your password, it is retrieved from the database.
  • Step 8: Press Next and then Finish.

The job is now ready to drag on any machine! You are now free to copy the DRAC/IPMI Action job again and uncomment different lines to perform other actions. Note: You are not limited to doing one command. For instance, I could uncomment the line that sends the "Turn Identity Feature ON" and "Power Off".

Section III – Other Commands

To use other commands write your call to the utilities with the proper syntax for that command. There are some commands in the example that provide output other than "Success" such as "Get Sensor Values" or "Get System Log". The IPMI and DRAC scripts have a variable called %RAClog% that point to the location Dell\alogs\ID_rac.txt. Look in that location for all script output. If you prefer to have this file appended instead of replaced every time a job is run change the ">" in the call to the command to ">>".

Firewalled Environment Setup

The above example is in a simple environment where there is no firewall between the Deployment Server and the client machines, but this is often not the case. Many users have a firewall between their Deployment Server and the servers they are managing with only specific ports open for DS communications. Issuing DRAC or IPMI commands from the DS console directly may not be desirable from a security viewpoint since extra ports would have to be opened which may make network administrators uneasy. Therefore, there is a relatively easy workaround to send Power Control commands from your DS console via a machine within the firewall using the ports that are already open!

The solution to this problem is fairly easy. You simply have a machine within the firewall be a spokesperson for the Deployment Server and issue power control commands on it's behalf. There is one thing you give up in doing this however, and that is that the machine in which you want to send the power control command to needs to be declared in the script. This is because the script will always need to be dragged onto the spokesmachine (not a word, but you get the idea), not the machine you are sending the command to.

So let's get started. I will use IPMI as an example, but racadm.exe may be used in a similar way:

Step 1: Create a new job and create a new "Copy File to" task. Select the "Copy Directory" radio button, and then for the "Source Path" value browse to your eXpress share, and then to Dell\atools\power\ipmiutil. In destination path enter something like C:\ (you can exercise creative license here). What this will do is copy down the utilities to the spokesmachine. You can now either create a new job, or create another task on the existing job for the next step.

Step 2: You can use the attached file as a template and modify it accordingly, or you can use this script below. I will use Reset in this example.
set clientID=500001
set username=%#*"select userid from dbo.dell_power where computer_id=%clientID%"%
set password=%#*"select password from dbo.dell_power where computer_id=%clientID%"%
set clientIP=%#*"select dracip from dbo.dell_power where computer_id=%clientID%"%
wlogevent -id:%clientID% -c:0 -l:1 -ss:"Sending message to %clientIP%"
::
::IPMI Commands - Uncomment your desired action (usually just one line)
::------Power On
::"C:\ipmiutil\hwreset.exe" -u -N %clientIP% -U %username% -P %password%
::------Power Off
::"C:\ipmiutil\hwreset.exe" -d -N %clientIP% -U %username% -P %password%
::------Hard Reset Machine
"C:\ipmiutil\hwreset.exe" -c -N %clientIP% -U %username% -P %password%
::------Turn Identity Feature on for 12 hours (often the LED on the front)
::"C:\ipmiutil\alarms.exe" -i21600 -N %clientIP% -U %username% -P %password%
::------Turn Identity Feature off (often the LED on the front)
::"C:\ipmiutil\alarms.exe" -i0 -N %clientIP% -U %username% -P %password%
::
if not "%errorlevel%"=="0" GOTO error
wlogevent -id:%ID% -c:0 -l:1 -ss:"IPMI command was successful"
GOTO eof

:error
wlogevent -id:%ID% -c:1 -l:3 -ss:"IPMI utility returned %errorlevel%"

:eof

Step 3: Make sure to fill the clientID with the Machine number of the machine you intend to reset. You should now be able to drag this job on the spokemachine and it will issue the power control command to the client machine.

License: AJSL
By clicking the download link below, you agree to the terms and conditions in the Altiris Juice Software License
Support: User-contributed tools on the Juice are not supported by Altiris Technical Support. If you have questions about a tool, please communicate directly with the author by visiting their profile page and clicking the 'contact' tab.

Statistics
0 Favorited
0 Views
3 Files
0 Shares
0 Downloads
Attachment(s)
GIF file
Conditions.GIF   4 KB   1 version
Uploaded - Feb 25, 2020
zip file
DRAC-IPMI-action.zip   2 KB   1 version
Uploaded - Feb 25, 2020
JPG file
Script View.JPG   58 KB   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Related Entries and Links

No Related Resource entered.