The Sun Management Center command-line interface (CLI) is a character-driven console application for monitoring and managing your system. The CLI offers several useful features:
Low overhead – Although the CLI provides most of the functionality of the Java Console and web console, the CLI does not require bitmapped graphics. The CLI therefore can run on simple data terminal equipment over low-bandwidth connections. However, features that require a GUI, such as physical views or graphing, are unavailable through the CLI.
Batch mode processing – The CLI supports a basic scripting functionality that enables the CLI to take command input from a file in batch mode.
Configurable output format – You can configure the format of CLI output. The plain-text output is compatible with other text-based tools. For extended commands, you can specify output in XML and HTML.
Help – Online help for CLI commands is available from within the CLI.
You can use the CLI to perform the following tasks:
Create topology objects such as domains, groups, and entities, and retrieve topology information about these objects.
Retrieve and manipulate managed object properties or attributes.
Load, unload, enable, and disable modules on Sun Management Center agents.
Set and run alarm actions, retrieve alarm information, and acknowledge or delete alarms on Sun Management Center agents.
(On Solaris and Linux) You can automatically log in to the console using the parameters file. If the parameters file contains user name and password, the permission for that file must be 400. Otherwise, automatic login through CLI is not possible.
You can access the CLI from a user terminal session on one of the following system configurations:
UNIX® workstation running the Solaris 7, Solaris 8, Solaris 9, or Solaris 10 version of the Solaris Operating System.
UNIX workstation running Red Hat, SuSE/JDS Linux kernel version 2.4 and 2.6.
PC running Windows 2000, Windows XP, or Windows NT
The CLI supports the following two interaction modes:
Session mode – Session mode is interactive. Once you log in to the Sun Management Center server, you can enter commands and receive output until you explicitly log out of the server.
Batch mode – The CLI connects to the server and executes the commands contained in filename, where filename is the name of a file that contains CLI commands. CLI can be run in batch mode as a non-root user.
CLI batch mode can be configured by modifying the cli.properties file located at /opt/SUNWsymon/cli. This file contains nine configurable parameters.
Table 20–1 describes the configurable parameters.
Table 20–1 Parameters to Configure CLI Batch Mode
Parameter |
Description |
Default Value |
---|---|---|
process_time_out |
When this time expires, CLI back end processes will be removed from the system. |
Process time-out 24 hrs process_time_out = 86400 (in seconds) |
uds_dgram_wait_time |
DGRAM client will be waiting for response from the CLI back end process. If the client does not receive any response within the specified time, an error message “Error receiving data from Backend” is displayed. |
UDS DGRAM wait time in seconds uds_dgram_wait_time = 300 |
uds_stream_wait_time |
STREAM client will be waiting for response from the CLI back end process. If the client does not receive any response within the specified time, an error message “Error receiving data from Backend” is displayed. |
UDS STREAM wait time in seconds uds_stream_wait_time = 180 |
out_file |
This file contains the details of the currently running CLI back end processes. The format of this file is <user>:<hostname>:<C Process ID>:<Java Process ID> |
User & process information file out_file = /var/opt/SUNWsymon/cli/process-file |
socket_pathclnt |
This file contains the path of the client broker UDS file. The output of the processed CLI commands is sent to this file. |
Path to uds file socket_pathclnt = /var/opt/SUNWsymon/cli/broker_uds_client_file |
cli_log_path |
This file contains the path of the CLI log files. |
Location of CLI log file cli_log_path = /tmp/sunmclog/cli |
cli_log_file |
Name of the CLI log file. |
Location of backend(broker) log file cli_log_file = /tmp/sunmclog/cli/cli-batch-mode-log |
uds_file_path |
This path contains the location of the STREAM and DGRAM UDS files. |
Path of the uds files uds_file_path = /var/opt/SUNWsymon/cli/ |
log_level |
Specifies the logging level to be used. Set the log level to ERROR for the production environment. Set the log level to INFO for the debugging environment. |
Batch mode log level [options : INFO|ERROR] log_level=ERROR |
This section provides an overview of CLI commands and parameters.
CLI commands can be divided into two types: basic commands and extended commands.
Basic commands are commands that modify the environment in which other CLI commands are executed. You use basic commands to set parameter values, define command aliases, check command status, or log in and log out of the server. Basic commands always execute in the foreground.
Extended commands are commands that interrogate or modify the topology of managed objects, their properties, and their attributes. You use extended commands to perform several functions:
Locate managed objects in the managed object topology
Enable or disable modules
Acknowledge or delete alarms
By default, extended commands run in the background. You can configure extended commands to run in the foreground.
In session mode, commands execute in either the foreground or the background.
Foreground – Commands that execute in the foreground run to completion. These commands send their output directly to the screen unless otherwise redirected. Only one command at a time can run in the foreground. Basic commands can only run in the foreground. Extended commands run in the background by default, but can be configured to run in the foreground.
Background – Commands that execute in the background run asynchronously and by default send no output or diagnostic messages to the screen. Output is buffered and can be displayed later by explicit request. Unlike the UNIX shells, only one extended command can run in the background at a time. While this command is running in the background, any number of basic commands can run in the foreground. By default, extended commands run in the background, although you can specify that extended commands run in the foreground. Basic commands cannot run in the background.
The CLI also supports aliases. You can define a shorthand term or pseudonym for a more complicated command and its parameters. User-defined aliases persist across different CLI sessions.
CLI parameters are name-value pairs: each parameter has a name and a value. Some parameters are built-in to the CLI. Their names and the significance of their values are predefined within the CLI. You can define other parameters, also known as variables. Some parameters are global in scope. Global parameters affect the execution of all CLI commands that are run in a particular session. Other parameters are specific to a certain command or group of commands.
The CLI provides several capabilities for input and output.
Input
Output
For basic commands, output appears on the screen by default.
For extended commands, output is buffered in the background by default until you request that output.
The output of both basic and extended commands can be redirected to a file that you specify.
Commands and parameters can be saved in a log file that can later be used as input to the CLI in batch mode.
To use a log file as input to the CLI in batch mode, you must edit the file. Remove the time stamps and any messages that appear before the actual commands and parameters in the log file.
You can specify the number of lines for the output display.
For multi-column output, you can specify which columns to display.
In addition to plain-text output, for some commands you can specify XML and HTML output.
The CLI provides online help for each CLI command. CLI help is available from within the CLI. CLI help does not require a GUI. For each command, the help provides a synopsis of command usage and a list of the parameters associated with that command.