Export and import runbooks
Export and import runbooks by sending requests to the HTTP API. You can use existing tools to send requests, for example cURL, Postman for Chrome, or RESTClient for Firefox.
Before you can send requests, you need to create an API key for authentication. See API Keys for instructions how to create an API key.
In addition, determine the fully qualified domain name and the port where the runbook service is
running (which might be different from the location where the Netcool/OMNIbus DASH UI server is
running). The base URL for sending API requests has the format
https://<fullyQualifiedDomainName>:<rba-rbs-port>
, for example,
https://myhost.mycompany.com:3005
.
Export Runbooks
The following two calls create output, which can be imported again.GET api/v1/rba/runbooks?exportFormat=true
When enabling the option
exportFormat via the query parameter, the usual output of the command is replaced
by an array of JSON objects. These JSON objects can be used to create the runbooks by using the
import API endpoint. The following call is an
example:curl -u <APIKeyUsername>:<APIKeyPassword> https://myhost.mycompany.com:3005/api/v1/rba/runbooks?exportFormat=true
Replace <APIKeyUsername> with your username and <APIKeyPassword>
with your password.GET api/v1/rba/runbooks/<RunbookId>?exportFormat=true
Replace
<RunbookId> with the ID of the runbook. You can retrieve this ID, for example, from the
Edit Runbook window. The following call is an
example:curl -u <APIKeyUsername>:<APIKeyPassword> https://myhost.mycompany.com:3005/api/v1/rba/runbooks/<RunbookId>?exportFormat=true > exportedRunbook.json
Replace <APIKeyUsername> with your username and <APIKeyPassword>
with your password. Replace <RunbookId> with the ID of the runbook.Import Runbooks
POST api/v1/rba/runbooks/import
The
following call is an
example:curl -H "Expect:" -H "Content-Type: application/json" -u <APIKeyUsername>:<APIKeyPassword> -d@./exportedRunbooks.json https://myhost.mycompany.com:3005/api/v1/rba/runbooks/import
Replace
<APIKeyUsername> with your username and <APIKeyPassword> with your password.
Note: ./exportedRunbooks.json
is the output file that is created from the previous
example.jq
tool installed.- Example: Split by maximum file sizeIf your runbooks do not reference any automation actions, or if your automation actions are not shared between multiple runbooks, you can use the following command to split the file into chunks of a maximum of 10 MB each, named
exportedRunbooks.json.aa
,exportedRunbooks.json.ab
, etc.:cat exportedRunbooks.json | jq .[] -c | split -C 10485760 --filter='jq . -cs > $FILE' - exportedRunbooks.json.
- Example: Split by automation actionsIf
exportedRunbooks.json
is larger than 10 MB and if it contains multiple runbooks that reference the same automation action, then try to group all these runbooks into a single chunk file. This avoids creating multiple copies of the same automation action during the import. You can use the following command to split the original file into multiple JSON chunk files, namedexportedRunbooks.json.aa
,exportedRunbooks.json.ab
, etc. Each of these files contains all the runbooks that reference the same set of automation actions:cat exportedRunbooks.json | jq 'group_by(.automations)'[] -c | split -l 1 - exportedRunbooks.json.
General Notes on export and import
- Exporting runbooks returns the data of referenced automations inline. These automations are created new when the runbook is imported.
- Import actions do not overwrite existing runbooks, automations, or both.
- Exporting multiple runbooks at once will consolidate automations that are referenced by more than one runbook and only create the minimum necessary number of new automations.
- Imported runbooks are in draft state and do not retain any kind of version or execution. The user performing the import action is visible as the runbook creator.
- When exporting multiple runbooks, ones with invalid nested runbook references and invalid automation action references will not be exported. The export will include all other runbooks, and all errors are logged in the runbook service.
For more information about creating an API key, see API Keys.
For more information about the API, see https://rba.us-south.cloudeventmanagement.cloud.ibm.com/apidocs-v1.