Runbooks API
Using the Runbooks API, you can perform tasks such as create and modify runbooks with special runbook elements, such as parameters, automations, commands, and goto elements. To interact with the Runbooks API, you can use the Swagger UI or cURL.
Using the Swagger UI
Perform the following steps to open the Swagger UI for runbooks:
- Log in to the Netcool®
Operations Insight® UI at
https://netcool-noi.yourcluster.com
. - In a new browser tab, open the URL
https://netcool-noi.yourcluster.com/rbarb/swagger/
. This opens the page for the default application. - Paste the URL
https://netcool-noi.yourcluster.com/rbarb/doc-v1
into the Explore area to open the Swagger page for the Runbooks API.
Runbooks API
You can access the Runbooks API by clicking a link
similar to:
https://server_name/api/v1/rba
Where
server_name is the name of the server on which your Netcool
Operations Insight deployment is
running. Using the Runbooks API you can:- Create a parameter
To create a parameter, include it in the parameters section of your JSON input. Use the following syntax to use it inside the runbook description:
Where<span class="rba-parameter" data-id="parametername"></span>
$PARAMETERNAME
is the name of the parameter that is chosen in the parameters section of the input JSON. The following JSON shows an example of a runbook defining one step with a mandatory parameter:{ "name": "An example runbook", "steps": [ { "number": 1, "description": "Solve the task to solve the problem in data center <span class=\"rba-parameter\" data-id="dataCentre"></span>." } ], "parameters": [ { "name": "dataCentre", "description": "The data centre in which the operation needs to be done" } ] }
- Insert a command
Use the following syntax to mark a section of your step description as a command:
Where<section class="rba-command"><span class="rba-command-text">$COMMAND</span></section>
$COMMAND
is the text you want to be displayed and executed as a command. This text must not contain any additional HTML markup, such as tags, except for runbook parameters. The following JSON shows an example of a runbook defining one step with a command:{ "name": "An example runbook with a command", "steps": [ { "number": 1, "description": "Log in to the system and display the running processes with the following command: <section class=\"rba-command\"><span class=\"rba-command-text\">ps -ef</span></section>." } ] }
- Insert a GoTo element
Use the following syntax to insert a GoTo element into a runbook:
Where<span class="rba-goto" data-id="step$NUMBER">
$NUMBER
is the step number that the GoTo element is directing the user to. To go to the end of the runbook, usedata-id="end"
. The following JSON shows an example of a runbook defining multiple steps, with a GoTo to step 3 within the first step:{ "name": "An example runbook with a GoTo", "steps": [ { "number": 1, "description": "If you are running on a system with SELinux disabled, directly <span class=\"rba-goto\" data-id=\"step3\">." }, { "number": 2, "description": "Disable SELinux." }, { "number": 3, "description": "Issue a command that should prevented by SELinux and make sure it executed okay." } ] }
- Insert a collapsibile section
Use the following syntax to insert a collapsible section with a title into a runbook:
Where<section class="rba-collapsible"><h2 class="rba-collapsible-title">$TITLE</h2><div class="rba-collapsible-description">$COLLAPSIBLECONTENT</div></section>
$TITLE
is the text to always be displayed and$COLLAPSIBLECONTENT
is the content only visible when expanded. The following JSON shows an example of a runbook with a collapsible section in step 1. The title contains the text Show Details and the text contains additional information:{ "name": "An example runbook with a collapsible section", "steps" : [ { "number" : 1, "description" : "<p>The system name is server01.mydomain.com</p><section class=\"rba-collapsible\"><h2 class=\"rba-collapsible-title\">Show details:</h2><div class=\"rba-collapsible-description\">The system is has a 4 core CPU and 8 GiB RAM.</div></section>" } ] }
- Changing a Runbook
To change an existing runbook instead of creating a new one, use the API endpointPATCH /api/v1/rba/runbooks/$RUNBOOKID
. Where$RUNBOOKID
is the runbook ID of the runbook that you want to change. The JSON sent will update the sections present in the JSON and leave the sections not present untouched. The following JSON is sent to/api/v1/rba/runbooks/abcdefabcdefabcdefabcdefabcdefab
:
This action will only change the description of the runbook and leave all other properties, for example name, steps, parameters, and tags unchanged.{ "description": "This runbook has been updated with a new description: Use this runbook to resolve issues around the error code \"ARBR108E\"." }