AnalyzeCli Command Line Tool is a java application that can be leveraged to retrieve information about your Analyze system, and to run commands. Use cases include auto importing dataflows from another system and creating Run Property Sets.
HOW TO GET THE TOOL
Download the executable.
HOW TO INSTALL
Unpack the contents of the zip archive to a suitable location e.g. C:\AnalyzeCli
HOW TO USE AnalyzeCLI
Prerequisites:
The JAVA_HOME Environment Variable must be set.
Windows: This can be set in your system environment variables or you can set it by running laeEnv.bat. With the quotes around the command, open the command prompt as administrator and run:
"C:\Program Files\Data360Analyze\bin\laeEnv.bat"
Linux: Navigate to the <Analyze install dir>/bin directory, and run this command:
source .profile.lavastorm
Technical Note:
If you are connecting to a server host that uses HTTPS and the server is using a self-signed cert or the cert chain needs CA certs that are not included in the base set provided by Java then you would need to install them (add cacerts to the JRE folder of the local Data360 Analyze installation folder).
If the server is using a standard CA cert then no additional configuration is required.
HOW TO RUN COMMANDS
Once the variable is set, change directory to the location of the /bin folder within the directory where the tool was unpacked, e.g. cd C:\AnalyzeCli\analyzeCli-3.7.1\bin
Basic commands can be listed by typing "analyzeCli" (see list below).
Type the command name followed by a basic command, for example :
analyzeCli backup
Basic Commands:
backup
execute [Options] <Dataflow Locator>
export [Options] <DataFlow>|<Directory/Workspace> ...
find [Options] <Directory or Workspace> ...
groups [options]
help -k <keyword>|[advanced|examples|scripting|paths]
import [Options] <Path To Dataflow/Graph> ...
jobs <jobID>
login
logout
ls [options] <Directory or Workspace> ...
mkdir [options] <directory> ...
rename [options] <source> <target>
rm [options] [<object> ...
rmdir <directory> ...
roles [options]
runPropertySets [options] [<locator> ...]
runs [options]
scheduler [options]
schedules [options]
search -l|[-t <type>] [-w] <SearchString> ...
server [options]
unlock <password>
users [options]
Export Command example:
This command will export the dataflow and by default it will be placed in the folder where you are running the command from:
analyzeCli --host xxxx.xxxx --port 8080 --protocol http export "//Public Documents/Costello/CombiningDataForEmail"
You can also specify the destination for the exported data flow by using the --fileName option of the export command:
analyzeCli --host xxxx.xxxx--port 8080 --protocol http export --fileName C:\Users\CombiningDataforEmail.lna "//Public Documents/Costello/CombiningDataForEmail"
As an admin user you can dump all datflows in the system using the following command:
analyzeCli --host xxxx.xxxx--port 8080 --protocol http export -d -R -f C:\AnalyzeDump\AllDataflows_2021-10-15.lna /
Import Command example:
analyzeCli --host xxxx.xxxx--port 8080 --protocol http import -d "//Public Documents/christina" "C:\Users\ccostello\Downloads\Combining Data For Email.lna"
When importing a data flow, if a data flow with the same name already exists in the destination directory then the import operation will fail by default. You can use the overwrite ( -o
) option to overwrite the existing data flow:
analyzeCli --host xxxx.xxxx--port 8080 --protocol http import -d -o "//Public Documents/christina" "C:\Users\ccostello\Downloads\Combining Data For Email.lna"
Note the full name for the option is --shouldOverwrite
See the import --help
topic for the other options.
Use 'analyzeCli help advanced' to list additional advanced commands.
Use 'analyzeCli --help' to list global options for the Analyze CLI.
Options:
--config(-c) <argument> - Use named config file
--format(-f) <argument> - Specify output format: json, tsv, or simple (default: simple))
--host(-h) <argument> - Specify <hostname/IP> of Analyze server
--output(-o) <argument> - Specify a file for output
--password(-P) <argument> - Specify <password> (default: welcome)
--port(-p) <argument> - Specify <port> of Analyze server
--protocol <argument> - Specify protocol to use either http or https
--script(-s) <argument> - Specify <file> with a set of commands to execute
--timeout(-t) <argument> - Set the <timeout> in seconds for REST calls
--update(-u) - Allow destructive actions, e.g. delete/updates
--username(-U) <argument> - Specify <username> (default: admin)
--verbose(-v) - Enable verbose reporting (-v basic, -vv extended)
--version - Report the version of AnalyzeCli
LOGGING IN:
Before you can use the tool to leverage the Analyze API, the session must be authenticated.
The 'login' option is used for this purpose.
The username defaults to "admin" if not specified
The password defaults to "welcome" if not specified.
The host defaults to localhost if not specified.
The port defaults to 8080 if not specified (If using HTTPS connections, try 443)
Example login commands:
analyzeCli --host https://my_server_address.com/ --port 443 --password <<Secret>> login
analyzeCli --host my_server_address.com --port 443 --protocol https --username Alice --password <Different Secret>> login
Example login command for a desktop install:
analyzeCli login
When the user is successfully logged in the following information is displayed:
- Server status (OK)
- The login token
- AnalyzeCLI client version
- Analyze application version.
Notes:
- You must supply the host information on every command invocation to select the host to communicate with. If you do not select a host, then the CLI will default to communicating with localhost.
- If any arguments have spaces in them, for example the name of a file you are uploading, these must be protected with quotes. For example, to upload a file into '/Public Documents' on your local machine you would do the following:
analyzeCli --host localhost --port 8080 --protocol http import -d "//Public Documents/christina" "C:\Users\ccostello\Downloads\Combining Data For Email.lna"
SERVER STATUS
The status of the server can be checked by running:
analyzeCli --host http://localhost --port 8080 server --status
AnalyzeCli SESSION
The login token is used for subsequent commands in the session so the username and password are
not required in subsequent commands.
Logging out.
The session should be closed by using the 'logout' option, for example:
analyzeCli --host https://my_server_address.com/ --port 443 logout
LIST USERS (with simple format)
analyzeCli --host https://my_server_address.com --port 443 users
List users and format the output as json
analyzeCli --host https://my_server_address.com --port 443 --format json users
OBTAIN INFORMATION ON THE COMMAND
To get additional information on the command being run to access Analyze,
use the --verbose (-v) option
Additional information is displayed when the -vv option is used.
OBTAIN THE SERVER'S TIMEZONE (assumes Linux OS and the jq command is on your path)
analyzeCli server --info | jq '.data.containers.tomcat.jvm.runtime.systemProperties."user.timezone"'
RUN PROPERTY SETS
To list a Run Property Set in JSON format (local desktop machine) run this command:
analyzeCli -f json runPropertySets
runPropertySets Options:
--all(-a) - List Run Property Sets - even if they have no name or no Run Properties
--create(-c) <argument> - Create new RPS - argument should be path to new RPS
--json(-j) - Output as JSON - form suitable for RPS creation
--properties(-p) - Display the list of Run Properties
Listing the property values in the Run Property Sets in JSON format (local desktop machine)
analyzeCli runPropertySets -p -j
Creating a Run Property Set (local desktop machine)
analyzeCli --update runpropertysets -c /Users/admin/Monthly "{\"name\":\"Monthly\",\"runProperties\":[{\"name\":\"frequency\",\"value\":\"MONTH\",\"dataType\":\"string\"}]}"
Execute a Dataflow asynchronously, specifying Run Property Values (remote machine)
The data flow to be run is called "My_Data_Flow" and is located in user Bob's 'My Documents' folder on the Analyze instance on the <hostname> machine. Values have been specified for the Run Properties 'RP1' and 'RP2'.
analyzeCli --host <hostname> -a -r "RP1=foo","RP2=bar" /Users/Bob/My_Data_Flow
Upload Data files to My Document folder the server (remote machine)
The data files are uploaded to the current user's 'My Documents' folder on the remote Analyze instance (on the <hostname> machine).
analyzeCli --host <hostname> supload C:/temp/file1.csv C:/temp/file2.csv
Upload Data files to the Public folder the server (remote machine)
The data files are uploaded to the current user's 'My Folder' on the remote Analyze instance (on the <hostname> machine).
analyzeCli --host <hostname> supload -d Public C:/temp/file3.csv C:/temp/file4.csv
Download Data files from the Public folder the server (remote machine)
The data files are downloaded from the Public folder on the server to the current directory.
analyzeCli --host <hostname> sdownload Public/Results1.csv Public/Results2.csv
Download Data files from My Documents folder the server (remote machine)
The data files are downloaded from the user Bob's 'My Folder' on the server to the current directory.
analyzeCli --host <hostname> sdownload Bob/Results3.csv Bob/Results4.csv
SCRIPTING
If you wish to execute multiple commands in one session, you can add the commands to a file and then invoke analyzeCli with the '--script <filename>'. For example, the following file, will connect to the Analyze server running on port 8081 on the local machine and then preload three Data Flows.
# Set any options required (will override any from the command line)
options: --host localhost --port 8081
# The commands to be executed
login
mkdir /Users/admin/Preload
import -d /Users/admin/Preload /Users/tsegall/Preload/ADLS.lna
import -d /Users/admin/Preload /Users/tsegall/Preload/MD.lna
import -d /Users/admin/Preload /Users/tsegall/Preload/PD.lna
Note: If any of the commands in the script file fails, then the script will exit.
Comments
1 comment
I'd like an example of a config file to use with the --config(-c) option.
Please sign in to leave a comment.