Utilizing IPMI KCS interface in Windows 2003

The article deals with the IPMI KCS interface in MS Windows Server 2003. To know more what is IPMI KCS, please take a look at the Intel specification. We can see KCS interface as a communication interface between host OS and service processor IPMI implementation. In the article can be found:

  • How to install the KCS IPMI interface.
  • How to setup logging of SEL records into Windows logs.
  • How to verify that the the two points above were done correctly and some tips & tricks that can be useful.

Installation of the driver and enabling Windows logging of SEL records

First two points - how to install KCS IPMI driver and enable logging of SEL records is pretty easy:
For Windows 2003 Server R2:
  • Install an optional Windows component 'Hardware Management'.
  • Add the device using command: "rundll32.exe ipmisetp.dll AddTheDevice" (in ipmisetp.dll is not a typo!)
For details of these steps follow a Microsoft document Hardware Management in Microsoft Windows Server 2003 R2 RC0 Following only the first paragraph -How to Enable the Hardware Management Feature - is sufficient for KCS IPMI interface driver installation. The Configuration and Security and further paragraphs are not required for our needs.

For Windows 2003 Server SP1 or SP2

  • Install Sun provided Sun ISM Driver
  • Install an ipmievd Windows service (part of ipmitool Windows port)
  • Start the ipmievd service
The process is nicely described in the documentation bundled with the Sun ISM Driver and with the IPMITool port for Windows, that you have downloaded according to the links above.

Verification that all is set properly

Now, let us see how to verify that everything is properly set up and we obtain a log record in Windows log after something is logged into SEL. We need to give some stimulation so that service processor of the server logs an event into SEL. One option we have is to go to the lab, and unplug one of power source cables - if we have spare ones, or ... put a screwdriver into a fan? - I bet it would work, but no - do not do that. Actually, do not stand up at all - we can use an ipmitool.

Ipmitool is a command line utility used for communication with IPMI capable devices. In our case, we will use ipmitool for creating a SEL record on service processor. We can connect to service processor using ipmitool over network or over KCS. The tool can be run on Solaris, Linux or also on MS Windows. The last option will be described since you may have already downloaded ipmitool (if you were using non-R2 windows). If not, dowload ipmitool now.

In this paragraph, we will find a sensor on our server and inject an IPMI event on it. To see what sensors do we have on the box, we can use command:
In case of non-R2 Windows:

ipmitool.exe -I ism -v sdr list
In case of R2 Windows we just tell ipmitool to use Microsoft driver, by option "-I ms" instead of "-I ism":
ipmitool.exe -I ms -v sdr list
The output looks simillar to the snippet provided below:
...
...
Sensor ID              : io.hdd3.fail (0x2b)

 Entity ID             : 4.3 (Disk or Disk Bay)

 Sensor Type (Discrete): Drive Slot / Bay

 States Asserted       : Digital State

                         [Predictive Failure Deasserted]

 Assertions Enabled    : Digital State

                         [Predictive Failure Deasserted]

                         [Predictive Failure Asserted]



Sensor ID              : mb.t_amb (0x5)

 Entity ID             : 7.0 (System Board)

 Sensor Type (Analog)  : Temperature

 Sensor Reading        : 20 (+/- 0) degrees C

 Status                : ok

 Upper non-recoverable : 80.000

 Upper critical        : 75.000

 Upper non-critical    : 70.000

 Positive Hysteresis   : 2.000

 Negative Hysteresis   : 2.000

 Minimum sensor range  : Unspecified

 Maximum sensor range  : Unspecified

 Event Message Control : Per-threshold

 Readable Thresholds   : unc ucr unr 

 Settable Thresholds   : unc ucr unr 

 Threshold Read Mask   : unc ucr unr 

 Assertions Enabled    : ucr+ unr+ 

 Deassertions Enabled  : ucr+ unr+ 

...
...
and provides us with information about what IPMI sensors we have on the server and what events can appear on these sensors. Let us assume we have one of these cool boxes Sun Fire X4200 M2. In that case we would see that on the server there is a sensor 'mb.t_amb' and has assertable states (Assertions Enabled:) 'unc', 'ucr' and 'unr'. This sensor monitors an ambient temperature in the chassis. The states mean 'Upper non critical", "Upper Critical" and "Upper Non Recoverable" respectively. Let us inject "Upper Critical" state on that sensor, but CAUTION!:Remember you are simulating hardware event. It might happen that the box is shut down for safety reasons! So generally I do not recomment to inject states '*nr' (Non-Recoverable). Also it's not recommended to do such experiments on a production server.
For non-R2 Windows:
ipmitool.exe -I ism event "mb.t_amb" "ucr" "assert"
and in case of R2 Windows:
ipmitool.exe -I ms event "mb.t_amb" "ucr" "assert"
Let's not forget that for each server type, the sensor list is a bit different, so make sure the sensor and the state you are about to inject does exist on your server. The output looks like:

Finding sensor mb.t_amb... ok

   0 | Pre-Init Time-stamp   | Temperature mb.t_amb | Upper Critical going high

| Reading 77 > Threshold 75 degrees C

If you were able to follow up to this point, you should be able to get your first Windows log record of hardware event!
  • In case of non-R2 Windows, you will find the log record in the Application log, with source ipmievd. See the screenshot of the log record below.

