This chapter provides the following topic discussions:
EM CLI overview
Important EM CLI concepts, including verbs, modes, and available kits
Brief explanation of the installation process
The Enterprise Manager Command Line Interface (EM CLI) enables users to access Enterprise Manager functionality through a command-line interface or scripts. It is accessible through classic programming language constructs, enabling tasks to be created and run either from the command-line or programatically. EM CLI enables you to access Enterprise Manager Cloud Control functionality from text-based consoles (shells and command-line windows) for a variety of operating systems.
EM CLI is fully integrated with Enterprise Manager's security and user administration functions, enabling you to carry out operations using EM CLI with the same security and confidentiality as the Enterprise Manager Cloud Control console. For example, you can only see and operate on targets for which you are authorized.
Create a new Enterprise Manager administrator account
Monitor and manage targets, jobs, groups, and blackouts
Enable batch/complex tasks on multiple Agents or targets
Integrate Enterprise Manager with third-party or custom software through scripts. Actions that are part of a customer's business model can be performed through scripts.
A verb is a task or action in the form of a user command, which expose Enterprise Manager functionality. Some verbs can include one or more parameters, which are arguments to the user command. Some of the parameters are required, and some are optional.
For instance, in This example of the create_group verb syntax, only the -name parameter is required. The other parameters are optional.
emcli create_group -name="name" [-type=<group>] [-add_targets="name1:type1;name2:type2;..."]... [-is_propagating="true/false"
EM CLI offers Standard, Interactive, and Script modes.
This is the traditional and exclusive mode prior to Enterprise Manager Cloud Control version 220.127.116.11. This mode provides a simple command-line interface to Enterprise Manager, and supports the execution of one verb at a time from the command line.
emcli create_group -name=my_group -add_targets="mymachine.myco.com:host"
This mode enables you to create a single interactive session with the server (Oracle Management Services), where you can type in commands, view the output, and potentially respond to or manipulate the output. Interactive mode opens a Jython shell, where you can provide Jython scripts using EM CLI verbs as Jython functions. Jython is a Java implementation of the Python programming language.
Note that when calling a verb in Interactive mode, the arguments are placed inside parentheses. For example:
Script mode is especially effective when performing tasks in bulk mode or many tasks at once. Scripts are useful for accomplishing several tasks, including:
Listing or setting global target properties
Listing or setting Agent properties
Updating database passwords
Listing group members
This mode enables you to create Jython scripts, store them as files, and then pass these files to EM CLI as an argument, such as ...
... where createuser.py is the name of a file containing the Python code to be sent to EM CLI.
You can create reusable, functional modules using existing EM CLI verbs to generate complex tasks. This intuitive, object-oriented programming model supports encapsulation, loops, functions, exception and error handling, and so forth. These abilities enable you to benefit from all of the powerful features that the Jython programming language offers.
For usage information for the Interactive and Script modes, see Chapter 3, "Using EM CLI".
EM CLI provides two installable kits:
Figure 1-1 shows the high-level architecture of EM CLI.
A typical verb may take zero or more arguments as input. The EM CLI client passes the input to OMS for processing. The EM CLI client connects to OMS and establishes a user session, which is used across verb executions until a logout is initiated.
EM CLI consists of two components used to access the Enterprise Manager framework functionality:
The EM CLI client is a command-line program (Java-based) that sends EM CLI verbs to a specific Oracle Management Service (OMS). In some respects, the EM CLI client functions as a command-line equivalent of an Enterprise Manager Cloud Control console. You can download the EM CLI client on any system within your managed network.
The EM CLI OMS is automatically installed with the OMS and serves as the communication conduit between the EM CLI client and the OMS.
You can download the EM CLI client on any system within your managed network. The EM CLI client is a command-line program (Java-based) that sends EM CLI verbs to a specific Oracle Management Service (OMS). In some respects, the EM CLI client functions as a command-line equivalent of an Enterprise Manager Cloud Control console. The EM CLI OMS is automatically installed with the OMS and serves as the communication conduit between the EM CLI client and the OMS.
For instructions about setting up and running EM CLI, see Chapter 2, "Downloading and Deploying EM CLI".
Note:EM CLI does not support JRockit JVM.