This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.
Control-M/Enterprise Manager v9.0.18 Control-M Report
How to run Control-M Report from command line using Control-M Automation API?
Running Control-M Report via Control-M Automation API
Installation instructions for the Control-M Automation Command Line Interface (CLI) are provided separately for each of the following platforms:
Step 1.1 - Install or Upgrade Node.js (Install Globally)
- Using a browser, download the Node.js Windows Installer from https://nodejs.org/en/download/
- Run the installer and follow the instructions on screen.
- The Node.js installer includes the npm (Node Package Manager) utility. For requirement details, see CLI Requirements. Verify that you have the required version installed by entering the following commands into a command prompt, as shown in this example:
Some Node.js installers include npm version 2.x or below. To upgrade npm, use the following command:
>npm -g install npm@latest
>npm -g install ctm-cli.tgz
Please take note even though we recommend that the CLI is installed as a global user on the machine but it does not imply that the environment is shared for all the users other than all users will have access to the binaries. As such if you wants to install it globally please apply below procedures.
setx PATH "%PROGRAMDATA%\npm;%PATH%" /M
npm config set prefix %PROGRAMDATA%\npm
4. Install package: npm i -g ctm-cli.tgz
help: Display help for a given command
help: help [command]
help: build Compile definitions to verify they are valid for Control-M
help: config Configure the Control-M environment
help: deploy Submit definitions to Control-M
help: documentation Get documentation
help: environment Define and select the Control-M environment
help: package Package a directory of definition files into a deployable archive
help: provision Install Control-M components
help: reporting Generate Control-M reports
help: run Run and track Control-M jobs
help: samples Manage data samples
help: session Manually maintain Control-M user sessions
help: -h, --help output usage information
help: -v, --version output the application versio
- Using a browser, download the Java Windows Installer from http://www.java.com/en/download/manual.jsp.
- Follow the instructions for Windows 64-bit
- For requirement details, see CLI Requirements. Verify that you have the required version and environment variable set as shown in this example:
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
Step 2.1: Since the Default environment "workbench" is arriving with the user: workbench I usually add another environment definition:
Step 2.2: Set the new environment as your working environment:
ctm env set env_1
Step 2.3: Verify that the new user can login:
ctm session login
Step 2.4: Verify report generation manually via ctm cli
In order to run ctm reporting command, make sure the user defined the ctm cli environment is same user that defined the Control-M report in the Control-M/Enteprise Manager Workload Automation client GUI
Else will receive an error "failed to get report <ReportName> " which is described in Knowledgebase Article # 000148073
Now you should be good for setting the reports:
ctm reporting report::get Sample_Report pdf -o C:\ExportDir\Sample_Report. pdf
And for CSV: ctm reporting report::get Sample_Report csv -o C:\ExportDir\Sample_Report.csv
- Use the above command and add it to your OS Job
- To add a date and/or time stamp to the file name of the report, the relevant Control-M System Variables can be used in the file name specified after the "-o" option in the Control-M job.
- The Control-M System Variables, including those related to time and date are covered in the online documentation at the following link: http://documents.bmc.com/supportu/9.0.18/help/Main_help/en-US/index.htm#1211.htm
For already installed environment the Run AS user would probably already be set correctly.
In case they are not please make sure that the Job is using a Run as user that is indeed used by the Agent, and has sufficient privileges to execute on the agent machine.
In the Lab - Follow the below steps:
- Set the Run as field to the user with which you log in to the machine (In our example - Run as Vagrant as can be seen in the above example)
- Set the user with which you log in to the machine to be the one used by the agent (Below item # 1)
3. Make sure that the user with which you log in to the machine is authorized through the CCM
This information is summarized in the following video:
Customers viewing this solution may find value in the following self-help Connect with Control-M video.