Informing the IBM Community

hmc

Getting Started with the IBM HMC

5
(1)

The command line interface allows you to automate tasks, which can make monitoring or even creating new LPARs easier.

Although the Hardware Management Console GUI is a common way to manage Power Systems, I’ve found it worth getting familiar with the CLI.

If you need to create a lot of new LPARs with their profiles on a managed system, using the command line can save you hours.

But I have to admit, the HMC command line is daunting … even if you’re familiar with other CLIs. HMC commands can have lots of options, and reading the man pages can be overwhelming.

Why Use the HMC CLI?

Still, there are three good reasons for getting to know your way around the HMC CLI:

  1. Consistency. When you are managing multiple Power Systems or building, stopping or starting the logical partitions, scripts can make the results consistent and predictable.
  2. Repeatability. As with other scripting, the CLI allows you to repeat tasks with the same parameters.
  3. Automation. Once you get past the steep learning curve of using the HMC command line, you can automate plenty of routine tasks.

Getting Started with the HMC CLI

Access the HMC CLI

On a local HMC, you can access the CLI through the “Open Restricted Shell Terminal” task in the HMC Management work pane. This will allow you to log in to the console on LPARs.

Create SSH Connection

If your network and security allow it, you should be able to log into the HMC using SSH. You may log in as the user hscroot or another user that has been set up on the HMC.

Bonus tip: Setup ssh keys so you can run commands without a password.

Here’s how to do that:

https://www.ibm.com/support/pages/setting-ssh-run-commands-hardware-management-console-without-being-prompted-password

Common HMC CLI Tasks

One command to get started with is lssyscfg. This allows you to list the attributes of partitions and profiles for the managed system.

(The managed system is the official name for your IBM Power System, and a single HMC may be used to manage several Power Systems.)

Listing the configuration with lssyscfg will require you to specify a managed system using the -m flag, so the first step is to list the managed systems.

You can do this using the command:

Bash
lssyscfg -r sys

This will give you a whole lot of information about your managed systems, including their names, model, serial numbers and plenty more.

You will need to get to know the name of your managed system, so you can cut down this command by giving it a single property. You can do this using the -F flag.

If you use -F all, you get a comprehensive list of the system’s configuration, including the model and serial number, let’s list the name of the managed system:

Bash
lssyscfg -r sys -F name

You may see a system name such as:

Server-9080-M9S-SN123456P

Now that you have your system name (which you can also see in the HMC GUI), you can list LPARs on that managed system.

Here are some other helpful options for the lssyscfg command.

List LPARs, once again using the -F flag.

This time, instead of using the -r sys flag, we’ll change it to -r lpar

Bash
lssyscfg -r lpar -m Server-9080-M9S-SN123456P -F name

Other attributes for an LPAR that can be useful are:

lpar_env (this will tell you if the LPAR is a VIO server or running an OS such as AIX).

state – reports whether the LPAR is running.

So, you can combine these:

Bash
lssyscfg -r lpar -m Server-9080-M9S-SN123456P -F name,lpar_env,state

If you’re using the -F flag, you can also get a heading by adding –header (note: that’s two dashes before the word header). This can be a good way to create a CSV file, which you might like to import into a spreadsheet.

There are plenty of other HMC commands worth learning, and having the basics of flags such as -m (to specify the managed system) and -F can help you get comfortable on the HMC CLI.

Here are a few other commands that can help:

List the HMC version:

Bash
lshmc -v

List all connected managed systems:

Bash
lssysconn -r all

Open a console session:

Bash
vtmenu

This will show you the available managed systems, and when you select one, you’ll be given a menu of the available LPARs on that managed system.

Build on the Basics

Scripting skills can help you save time and effort, even taking hundreds of hours off some projects, especially in larger environments. As you learn some of the basic commands for listing configurations, you can build upon that knowledge and become the resident expert on IBM Power and the systems that work with it.

Understanding HMC Commands

IBM provides comprehensive documentation on the HMC CLI commands https://www.ibm.com/docs/en/power9?topic=interfaces-hmc-commands.

This documentation details individual command functions, parameters, and usage examples.

Security Considerations

Script execution between SSH clients and the HMC requires secure practices to prevent unauthorized access. Refer to IBM’s documentation for secure scripting with the HMC CLI https://www.ibm.com/docs/9223-42S/p9eh6/p9eh6_rcl.htm.

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *