beautypg.com

3 running a command on multiple managed systems – HP Insight Control Software for Linux User Manual

Page 152

background image

On the Task Results screen, the Task Instance Results always shows the user who launched the
task. This might not be the credentials used for the task execution. Because different target
managed systems can have different users specified in the SSH settings, the same task can run
on different targets as different users.

16.3 Running a command on multiple managed systems

The open source Parallel Distributed Shell (

pdsh

) command is a multi-threaded remote shell

client that runs commands on multiple managed systems in parallel. You can specify all, a given
number of, or only certain managed systems on which to perform the command or commands
that are passed as arguments to the pdsh command.

The pdsh command can use three forms of managed system names.

By default, the pdsh shell can issue 32 simultaneous remote commands at a time. You can override
this default with the -f option.

The pdsh shell relies on SSH transport mechanism. Ensure that SSH is properly installed on the
system; changes to the SSH configuration can cause the pdsh shell to fail. Although the pdsh
shell can use several remote shell services, including rsh and

ssh

, the security settings for Insight

Control for Linux make ssh the shell of choice.

The syntax of the pdsh command is:

pdsh -[options] "command_to_run"

Use the pdsh --help option to view command-line options.

IMPORTANT:

Do not pass a command that requires interaction as an argument to the pdsh

command. Prompting from the remote system can cause the command to hang.

pdsh Command Examples

The -a option runs the uptime command on all managed systems:

# pdsh -a "uptime"
eris: 08:46:53 up 17:45, 0 users, load average: 0.05, 0.05, 0.00
mars: 19:03:14 up 17:44, 0 users, load average: 0.04, 0.04, 0.00
earth: 14:35:14 up 17:44, 0 users, load average: 0.01, 0.02, 0.00
mercury: 09:29:03 up 20:29, 2 users, load average: 0.06, 0.10, 0.09
pluto: 14:24:51 up 17:45, 0 users, load average: 0.01, 0.04, 0.00

The -w option enables you to specify a range of managed systems or a specific managed
system.

Description

Command line

Runs the hostname command on the first five managed systems
in the collection.

IMPORTANT:

You must use the Insight Control for Linux internal

name (which is based on the Insight Control for Linux collection
name) when you specify a range of managed systems. In the
example, icelx is the Insight Control for Linux internal name.

# pdsh -w icelx[1-5] hostname
earth: earth.example.com
eris: eris.example.com
mercury: mercury.example.com
mars: mars.example.com
pluto: pluto.example.com

Runs the uptime command on a specific managed system. In the
example, mercury is the real host name

# pdsh -w mercury uptime

For more information, see pdsh(1) and the following website:

http://sourceforge.net/projects/pdsh/

152

Using SSH for remote server management