Unsupported content


This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

NSH performance commands

Network Shell (NSH) performance commands let you configure and manage the Java Virtual Machine (JVM) and BLCLI. These performance commands use the Java Invocation API to embed BLCLI functionality into the NSH.

For more information about NSH performance commands, see the following sections:

Reasons for using the NSH performance commands

Used on its own, the BLCLI requires you to launch the JVM and connect to the Application Server each time you run a BLCLI command. Using the NSH performance commands enhances BLCLI performance, because you can cache the launching of the JVM and the connection to the Application Server. This lets you launch the JVM and connect to the Application Server only once per session, rather than having to launch and reconnect each time you run a BLCLI command.


  • Operating systems. You can run the NSH performance commands only on the operating systems listed in the supported operating systems table located here: http://www.bmc.com/support/product-availability-compatibility
    Follow the link for BMC BladeLogic Server Automation Product Compatibility.
  • BMC Server Automation Java components. You must install the BMC Server Automation Java components (that is, the BMC Server Automation Console) on the computer where you run the NSH performance commands.

Command Reference

This section provides descriptions of all the NSH performance commands. For an example of how to use these commands in a BLCLI session, see NSH performance command workflow example.


This command initiates the connection to the Application Server. It uses the information from the OptionsManager object to initiate this connection. A second call to blcli_connect does nothing.


This command does the same thing as blcli_disconnect.


This command disconnects the current session from the Application Server. You can use this command in the following circumstances:

  • When you want to disconnect and re-connect as a different user.
  • When you want to change something by using the blcli_setoption command.

You need to call blcli_disconnect before you can call blcli_connect again.


This command executes a BLCLI call against the Application Server. It takes a minimum of two arguments (namespace and command).

blcli_execute Server listAllServers


This command lists a help menu describing the various supported NSH performance commands. You can get additional help for the various commands by typing something like the following:

blcli_help connect (or any other command)


This command initializes the JVM and loads the base CLIMain command. The command creates the following items:

  • A JVM
  • A CLIMain class
  • An OptionsManager class with default settings

Any other command that needs blcli_init will automatically run blcli_init. You do not have to run it explicitly yourself.


This command lists the current JVM options that will be passed to the JVM when it is invoked.


This command lists the current set of overriding options that will be passed to the BLCLI when connecting to the Application Server. By default this list is empty.


This command prints out the memory information (max, total, free, used) associated with the invoked JVM.


This command sets a JVM option before invoking the JVM. Use this to set various options, such as --Xmx.


You cannot use blcli_setjvmoption after blcli_init has been executed, either explicitly by the user, or implicitly through use of another command that needs blcli_init.

The following custom JVM options are available out-of-the-box:




Suppresses output in the console if a blcli_execute command completed successfully.


Instructs the CLI to print an extra line at the end of its output (provided that quiet mode is not turned on).


Specifies the listening port used by the CLI engine in server-based mode for accepting commands. Use this option to re-use a launched JVM for CLI execution of NSH performance commands such as blcli_connect or blcli_execute.


This command lets you add or modify various options from the default OptionsManager class created by the blcli_init call. You can use this command to authenticate against the Application Server.

BMC Server Automation uses a variety of security protocols for authenticating against the Application Server. See Administering security for more information and implementation details.

The following table describes the various blcli_setoption options, and the NSH performance command workflow example section provides a simple example of how to meet authentication requirements in the context of using the NSH performance commands. For more detailed security information, see the Administering security.




Specifies the language (locale) to use.


Whether to disable (or enable) the redirection of stdout and stderr output from the CLI to a string buffer that is initialized by the blcli_execute command. The values for this option are either true (disable redirection) or false (enable redirection). The default is true.

This option is especially useful in a case where you are running an NSH script as part of a long job (such as database cleanup) and you want to see the stdout and stderr output while the job is running (a value of true, redirection disabled), rather than waiting until the job finishes running (a value of false, redirection enabled).


RBAC role associated with the user requesting authentication.


Name of the service profile. The cached session credential must have properties (authentication service name, port, and authentication mechanism) matching those of named session credential.


Name of the file containing service profile definitions. You can use this option override default value.


SSO credential cache file. You can use this option to override default value


Name of the file containing list of trusted server certificates. You can use this option to override default value

You can set only one option at a time. For example:

blcli_setoption serviceProfileName myServiceProfile
blcli_setoption roleName adminRole

You must use blcli_setoption before the call to blcli_connect. After you call blcli_connect, any attempt to use blcli_setoption will generate an error.


This command lets you store the output from a previous blcli_execute call in an environment variable. Use this command instead of doing things like:

VAR1=`blcli_execute Server findById 2000001`

The preceding call will invoke an additional JVM/connection because it spawns a sub-shell.

To continue using the cached JVM or connection, do the following:

blcli_execute Server findById 2000001
blcli_storeenv VAR1

You can then reference $VAR1 from the environment.

Example of NSH performance command workflow

This section shows how to use the NSH performance commands in a sample BLCLI session, using the single sign-on authentication mechanism.

Before you begin

  • Create a service profile.
  • Populate the credentials cache.


The following example shows how to create a service profile with the following values:

  • Name of the service profile = myServiceProfile
  • Host name of the machine running the Application Server = machine1
  • Authentication service port on that machine = 9840

(This is the default port for the authentication service.)

  • Authentication type = SRP

blcred authprofile -add -profile myServiceProfile -host machine1:9840 -type SRP


Now you need to populate the credentials cache. The following example shows how to populate the credentials cache with the following values:

  • Name of the service profile = myServiceProfile
  • BMC Server Automation user name = Admin1
  • BMC Server Automation password = myPassword

blcred cred -acquire -profile myServiceProfile -username Admin1 -password myPassword

(For detailed information about all blcred syntax options, see Administering security.)


Next, specify options for service profile name and role. The following example uses these values:

  • Service profile name = myServiceProfile
  • Role = adminRole
blcli_setoption serviceProfileName myServiceProfile
blcli_setoption roleName adminRole

Now you can connect to the Application Server by issuing the following command:



At this point, you can start using BLCLI commands to accomplish various tasks. The following example shows how you can use blcli_storeenv to store the output from a previous blcli_execute call in an environment variable.

JOB_GROUP_NAME=/deploysTARGET_SERVER=winserv1TARGET_GROUP="/east/windows servers"DEPLOY_JOB_NAME="deploy base files"
blcli_execute BlPackage getDBKeyByGroupAndName /basefiles "base files"
if test $? -ne 0
echo "Failed to get the DBKey for '/basefiles/base files'"exit 1
blcli_storeenv PACKAGE_KEY
blcli_execute JobGroup groupNameToId "${JOB_GROUP_NAME}"
if test $? -ne 0
echo "Could not find JobGroup ${JOB_GROUP_NAME}"exit 1
blcli_storeenv GROUP_ID
if test $? -ne 0
echo "Failed to create the deploy job"exit 1
blcli_storeenv DEPLOY_JOB_KEY
blcli_execute DeployJob addTargetGroup $DEPLOY_JOB_KEY "${TARGET_GROUP}"
if test $? -ne 0
echo "Failed to add target group ${TARGET_GROUP} to the job"exit 1
Was this page helpful? Yes No Submitting... Thank you