JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Sun ZFS Storage 7000 System Administration Guide
search filter icon
search icon

Document Information

Preface

1.  Introduction

Overview

Introduction

Platforms

Expansion Storage

Protocols

Key Features

Data Services

Availability

Browser User Interface (BUI)

Command Line Interface (CLI)

User Interface

Browser User Interface (BUI)

Command Line Interface (CLI)

Browsers

Supported Browsers

Tier 1

Tier 2

Unsupported Browsers

Main Window

Overview

Masthead

Navigation

Alerts

Session Annotation

Title Bar

Side Panels and Menu Titles

Main Window Side Panels and Menu Titles

Add Projects

Move Shares

Object Name

Non-Standard BUI Control Primer

Permissions

Editing Share Properties

Viewing List Item Controls

Modal Dialogs

Icons

General Usage

Status

Basic Usage

Networking

Dashboard Thresholds

Analytics

Identity Mapping

Miscellaneous Icons

CLI

CLI Introduction

Logging Into the CLI

Contexts

CLI Contexts

Root Context

Child Contexts

Dynamic Child Contexts

Returning to a Previous Context

Navigating to a Parent Context

Contexts and Tab-Completion

Executing Context-Specific Commands

Uncommitted Contexts

Properties

CLI Properties

Getting Properties

Getting a Single Property Value

Tab Completion

Setting Properties

Committing a Set Property Value

Setting a Property Value with an Implied Commit

Setting a Property to a List of Values

Setting a Property to a Value Containing Special Characters

Immutable Properties

Scripting

Batching Commands

Scripting

The Script Environment

Interacting with the System

The Run Function

The Get Function

The List Function

The Children Function

Generating Output

Dealing with Errors

Automating Access

2.  Status

3.  Configuration

4.  Services

5.  Shares

6.  Analytics

7.  Application Integration

Glossary

Index

Contexts

CLI Contexts

A central principle in the CLI is the context in which commands are executed. The context dictates which elements of the system can be managed, and which commands are available. Contexts have a tree structure in which contexts may themselves contain nested contexts and the structure generally mirrors that of the views in the BUI.

Root Context

The initial context upon login is the root context, and serves as the parent or ancestor of all contexts. To navigate to a context, execute the name of the context as a command. For example, the functionality available in the Configuration view in the browser is available in the configuration context of the CLI. From the root context, this can be accessed by typing it directly:

dory:> configuration
dory:configuration> 

Note that the prompt changes to reflect the context, with the context provided between the colon and the greater-than sign in the prompt.

Child Contexts

The show command shows child contexts. For example, from the configuration context:

dory:configuration> show
Children:
                             net => Configure networking
                        services => Configure services
                         version => Display system version
                           users => Configure administrative users
                           roles => Configure administrative roles
                     preferences => Configure user preferences
                          alerts => Configure alerts
                         storage => Configure Storage

These child contexts correspond to the views available under the Configuration view in the browser, including Network, Services and Users, Preferences and so on. To select one of these child contexts, type its name:

dory:configuration> preferences 
dory:configuration preferences> 

Navigate to a descendant context directly from an ancestor by specifying the intermediate contexts separated with spaces. For example, to navigate directly to configuration preferences from the root context, simply type it:

dory:> configuration preferences
dory:configuration preferences>
Dynamic Child Contexts

Some child contexts are dynamic in that they correspond not to fixed views in the browser, but rather to dynamic entities that have been created by either the user or the system. To navigate to these contexts, use the select command, followed by the name of the dynamic context. The names of the dynamic contexts contained within a given context are shown using the list command. For example, the users context is a static context, but each user is its own dynamic context.

dory:> configuration users
dory:configuration users> list 
NAME                     USERNAME                 UID        TYPE
Bryan Cantrill           bmc                      31992      Dir
Super-User               root                     0          Loc

To select the user named bmc, issue the command select bmc:

dory:configuration users> select bmc 
dory:configuration users bmc> 

Alternately, select and destroy can in some contexts be used to select an entity based on its properties. For example, one could select log entries issued by the reboot module in the maintenance logs system context by issuing the following command:

