Run service
The Run service enables you to run jobs and track their status, as well as manage several other types of objects used by jobs.
- Job Management
- Resource Management
- Event Management
- Workload Policy Management
- Service Management
- Variable Management
- Alert Management
Job Management
Use the Run service to manage your jobs and perform various job actions, as well as track job status and view job output and logs.
run
Use the run command to run jobs on the Control-M environment. The returned runId can be used to check job status.
The following example shows a typical command and response. build takes place as part of the run.
{
"runId": "2d4af716-e31d-48ef-a434-16575303752d",
"statusURI": "https://ec2-54-187-1-168.us-west-2.compute.amazonaws.com:8443/run/status/2d4af716-e31d-48ef-a434-16575303752d"
}
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobDefinitionsFile> | The file or archive that contains code for jobs. Files must be in JSON format. |
[deployDescriptorFile] | (Optional) The file that includes the rules to apply on the original definitionsFile. The rules enable transforming Control-M JSON code properties. For detailed information, see Deploy-Descriptor. |
If annotation is enabled for the Scheduling definitions category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
run order
Allows you to run deployed jobs on the Control-M environment. The returned runId is used to check job status. Below is a typical command and response.
{
"runId": "e0ddf056-4497-49f7-9d8b-25758b132bd6",
"statusURI": "https://ec2-54-201-124-17.us-west-2.compute.amazonaws.com:8443/automation-api/run/status/e0ddf056-4497-49f7-9d8b-25758b132bd6"
}
CLI Syntax
Where:
Parameter | Description |
---|---|
<ctm> | Control-M/Server |
<folder> | Folder name that is ordered |
[jobs] | The jobs that you want to run:
|
[z/OS library] | For a z/OS job : The name of the z/OS library that contains the jobs |
[configuration file] | (Optional) JSON file that contains additional parameters. |
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
In the configuration file, you can specify the following additional parameters:
Parameter | Description |
---|---|
variables | Defines job variables for the run, expressed as name:value pairs. |
hold | Enables you to make changes to a job before it starts running. Values: true|false Default: false |
ignoreCriteria | Enables you to run a job when ordered, ignoring the configured scheduling criteria. Values: true|false Default: true |
independentFlow | Determines whether a flow in a folder is ordered uniquely. Not applicable to Sub Folders. Values: true|false Default: true |
orderDate | Determines the work day on which to schedule the job. This can be either "current" or a future date in YYYYMMDD format. Default: current |
waitForOrderDate | Enables you to wait for the defined Order date to run. Values: true|false Default: false |
createDuplicate | Determines whether jobs/sub-folders with the same name that already exist in the Folder are to be added to the SMART folder. This is relevant when orderIntoFolder (next parameter) is set to Recent or to a specific Order ID. Values: true|false Default: true |
orderIntoFolder | Determines how to order jobs or Sub Folders that belong to a SMART Folder. Jobs and Sub Folders are added to a SMART Folder according to the following Order Into Folder options:
Default: New If the job or Sub Folder is inserted into an existing folder or Sub Folder that has already completed, the status of all parent folders is set to Executing. If it is not possible due to scheduling criteria, the job remains in WAIT_SCHEDULING status. This parameter is ignored if the folder that is ordered is not a SMART Folder. |
Here is an example of a configuration file:
"variables": [
{"arg": "1234"},
{"arg2": "abcd"},
{"arg3": "0000"}
],
"ignoreCriteria": "true",
"orderIntoFolder": "Recent",
"orderDate": "20170903",
"waitForOrderDate": "false",
"hold": "true"
}
REST API Syntax
See REST API reference.
Example using curl:
token=
ctm=
folderName=
curl -X POST -H "Authorization: Bearer $token" --header "Content-Type: application/json" --header "Accept: application/json" -d "{
\"ctm\": \"$ctm\",
\"folder\": \"$folderName\",
\"hold\": \"true\",
\"ignoreCriteria\": \"true\",
\"orderDate\": \"20170903\",
\"waitForOrderDate\": \"false\",
\"orderIntoFolder\": \"Recent\",
\"variables\": [{\"arg\":\"12345\"}]
}" "$endpoint/run/order"
Here is another example for ordering a z/OS job using curl:
token=
ctm=M90CTM
folderName=
jobName=IOATEST
library=CTMP.V900.SCHEDULE
curl -X POST -H "Authorization: Bearer $token" --header "Content-Type: application/json" --header "Accept: application/json" -d "{
\"ctm\": \"$ctm\",
\"folder\": \"$folderName\",
\"jobs\": \"$jobName\",
\"library\": \"$library\",
\"hold\": \"true\",
\"ignoreCriteria\": \"true\",
\"orderDate\": \"20170903\",
\"waitForOrderDate\": \"false\",
\"orderIntoFolder\": \"Recent\",
\"variables\": [{\"arg\":\"12345\"}]
}" "$endpoint/run/order"
run status
The run status command allows you to track the status of running jobs. The following command shows how to check job status using the runId.
NOTE: To get a valid output from the outputURI and logURI fields when running commands through the CLI, you must use the token from the ctm session login. Copy the token and paste it in the ctm run status command as the input of the -t option.
CLI Syntax
Where:
Parameter | Description |
---|---|
<runId> | Value returned in a ctm run invocation. It enables job tracking during a specific run invoked by the same user. |
startIndex | (Optional) enable iteration over all statuses. Result includes "itemsPerPage": 25 items from this index. If not defined, the default is 0. |
REST API Syntax
See REST API reference.
Example using curl:
Response
The following example shows the parameters in the ctm run status response
NOTE: When there is more than one job in the flow, the status of each job is checked and returned.
{
"completion": "Completed",
"statuses": [
{
"jobId": "controlm:00fhb",
"folderId": "controlm:005gy",
"numberOfRuns": 3,
"name": "AutomationAPISampleFlow",
"type": "Folder",
"status": "Executing",
"held": "false",
"deleted": "false",
"cyclic": "false",
"startTime": "May 18, 2018 11:57:26 AM",
"endTime": "",
"estimatedStartTime": [
"20180518121500,",
"20180518123000,"],
"estimatedEndTime": [
"20180518121502,",
"20180518123005,"],
"outputURI": "Folder has no output"
},
{
"jobId": "controlm:00fhc",
"folderId": "controlm:005gy",
"numberOfRuns": 3,
"name": "AutomationAPISampleFlow/CommandJob",
"type": "Command",
"status": "Wait Host",
"held": "false",
"deleted": "false",
"cyclic": "false",
"startTime": "",
"endTime": "",
"estimatedStartTime": [],
"estimatedEndTime": [],
"outputURI": "Job didn't run, it has no output"
},
{
"jobId": "controlm:00fhd",
"folderId": "controlm:005gy",
"numberOfRuns": 3,
"name": "AutomationAPISampleFlow/ScriptJob",
"type": "Job",
"status": "Wait Condition",
"held": "false",
"deleted": "false",
"cyclic": "false",
"startTime": "",
"endTime": "",
"estimatedStartTime": [],
"estimatedEndTime": [],
"outputURI": "Job didn't run, it has no output"
}
],
"startIndex": 0,
"itemsPerPage": 25
}
Where:
Parameter | Description |
---|---|
completion | Whether the job has run — Completed | Pending. If "Pending", you can run the run status command again until value is "Completed". |
jobId | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
folderId | The folderId is used to reference a specific folder |
numberOfRuns | Number of job runs |
name | Name of job |
type | Job type |
status | Job status |
held | Whether the job was held — true | false |
deleted | Whether the job was deleted — true | false |
cyclic | Whether the job is defined as a cyclic job — true | false |
startTime | The time when the job started |
endTime | The time when the job ended |
estimatedStartTime | The estimated date and time when the next job runs (up to 50) are expected to begin. Estimations are based on run times of previous jobs runs, and are available only if SLA Management is installed in your environment. |
estimatedEndTime | The estimated date and time when the next job runs (up to 50) are expected to end. Estimations are based on run times of previous jobs runs, and are available only if SLA Management is installed in your environment. |
run jobs:status::get
This command allows you to track running jobs that match a search query.
The following command shows how to get job statuses using a search query.
The following command shows how to get job statuses of a job's linked jobs.
CLI Syntax
Limit refers to the maximum number of job statuses returned.
-s is used to run a search using the query string format "field1=criteria1&field2=criteria2".
Where:
Field | Criteria | Criteria example |
---|---|---|
|
Note: The server field was previously named ctm (deprecated name). | jobname=job1122 jobname=job11* jobname=job11*,job77* description=*a job that* jobid=controlm:005gy |
|
| orderDateFrom=180123 fromTime=20180123184500 |
status |
To use multiple criteria, separate criteria with commas. | status=Ended OK status=Ended OK, |
| 9.0.20.015 true | false | "held=true&cyclic=false&deleted=false" |
neighborhood | Returns the status according to the dependencies between jobs. To create dependencies between jobs, use the Flow object.
| "neighborhood&jobid |
REST API Syntax
See REST API reference.
Example of a curl request that includes a limit:
Response
The following example shows the parameters for one of the jobs returned in the response to the jobs status get command.
"jobId": "LocalControlM:00008",
"folderId": "LocalControlM:00007",
"numberOfRuns": 0,
"name": "job1",
"folder": "SanityCommandOk",
"type": "Command",
"status": "Wait Condition",
"held": true,
"deleted": false,
"cyclic": "false",
"startTime": "",
"endTime": "",
"estimatedStartTime": [],
"estimatedEndTime": [],
"orderDate": "180903",
"ctm": "LocalControlM",
"description": "",
"host": "",
"application": "OsApp",
"subApplication": "",
"outputURI": "Job did not run, it has no output",
"logURI": "http://localhost:48080/run/job/LocalControlM:00008/log"
}
The following table describes the parameters in this sample response:
Parameter | Description |
---|---|
jobId | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
folderId | A unique identifier of the folder to which the job belongs. The format of this ID is "Control-M/Server name:order ID of the folder" |
numberOfRuns | Number of job runs |
name | Name of job |
folder | Name of the folder to which the job belongs |
type | Job type |
status | Job status The following list includes valid job statuses:
|
held | Whether the job was held — true | false |
deleted | Whether the job was deleted — true | false |
cyclic | Whether the job is defined as a cyclic job — true | false |
startTime | The time when the job started |
endTime | The time when the job ended |
estimatedStartTime | The estimated date and time when the next job runs (up to 50) are expected to begin. Estimations are based on run times of previous jobs runs, and are available only if SLA Management is installed in your environment. |
estimatedEndTime | The estimated date and time when the next job runs (up to 50) are expected to end. Estimations are based on run times of previous jobs runs, and are available only if SLA Management is installed in your environment. |
orderDate | The work day on which the job was scheduled, in YYMMDD format |
ctm | Control-M/Server name |
description | A textual description of the job, as defined during job creation |
host | host of the Control-M/Agent where the job is running |
application | The name of an application with which the job is associated. An application is a logical set of related jobs. |
subApplication | The name of a sub-application with which the job is associated. A sub-application is a logical sub-category of an application. For example, a group of payroll-related jobs are logically grouped together in a sub-application named Payroll, within an application named Finances. |
outputURI | URI to the job output |
logURI | URI to the job log |
run job:output::get
This command allows you to view the output from job runs.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
[runNo] | (Optional) The run number of the job to get the output. If not defined, the default is the last run. |
If annotation is enabled for the AJF get job information category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
run job:log::get
This command allows you to view the job log.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
If annotation is enabled for the AJF get job information category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
run job:status::get
This command allows you to view a specific job run status.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
For information about the response to this API command and descriptions of the job properties in this response, see the description of the run jobs:status::get response.
REST API Syntax
Example using curl:
run job:statistics::get
9.0.20.000 This command returns time statistics for the recent runs of a job.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
Response
The response provides time statistics for each job run (order date, start and end time, run time, and CPU time), as well as an average of the key time statistics from all runs. If periodic statistics are collected for this job, job run statistics are presented for each period separately.
Note that the job ID returned for each job run is a unique serial number assigned to the job run by the Control-M/Server. It differs from the job ID specified in the input.
The following example response contains data from two job runs. No periods were defined for data collection from the job in this example.
"periods": [
{
"runInfo": {
"averageInfo": {
"startTime": "07:35:53",
"cpuTime": "00:00:00",
"runTime": "00:00:01"
},
"runs": [
{
"startTime": "06/02/2020 07:39:00",
"endTime": "06/02/2020 07:39:00",
"cpuTime": "00:00:00",
"runTime": "00:00:01",
"jobId": "75",
"orderDate": "06/02/2020"
},
{
"startTime": "06/02/2020 07:38:00",
"endTime": "06/02/2020 07:38:00",
"cpuTime": "00:00:00",
"runTime": "00:00:01",
"jobId": "2",
"orderDate": "06/02/2020"
}
]
}
}
]
}
REST API Syntax
Example using curl:
run job::kill
This command allows you to terminate the job.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
run job::runNow
This command allows you to immediately start the job. When you use this command, job constraints are not applied.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
run job::hold
This command allows you to hold (that is, stop processing) the job.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
run job::free
This command allows you to continue job run from hold state.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
run job::delete
This command allows you to mark the job for deletion. At the next scheduled date, the job will be deleted.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
run job::undelete
This command allows you to remove a mark for deletion from a job.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
run job::confirm
This command allows you to run a job that is waiting for confirmation.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
run job::setToOk
This command allows you to set job status to OK, after the job has been processed. You can use this command, for example, after resolving issues that caused a job to end in status Not OK.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
run job::rerun
This command allows you to rerun a job (provided that it is not currently executing). When you use this command, the existing job constraints are applied.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
[zosJobConfig] | 9.0.20.005 For a z/OS job only: Full path and name of a JSON file that contains advanced parameters. Note: To rerun a z/OS job, the job must be in one of the following statuses:
|
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
If you are rerunning a z/OS job, you can specify additional parameters through the configuration file:
"zosParameters": {
"from": {
"pgm": "INPROCS2",
"proc": "STEP1"
},
"to": {
"pgm": "INPROCS3",
"proc": "STEP2"
},
"cleanup": true,
"recaptureAbend": "Y",
"recaptureConditionCode": "N",
"stepAdjustment": true,
"restartParmMemberName": "IDJOB5"
}
}
The configuration file for a z/OS job contains the following advance parameters:
Parameter | Description |
---|---|
from, to | Use the from and to parameters to limit job rerun to a range of steps. Define the starting point (under from) and the end point (under to) by specifying the program step (pgm) Note the following scenarios:
|
cleanup | Whether to perform data set cleanup, either true or false. If you set this parameter to true, all other parameters described here are not relevant and should NOT be included in |
recaptureAbend | Whether to save the abend codes from the original Job execution. Valid values:
|
recaptureConditionCode | Whether to save the condition codes from the original Job execution. Valid values:
|
stepAdjustment | Whether to enable automatic Step Adjustment. Valid values are true and false. The default is true. For more details about Step Adjustment, see the Control-M/Restart User Guide. |
restartParmMemberName | The name of the member that contains control parameters for the Job to restart (1-8 characters only). The default value is the member that contains the JCL of the Job. |
REST API Syntax
See REST API reference.
Example using curl:
For a z/OS job, include the advanced parameters described above in the body of the REST request, using the -d (or --data) option.
run job::waitingInfo
This command displays the reasons why a waiting job has not yet been executed (for example: missing conditions, resources, hosts, users, or workloads).
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
REST API Syntax
See REST API reference.
Example using curl:
run job::get
This command returns the definitions of a running job in JSON format.
For a description of the returned job format, see Code-Reference.
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
run job::modify
This command enables you to modify the definitions of a running job that is currently held (that is, a job for which processing has been stopped), based on job definitions that you define through a Job Definitions file.
Currently, you can modify running jobs of the following types:
- Command
- Script
- EmbeddedScript
- FileTransfer
- Informatica
CLI Syntax
Where:
Parameter | Description |
---|---|
<jobDefinitionsFile> | A JSON file that contains the details of a single job, including the properties that you want to modify. For a description of the syntax of the JSON code in this file, see Code-Reference and all its child pages. Note that this JSON file contains details of only a single job. Do not include other object types (such as folder or connection profile) in this JSON file. Note: The following job properties currently do NOT support the Modify action:
In addition, under the When parameter, only FromTime and ToTime support the Modify action. |
<jobId> | A unique identifier of the job. The jobId is used to reference the specific job and is returned by ctm run status. The format of this ID is <ctm_server>:<orderId>. |
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
Resource Management
A quantitative resource is represented by a name of a resource and the maximum number of that resource which jobs can use. Jobs that require a quantitative resource cannot run unless there are enough resources available.
run resource::add
The add resource command allows you to add a quantitative resource to a Control-M/Server.
CLI Syntax
Where:
Parameter | Description |
---|---|
<server> | Name of the Control-M/Server |
<name> | Name of the resource Maximum 2048 characters |
<max> | Maximum quantity of resources available Valid values: 0-9999 |
If annotation is enabled for the Independent AJF entities category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
curl -H "Authorization: Bearer $token" -H "Content-Type: application/json" -X POST -d "{\"name\": \"newResource\",
\"max\":5}" "$endpoint/run/resource/$server"
run resource::delete
The delete resource command allows you to delete a quantitative resource.
CLI Syntax
Where:
Parameter | Description |
---|---|
<server> | Name of the Control-M/Server |
<name> | Name of the resource Maximum 2048 characters |
If annotation is enabled for the Independent AJF entities category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
name=newResource
curl -H "Authorization: Bearer $token" -X DELETE "$endpoint/run/resource/$server/$name"
run resource::update
The update resource command allows you to update the values of a quantitative resource.
CLI Syntax
Where:
Parameter | Description |
---|---|
<server> | Name of the Control-M/Server |
<name> | Name of the resource Maximum 2048 characters |
<max> | Maximum quantity of resources available Valid values: 0-9999 |
If annotation is enabled for the Independent AJF entities category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
name=newResource
curl -H "Authorization: Bearer $token" -H "Content-Type: application/json" -X POST -d "{\"max\":6}" "$endpoint/run/resource/$server/$name"
run resources::get
The get resources command allows you to get all resource records from a specific Control-M/Server.
CLI Syntax
-s is used to run a search using the query string format "field1=criteria1&field2=criteria2".
Criteria may contain "*" for wildcard matching and comma separator to specify multiple values.
Where:
Field | Description |
---|---|
server | Name of the Control-M/Server This field was previously named ctm (deprecated name). |
name | Name of the resource Maximum 2048 characters |
-s "name=A*"
-s "server=controlm*&name=resourceA,resourceB"
Response
The following example shows the parameters in the ctm run resources::get response:
{
"name": "newResource",
"ctm": "controlm",
"available": "15",
"max": 15,
"workloadPolicy": "N/A"
},
{
"name": "myRes",
"ctm": "controlm",
"available": "4",
"max": 4,
"workloadPolicy": "N/A"
},
Where:
Parameter | Description |
---|---|
<ctm> | Name of the Control-M/Server |
<name> | Name of the resource Maximum 2048 characters |
<available> | Number of resources available |
<max> | Maximum resources available |
<workloadPolicy> | Name of workload policy that is linked to the resource. N/A indicates that the resource is not linked to a workload policy. For more information about workload policies, see the documentation on Workload Policy in the Control-M Online Help. |
REST API Syntax
See REST API reference.
Example using curl:
curl -H "Authorization: Bearer $token" -X GET "$endpoint/run/resources?$search_criteria"
Event Management
An event (AKA a condition) is represented by a name and a date. Jobs that require an event cannot run unless the specific event exists. A job can add or delete an event.
run event::add
The add event command allows you to add events to the Control-M/Server.
CLI Syntax
Where:
Parameter | Description |
---|---|
<server> | Name of the Control-M/Server |
<name> | Name of the event |
<date> | Date options to order the event:
|
If annotation is enabled for the Independent AJF entities category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
curl -H "Authorization: Bearer $token" -H "Content-Type: application/json" -X POST -d "{\"name\": \"newEvent\",\"date\":\"0505\"}" "$endpoint/run/event/$server"
run event::delete
The delete event command allows you to remove an event.
CLI Syntax
Where:
Parameter | Description |
---|---|
<server> | Name of the Control-M/Server |
<name> | Name of the event |
<date> | Date options to order the event:
|
If annotation is enabled for the Independent AJF entities category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
name=newEvent
date=0505
curl -H "Authorization: Bearer $token" -X DELETE "$endpoint/run/event/$server/$name/$date"
run events::get
The get events command allows you to get all events from the Control-M/Server.
CLI Syntax
-s is used to run a search using the query string format "field1=criteria1&field2=criteria2".
Criteria may contain "*" for wildcard matching and comma separator to specify multiple values.
Where:
Field | Description |
---|---|
server | Name of the Control-M/Server This field was previously named ctm (deprecated name). |
name | Name of the event |
date | Date of event |
limit | Limits the number of returned matches. Default: 1000 (if not defined) |
-s "name=A*&date=0805"
-s "server=controlm&name=eventA,eventB&date=0805"
REST API Syntax
See REST API reference.
Example using curl:
curl -H "Authorization: Bearer $token" -X GET "$endpoint/run/events?$search_criteria"
Response
The following example shows the parameters in the ctm run events::get response:
{
"name": "flow1_from_FlowAcc_goodJob_to_FlowAcc_badJob_2902",
"ctm": "controlm",
"date": "0726"
},
{
"name": "flow1_from_FlowAcc_goodJob_to_FlowAcc_badJob_2935",
"ctm": "controlm",
"date": "0726"
},
{
"name": "flow1_from_FlowAcc_goodJob_to_FlowAcc_badJob_2974",
"ctm": "controlm",
"date": "0726"
},
{
"name": "flow1_from_FlowAcc_goodJob_to_FlowAcc_badJob_3007",
"ctm": "controlm",
"date": "0726"
}
]
Workload Policy Management
Workload Policies enable you to balance the workload on Control-M resources and hosts. A Workload Policy groups together any number of jobs and enforces workload rules that limit resource usage by those jobs during specific time periods. You can manage the definitions of Workload Policies through a JSON file (separate from the JSON file used to define jobs and other objects). For more information about defining Workload Policies, see Workload-Policies-reference. For more general information about workload policies, see the documentation on Workload Policy in the Control-M Online Help.
run workloadpolicies:detailed::get
Retrieves full details of all defined Workload Policies or a specific Workload Policy.
The response contains the full JSON details, as described in Workload-Policies-reference.
CLI Syntax
The -s option can be used to query for a specific Workload Policy. If you do not include the -s option, details are returned for all defined Workload Policies.
REST API Syntax
See REST API reference.
Example using curl to retrieve definitions of all Workload Policies:
-X GET "$endpoint/run/workloadpolicies/detailed"
Example for retrieving the definitions of a specific Workload Policy:
curl -H "Authorization: Bearer $token" -H "Content-Type: application/json"
-X GET "$endpoint/run/workloadpolicies/detailed?name=$policyname"
run workloadpolicies::add
Creates new Workload Policies from definitions provided through a JSON file, as described in Workload-Policies-reference .
CLI Syntax
Where <workloadPoliciesFile> is the name of a JSON file that contains the definitions of the Workload Policies that you want to create. For more information, see Workload-Policies-reference.
REST API Syntax
See REST API reference.
Example using curl:
-F "workloadpoliciesfile=@examples/WPs.json" -X POST "$endpoint/run/workloadpolicies"
run workloadpolicy::delete
Deletes a specific Workload Policy.
CLI Syntax
Where <policyName> is the name of the specific Workload Policy that you want to delete.
REST API Syntax
See REST API reference.
Example using curl:
-X DELETE "$endpoint/run/workloadpolicy/$policyname"
run workloadpolicies::get
Retrieves details of defined Workload Policies, with the option of filtering by status (that is, retrieving only active workload policies or only inactive workload policies).
Details in the response include the current status of each Workload Policy (whether active or inactive) and details of the last update to Workload Policy definitions.
CLI Syntax
REST API Syntax
See REST API reference.
Example using curl:
-X GET "$endpoint/run/workloadpolicies?state=Active"
run workloadpolicy::activate
Activates a Workload Policy that is currently inactive.
To activate multiple Workload Policies, you can specify a string that contains an asterisk as a wildcard. In addition, you can optionally filter Workload Policies by associated Control-M/Server.
CLI Syntax
Where:
Parameter | Description |
---|---|
[policyName] | The name of a Workload Policy or, for multiple Workload Policies, a string that contains an asterisk as a wildcard. |
server | (Optional) The name of an associated Control-M/Server to use as a filter. Only Workload Policies that are associated with the specified Control-M/Server are activated. |
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
server=LocalControlM
curl -H "Authorization: Bearer $token" -H "Content-Type: application/json"
-X POST "$endpoint/run/workloadpolicy/$policyname/activate?server=$server"
run workloadpolicy::deactivate
Deactivates a Workload Policy that is currently active.
To deactivate multiple Workload Policies, you can specify a string that contains an asterisk as a wildcard. In addition, you can optionally filter Workload Policies by associated Control-M/Server.
CLI Syntax
Where:
Parameter | Description |
---|---|
[policyName] | The name of a Workload Policy or, for multiple Workload Policies, a string that contains an asterisk as a wildcard. |
server | (Optional) The name of an associated Control-M/Server to use as a filter. Only Workload Policies that are associated with the specified Control-M/Server are deactivated. |
If annotation is enabled for the Active network category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
server=LocalControlM
curl -H "Authorization: Bearer $token" -H "Content-Type: application/json"
-X POST "$endpoint/run/workloadpolicy/$policyname/deactivate?server=$server"
Service Management
9.0.19.230Services are groups of jobs that are aggregated based on criteria that you specify. Control-M Automation API can help you manage SLA services that are associated with SLA jobs (also known as Control-M BIM jobs) at the end of a job flow. Service Management in Control-M Automation API is supported for a Control-M environment with Control-M/EM version 9.0.18.200 or later.
run services:sla::get
Retrieves details of defined SLA-type services.
For more information, see Service Management in the Control-M Online Help.
CLI Syntax
REST API Syntax
See REST API reference.
Example using curl:
-X GET "$endpoint/run/services/sla"
Response
The following example shows the parameters in the response to the ctm run services:sla::get command. This example lists just one SLA-type service.
"serviceLastUpdatedTime": "2020-01-26T10:19:42+00:00",
"activeServices": [
{
"serviceName": "SLA-BAD",
"status": "Not Ok",
"statusReason": "Service late,Job failure,Service actually late",
"startTime": "2020-02-09T10:08:10+00:00",
"endTime": "2020-02-09T10:14:20+00:00",
"dueTime": "2020-02-09T08:00:05+00:00",
"slackTime": "-02:14:15",
"serviceOrderDateTime": "2020-02-09T07:00:05+00:00",
"scheduledOrderDate": "20200209",
"serviceJob": "LocalControlM:0002c",
"serviceControlM": "LocalControlM",
"priority": "3",
"note": "",
"totalJobs": "3",
"jobsCompleted": "1",
"jobsWithoutStatistics": "1",
"completionPercentage": "33",
"averageCompletionTime": "",
"errors": "Job \"FindFile\" ended with failure.\nJob \"SLA-Bad\" should have started by 08:00:05 GMT+00:00 and will not start on time. The reason is: \"SLA-Bad\" is waiting for Wait Condition.",
"statusByJobs": {
"executed": "0",
"waitCondition": "2",
"waitResource": "0",
"waitHost": "0",
"waitWorkload": "0",
"completed": "0",
"error": "1"
}
}
]
}
In this response, serviceLastUpdatedTime specifies the most recent date and time when the services were updated. After that, for each active SLA-type service, the following parameters are displayed:
Parameter | Description |
---|---|
serviceName | Name of service |
status | Current status of the service |
statusReason | One or more reasons for the current status |
startTime | Date and time when the service started to run |
endTime | Date and time for when the service is estimated to stop running |
dueTime | Deadline date and time by which the service must complete to be considered not late |
slackTime | Difference in time between the dueTime and its estimated endTime |
serviceOrderDateTime | Date and time when the service was ordered |
scheduledOrderDate | Order date if rescheduled during the order |
serviceJob | Job ID of the job associated with the service |
serviceControlM | Control-M/Server where the service runs |
priority | Priority level of the service |
note | Specific service information entered as a note for the service |
totalJobs | The total number of jobs in the service |
jobsCompleted | The number of jobs in the service that completed |
jobsWithoutStatistics | The number of jobs without statistic information |
completionPercentage | Percentage of jobs in the service that completed |
averageCompletionTime | An estimate of the length of time that the service will require to complete |
errors | Error messages received for the jobs in the service |
statusByJobs | A breakdown of how many jobs finished in each job status |
Variable Management
Variables enable the automatic assignment of dynamic environmental values to the execution parameters of a job.
Control-M Automation API can help you manage pool-type variables. Variables of this type are organized in hierarchical groups, and they are expressed in the following manner: %%\\<named_pool>\<variable_name>
For more information about variables, see Variables in the Control-M Online Help.
Note: You must have Control-M/Server and Control-M/EM version 9.0.21 or later to run Variable Management commands.
run variables::get
Retrieves details of defined pool variables that match a search query.
CLI Syntax
-s is used to run a search using the query string format "field1=criteria1&field2=criteria2&field3=criteria3", with the following supported fields:
Field | Description |
---|---|
pool | Name of the pool For example: pool=Pool1 For wildcard matching, you can specify * in the named pool string. The * wildcard can be used as either the only character or the last character. For example: pool=* or pool=P* The default (when not specified) is * (all pools). |
variable | Full name of the variable For example: variable=Var1 For wildcard matching, you can specify * in the variable string. The * wildcard can be used as either the only character or the last character. For example: variable=* or variable=V* The default (when not specified) is * (all variables). |
server | Name of Control-M/Server The server field is required only if you have more than one Control-M/Server. In such a case, the * wildcard is not supported. If you have only one server, you do not need to include this field or you can use server=* (the default). |
REST API Syntax
See REST API reference.
Note that in a RST API command, all backslashes must be escaped, as in the following curl example:
-X GET "$endpoint/run/variables?server=*&variable=%%\\\\P*\\V*"
Response
The following example shows a response to the run variables::get command. Note that all backslashes are escaped in the JSON format.
"variables": [
{ "%%\\\\PoolName\\AUTOVar1InPoolAddedAudit": "value1" },
{ "%%\\\\PoolName\\AUTOVar2InPoolAddedAudit": "value2" }
]
}
run variables::set
Enables you to define new pool variables or update the definitions of existing pool variables.
CLI Syntax
Where:
Parameter | Description |
---|---|
server | Name of Control-M/Server |
variablesDefinitionFile | Full path and name of a JSON file that contains definitions of variables, as in the following example: { "variables": [ { "%%\\\\PoolName\\AUTOVar1InPoolAddedAudit": "value1" }, { "%%\\\\PoolName\\AUTOVar2InPoolAddedAudit": "value2" } ] } Note that all backslashes are escaped in the JSON format. |
If annotation is enabled for the Independent AJF entities category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
curl -H "Authorization: Bearer $token" -H "Content-Type: application/json"
-X POST "$endpoint/run/variables/$server" -d @VariablesDefinitions.json
run variables::delete
Deletes variables from the server.
CLI Syntax
Where:
Parameter | Description |
---|---|
server | Name of Control-M/Server |
variablesNames | Full path and name of a JSON file that contains a list of names of variables, as in the following example: { "variables": [ "%%\\\\PoolName\\AUTOVarInPool", "%%\\\\PoolName\\AUTOVarInPool2" ] } Note that all backslashes are escaped in the JSON format. |
If annotation is enabled for the Independent AJF entities category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
curl -H "Authorization: Bearer $token" -H "Content-Type: application/json"
-X DELETE "$endpoint/run/variables/$server" -d @VariableNames.json
Alert Management
9.0.20.105An alert is a message that indicates that a problem or exception has occurred for a Job or Folder. Control-M Automation API enables you to update basic properties of alerts, as well as the status of alerts. For more information, see the documentation about Alerts in the Control-M Online Help.
run alerts::update
Updates basic properties of alerts, including the urgency of the alerts and the associated comments.
CLI Syntax
The configuration file contains the properties required for updating the alerts. Note that besides the mandatory alertIds parameter, you must include at least one of the other parameters in the configuration file.
Parameter | Description |
---|---|
alertIds | Unique identifiers for the alerts that you want to update. |
urgency | Severity of the alert, one of the following (listed in ascending level of severity):
|
comment | A free-text comment regarding the alert. |
Here is an example of a configuration file:
"alertIds" : [30,31],
"urgency":"Normal",
"comment":"update"
}
REST API Syntax
See REST API reference.
Example using curl: In this example, the configuration file is named alertModifyValue.json.
-X POST "$endpoint/run/alerts" -d @alertModifyValue.json
run alerts:status::update
Updates the status of the alert.
CLI Syntax
The configuration file contains the properties required for updating alert status.
Parameter | Description |
---|---|
alertIds | Unique identifiers for the alerts that you want to update. |
status | The status of the alert, one of the following:
|
Here is an example of a configuration file:
"alertIds" : [20],
"status":"Reviewed"
}
REST API Syntax
See REST API reference.
Example using curl: In this example, the configuration file is named alertModifyStatus.json.
alertIds=15,20
curl -H "Authorization: Bearer $token" -H "Content-Type: application/json"
-X POST "$endpoint/run/alerts/status/$alertIds" -d @alertModifyStatus.json