Command Template Best Practices
Table of Contents
- Overview
- Features
- Installation Prerequisites
- Known Limitations
- How to Install
- How to Run
- Components
- Job Variables
- Additional Information
Overview
The Command Template Best Practices pre-built showcase the following features of command templates:
- The ability to skip over commands if certain conditions are met
- Extract value(s) from the output of a command run that can be used as variables or arrays in other commands
- Running a command against variables in an array, looping through each variable until all values in the array have been used
Main Workflow
Pictured below is the main workflow for this pre-built:
This workflow serves as an entry point for automation catalog to run the 3 use cases described above.
Features
- Includes an example to show the ability to skip over commands if certain conditions are met
- Includes an example to show extraction of value(s) from the output of a command run to be used as variables or arrays in other commands
- Includes an example to show running a command against variables in an array, looping through each variable until all values in the array have been used
- Modular Design
- User customizable memory percentage array for use case 3
Installation Prerequisites
In order to use the pre-built, users will have to satisfy one of the following pre-requisites:
- Itential Automation Platform
^2021.2
- Onboarded a10 device.
Known Limitations
At the time of this writing, the form does not make it mandatory for the user to input an array when the user chooses to run use case 3.
How to Install
To install the pre-build:
- Verify you are running a supported version of the Itential Automation Platform (IAP) as listed above in the Prerequisites section.
- The pre-build can be installed from within
App-Admin_Essential
. Simply search for the name of your desired pre-build and click the install button (as shown below).
How to Run
Automation Catalog
The pre-built can run from the Automation Catalog. First, select the use case you want to run. Next, select an a10 type device you want to run the commands on. Finally, if you choose to run use case 3, click on the +
icon under Number Array
and add integers between 0 - 100 for the memory percentage check.
Components
This pre-built is comprised of a set of modular components intended to modularize and simplify the features of Command Templates.
Workflows
Use Case 1 : Skip Command flow
-
show cpu
– if CPU utilization is > 90% skip to step 5 -
show memory
– if memory utilization is > 70% skip to step 4 -
show interface
show ip ospf
show ip ospf neighbor
Step 1 was checked using the check cpu command template and Step 2 was checked using the check memory static command template, both of which have been described in detail further ahead.
Use Case 2 : Extract Command Output flow
-
show cpu
– extract the value of CPU utilization -
show memory
– check if memory utilization is > CPU utilization from step 1
Step 1 was checked using the check cpu command template and Step 2 was checked using the check memory dynamic command template, both of which have been described in detail further ahead.
Use Case 3 : Loop Command Variables flow
show memory
– check if memory utilization is < every value in the dynamically input percentage array, for example: [100, 90, 80, 70, 60, 50]
The command was checked using the check memory dynamic command template, which is described in detail further ahead.
Command Templates
1) Check Cpu
This command template runs the show cpu
command and checks the output against a statically defined percentage number.
2) Check Memory Static
This command template runs the show memory
command and checks the output against a statically defined percentage number.
3) Check Memory Dynamic
This command template runs the show memory
command and checks the output against a percentage number passed in as a variable by the workflow job where this template is called. The variable has to be an object with the key as memory_percentage
and an integer as the value.
Automation Catalog Job
This pre-built can be run by using automation catalog. Please check How to Run for instructions on filling out the form.
Job Variables
Should you decide to run the pre-built without using automation catalog, the following job variables are required to start the pre-built.
All Workflows
Job Variable | Type | Description |
---|---|---|
device |
string | Device for the commands to be run on |
number_array (only for use case 3) |
array (only integers between 0-100) |
Threshold(s) for the memory utilization percentage |
Check Memory Command Template
Variable | Type | Description |
---|---|---|
memory_percentage |
integer | Threshold for the memory utilization percentage |
Additional Information
Please use your Itential Customer Success account if you need support when using this pre-built.