dory:maintenance logs system> select module=reboot 
dory:maintenance logs system entry-034> show
Properties:                                   
                    timestamp = 2010-8-14 06:24:41
                       module = reboot
                     priority = crit
                         text = initiated by root on /dev/console syslogd: going down on signal 15

As with other commands, select may be appended to a context-changing command. For example, to select the user named bmc from the root context:

dory:> configuration users select bmc 
dory:configuration users bmc> 

Returning to a Previous Context

To return to the previous context, use the done command:

dory:configuration> done
dory:> 

Note that this will return to the previous context, which is not necessarily the parent context, as follows:

dory:> configuration users select bmc 
dory:configuration users bmc> done
dory:> 

The done command can be used multiple times to backtrack to earlier contexts:

dory:> configuration
dory:configuration> users 
dory:configuration users> select bmc 
dory:configuration users bmc> done
dory:configuration users> done
dory:configuration> done
dory:>

Navigating to a Parent Context

To navigate to a parent context, use the cd command. Inspired by the classic UNIX command, cd takes an argument of ".." to denote moving to the parent context:

dory:> configuration users select bmc
dory:configuration users bmc> cd ..
dory:configuration users> 

And as with the UNIX command, "cd /" moves to the root context:

dory:> configuration
dory:configuration> users 
dory:configuration users> select bmc 
dory:configuration users bmc> cd /
dory:>

And as with its UNIX analogue, "cd ../.." may be used to navigate to the grandparent context:

dory:> configuration
dory:configuration> users 
dory:configuration users> select bmc 
dory:configuration users bmc> cd ../..
dory:configuration>

Contexts and Tab-Completion

Context names will tab complete, be they static contexts (via normal command completion) or dynamic contexts (via command completion of the select command). Following is an example of selecting the user named bmc from the root context with just fifteen keystrokes, instead of the thirty-one that would be required without tab completion:

dory:> configtab 
dory:> configuration utab 
dory:> configuration users setab 
dory:> configuration users select tab 
bmc   root  
dory:> configuration users select btab 
dory:> configuration users select bmcenter 
dory:configuration users bmc>

Executing Context-Specific Commands

Once in a context, execute context-specific commands. For example, to get the current user's preferences, execute the get command from the configuration preferences context:

dory:configuration preferences> get
                       locale = C
                 login_screen = status/dashboard
              session_timeout = 15
           session_annotation = 
           advanced_analytics = false

If there is input following a command that changes context, that command will be executed in the target context, but control will return to the calling context. For example, to get preferences from the root context without changing context, append the get command to the context navigation commands:

dory:> configuration preferences get 
                       locale = C
                 login_screen = status/dashboard
              session_timeout = 15
           session_annotation = 
           advanced_analytics = false

Uncommitted Contexts

When creating a new entity in the system, the context associated with the new entity will often be created in an uncommitted state. For example, create a threshold alert by executing the create command from the configuration alerts threshold context:

dory:> configuration alerts thresholds create 
dory:configuration alerts threshold (uncommitted)> 

The (uncommitted) in the prompt denotes that this an uncommitted context. An uncommitted entity is committed via the commit command; any attempt to navigate away from the uncommitted context will prompt for confirmation:

dory:configuration alerts threshold (uncommitted)> cd /
Leaving will abort creation of "threshold". Are you sure? (Y/N) 

When committing an uncommitted entity, the properties associated with the new entity will be validated, and an error will be generated if the entity cannot be created. For example, the creation of a new threshold alert requires the specification of a statistic name; failure to set this results in an error:

dory:configuration alerts threshold (uncommitted)> commit
error: missing value for property "statname"

To resolve the problem, address the error and reattempt the commit:

dory:configuration alerts threshold (uncommitted)> set statname=cpu.utilization  
                     statname = cpu.utilization (uncommitted)
dory:configuration alerts threshold (uncommitted)> commit
error: missing value for property "limit"
dory:configuration alerts threshold (uncommitted)> set limit=90
                        limit = 90 (uncommitted)
dory:configuration alerts threshold (uncommitted)> commit
dory:configuration alerts thresholds> list
THRESHOLD          LIMIT       TYPE STATNAME
threshold-000         90     normal cpu.utilization