and the detail of the event is:

  • In case of Windows R2, the log records can be found in 'Hardware Events' log, with source WSMAN_... See the screenshot below where a logrecord from ipmievd is shown.

SCRENSHOTS WILL BE PROVIDED ...

Not much complicated, huh? We have the driver installed, but what next? Maybe, if you already have installed the drivers, you can monitor the box with Microsoft MOM 2005. To see how, read this article! If you are not interested in MOM, or want to know more how to play with the drivers, read further!

Talking to service processor using R2 Windows IPMI driver

The Windows IPMI driver provides a WMI interface. Using this interface, we can talk directly to service processor using the IPMI language. An example how to obtain IP address, MAC address and firmware version of the service processor will be shown. So let us see a pieces of code from the script that is attached. The attached script uses the IPMI driver to ask the server for service processors IP address, MAC address and it's version. The code snippets below were modified to make more sense out of context of the whole script. The first piece shows us how to obtain the driver class oClass and it's instance oIpmi

   strComputer = "."
   Set oSvc = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\wmi")
   Set oClass = oSvc.get("microsoft_ipmi") 'Here we get the right class from WMI

   For Each oInstance In oSvc.instancesof(providerName) 'And let's get existing instance
       Set oIpmi = oInstance
       hasIpmiProvider = true
   Next

Error handling and other stuff has been ommited for clarity. Now, let us see how to make use of the class representing the driver. In the following example we obtain a firmware verison from the SP. The version will be stored into arrFwVersion array.

Dim arrFwVersion(2)
microsoft_ipmi_getFwVersion oClass, oIpmi, arrFwVersion
Wscript.echo "Service Processor Firmware Version: " & arrFwVersion(0) & _
             "." & arrFwVersion(1)

Sub microsoft_ipmi_getFwVersion (byRef oClass, byRef oIpmi, arrFwVersion)


   Set oInParams = oClass.methods_( "requestresponse" ).inparameters
   oInParams.networkfunction = &H06
   oInParams.lun = 0
   oInParams.responderaddress = 32
   oInParams.command = &H01
   oInParams.requestdatasize = 0 ' Size of the request data to IPMI
   oInParams.requestdata = Array()

   Set outParams = oIpmi.execmethod_( "requestresponse", oInparams)

   If outParams.CompletionCode <> 0 Then
      Wscript.echo "Getting firmware version failed"
   End If

   Dim respData
   respData = outParams.ResponseData

   arrFwVersion(0) = Hex(respData(3))
   arrFwVersion(1) = Hex(respData(4))
End Sub

In the example above, we can see some ugly and scary hexadecimal codes. This is the IPMI language! Once you take the IPMI specification and find the appropriate codes everything will be more obvious. Let us explain what the codes mean. We will follow this IPMI scpecification document.

Well, we decided to implement the above functionality - get the SP Firmware Version. After few minutes of searching in the IPMI specification, we find a table on page 571. In the table a function 'Get Device ID' looks like this can be the one we search for (and it is, of course!:)). In the table we can see that in NetFn column is a value App, and CMD is 0x0h.

First,the network function. In the specification, the table of the netfunctions is at a page 38. We can see that we used value 0x06h that identifies the message as an application command/request (corresponds the App value above). Second interesting value is the command, we used a value 0x01h according the table on page 571. On page 239 we read that lun should be set to zero since the command we are about to use is a IPMI Device "Global" Command. In a detailed view of the function on page 240 we see that there is no need to pass any additional values, thus we set the requestdatasize to zero.

And then we just send the request to get the Firmware version of our service processor. How easy! And it actually works :)!

If you read throught the attached script, you might have asked why it's done so complicated? Why? - Extensibility! Later on, I will show how to extend the script so that it can automatically sniff if there is some other IPMI interface - and choose the right one. Stay tuned! ... more will come.

Comments:

Thanks so much for a great IPMI demo !

It's so hard to find accurate and working examples for IPMI!
MSDN is just worthless on this topic, their win32.programmer.wmi newsgroup is completely useless too.

I've noticed that if someone posts an IPMI example online, it's typically in VBscript. Why the lack of .NET example code ? Even MSDN just goes straight to VBscript, and I thought Microsoft loved C#.

Posted by Alex on March 11, 2008 at 10:41 PM CET #

Great information.

I've got 3 Sun servers running Windows server 2003 64bit x4600 M2's and have installed the ipmi driver and the ipmievd service. The ipmitool is able to execute all commands but nothing is logged to the application log on the servers - do you have any experience of this or how I could troubleshoot this?

Help on troubleshooting the ipmievd service not writing to the application log is non-existent!

Thanks.

Posted by Robin on April 03, 2008 at 05:24 PM CEST #

Thanks! I have been beating my head against a brick wall trying to reset ILO100 card in HP Proliant ML150 G5.

Following above, then running:
> ipmitool -I ms mc reset cold

Fixed it :)

I now have a much more reliable way of querying sensors than via ILO card over HTTP also - there is a memory leak so the ILO web server lasts about 400 queries (less than 2 days on 5 minute polling cycle) before it wedges (hence the need to reset). I had scripted a reset via telnet interface every 6 hours to flush it out.

Posted by David Baldwin on June 01, 2009 at 10:01 AM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by Pavel Bures