Database Reference
In-Depth Information
in command-line mode. For example, the command-line mode uses setup files to hold EM CLI properties, but
interactive and scripting modes do not. The properties are set each time interactive or scripting modes are invoked.
We can use the help() function to view which parameters to use to set properties, as shown in Listing 3-2.
Listing 3-2. Client properties help page
emcli>help('client_properties')
EMCLI_OMS_URL : OMS URL To connect to.
EMCLI_USERNAME : OMS Username.
EMCLI_AUTOLOGIN : Possible values are true,false. Default is false.
EMCLI_TRUSTALL : Possible values are true,false. Default is false.
EMCLI_VERBJAR_DIR : Location of bindings directory.
EMCLI_CERT_LOC : Location of a valid certificate file.
EMCLI_LOG_LOC : Directory where log files will be stored.
EMCLI_LOG_LEVEL : Possible values are ALL,INFO,FINE,FINER,WARN,SEVERE. Default is SEVERE.
EMCLI_OUTPUT_TYPE : Possible values are json, JSON, text, TEXT. Default is json in script
mode and text in interactive mode.
status() will list values of all the client properties. set_client_property(propertyname,value) and
get_client_property(propertyname) can be used to set and get a client property.
Understanding Error Codes
There are a number of error codes that you might see when using EM CLI. The information provided in these error
codes is critical to determining what caused the error. The error codes shown below are some of those that are seen
most often; they almost always have an easy fix.
Command-line mode requires a login session to be established before any commands can be executed. In secure
environments and by default, the login session will expire after 45 minutes. When a valid command is executed without
an established login session when in command-line mode, an error is thrown with an exit code of 255. In order to
proceed, a valid session will need to be established by using the login verb, as shown in listing 3-3.
Listing 3-3. Login error message and exit code in command-line mode
[oracle oms]$ emcli get_targets
Error: Session expired. Run emcli login to establish a session.
[oracle oms]$ echo $?
255
Interactive and scripting modes require that the connection parameters be included each time a script is
executed or an interactive session is established. If the connection URL has not been specified, an error will be thrown
with details on how to establish the connection, as shown in listing 3-4.
Listing 3-4. Settings error in interactive and scripting modes
emcli>get_targets()
Error: EM URL is not set. Do set_client_property('EMCLI_OMS_URL', '<value>')
Or set it as environment variable.
[oracle ~]$ emcli @test.py
Traceback (most recent call last):
File "test.py", line 1, in <module>
get_targets()
 
Search WWH ::




Custom Search