Introduction
We published the CLICommandCollector App and it was introduced in another document. Although the original app (Version 1.0) enables users to search CLI commands and collect command outputs from multiple ACI nodes in parallel, we had a feedback that the App would be more useful if it could run a script on multiple ACI nodes in parallel as well.
We call the new feature 'Scripts', which is available in the new App version 1.2 or later. This document will describe how to use the feature.
If you are not familiar with our CLICommandCollector App, we recommend reading the previous document and following the prerequisite.
Prerequisite
You need to prepare for a zip file that contains a script file itself and script_config.yml file. script_config.yml file is a kind of meta file for the script and must contain following information (this is just an example):
name: "collect-port-count"
description: "Collect interface counters multiple times at specific interval."
role: ["leaf", "spine"]
script_path: "/data/techsupport/collect-port-count.sh"
root: false
command: "bash /data/techsupport/collect-port-count.sh"
option:
- -p:
required: true
description: "Enter the port number. Ex) 1/15, 2/22, etc."
default_value: "1/1"
- -s:
required: false
description: "Enter sleep length in second between each command execution."
default_value: 60
- -n:
required: false
description: "Enter how many times the script needs to collect the command outputs."
default_value: 3
output_path:
- "/bootflash/collect-port-count_*.log"
Each key is mandatory and means as follows:
- name: script name
- description: description for the script
- role (apic/leaf/spine): In which node role the script can run
- script_path: absolute path where the script is located on the node
- root: whether the script requires root privilege or not
- command: exact command to run the script on the node
- option: command options with required, description, and default value
- output_path: abosolute path of the output files which will be created by the script
This example indicates that the name of the script is "collect-port-count", it can run on leaf and spine switches, and do not require root privilege, etc. All the keys above are required, and fill the corresponding values for your script.
If your laptop is running Unix/Linux OS, zip your script file (collect-port-count.sh in this example) and script_config.yaml as follows.
$ ls
collect-port-count.sh script_config.yml
$ zip collect-port-count ./*
adding: collect-port-count.sh (deflated 58%)
adding: script_config.yml (deflated 54%)
$ ls
collect-port-count.sh collect-port-count.zip script_config.yml
Once you zip your script file and the script_config.yml file into a zip file, follow the instruction below.
Note: zip file name must be identical to its script name (value for "name" key in script_config.yml). For this example, uploaded zip file should be "collect-port-count.zip".
Use the Scripts feature
Upload the zip file from an upload button (left button) under the "Script List" in the Scripts menu page.

In most cases, the file is provided by the TAC to investigate an issue which still occurs on ACI node(s). If you have an original script that can run and exit safely on each node, you can use it as well. Once the file is uploaded, the script name and description will be displayed under the "Script List". Each script can be deleted using the delete button.

Detail of the uploaded script can be checked by clicking 'Detail' button. The contents of script_config.yml file should reflect here.

When you want to run the script, click the run button (left button) under the 'Operation', select the nodes on which you want to run a script, and change option values if needed. Then, click "Run" at the bottom. In this example, the script will run on two nodes, fab4-leaf1 & fab4-leaf2, to collect interface counters for eth1/21 (option -p) 5 times (option -n) at 60 second interval (option -s).

Once the script starts, it appears as Running Scripts with the node ID, PID, and the status displayed.

You can also view detailed status information by clicking the button under "Status (Detail)" for each process. This popup shows standard output and error that the script throws on the node.

For this example script, a set of commands is executed at 60 second interval. If you click the refresh button under the "Running Scripts" minutes after the script starts to run, "Status (Detail)" view will show you the progress of the script.

After the script exits by itself (or is terminated for some reason), clicking the refresh button under the Running Scripts gets the latest status of the script on each node and the status becomes 'Completed'. Then, by clicking the download button (the left button in the "Operation" column), you can download a compressed file containing the collected logs, and standard output & error that are also seen in the "Status (Detail)".

You can even terminate any running scripts and delete completed processes by clicking the delete button (the right button in the "Operation" column). Then, corresponding entry under the "Running Scripts" will be removed from the App UI as well.
Finally, the sample zip file (collect-port-count.zip) used in this example is attached to this document.