Posted on December 10, 2020 9:59 pm
 |  Asked by Jose Villablanca
 |  144 views
RESOLVED
0
0
Print Friendly, PDF & Email

Hello

I wanted to see if its possible push simple commands like “clear counters” to all my switches using the cloudvision portal by GUI or at least with a python script.

It would be perfect something similar to what snapshots do, but not only with show commands.

Thanks

 

 

0
Posted by Philippe Bureau
Answered on December 11, 2020 2:35 pm

Hello,

You can use custom actions in Change Control to run commands on target switches from CVP.

The TOI is here :https://eos.arista.com/toi/cvp-2019-1-0/change-control-script-actions/

the script could look like this :

import json
from cvplibrary.auditlogger import alog
from cvplibrary import Device, CVPGlobalVariables, GlobalVariableNames
ip = CVPGlobalVariables.getValue(GlobalVariableNames.CVP_IP)
scriptArgs = CVPGlobalVariables.getValue(GlobalVariableNames.SCRIPT_ARGS)

alog("Running 'clear counters' from script")

target = Device(ip)

target.runCmds(["clear counters"])

The Yaml file could look like this :

name : kill_ConfigAgent_script

Once you have uploaded the script to CVP you will be able to assign it to any or all devices in a CC from the "add action" section

Post your Answer

You must be logged in to post an answer.