1753841 Members
9266 Online
108806 Solutions
New Discussion

CLI Script with dynamic variables

 
Linkk
Frequent Advisor

CLI Script with dynamic variables

Hello,

I want to write a CLI Script with a dynamic variable, depending on which switch is executing the script. For example the device IP address or the current date and time.

Example Code:

copy command-output "show tech all" tftp 10.10.10.10 $DEVICE_IP-$DATETIME.txt

Unfortunately I can't find a list of variables for CLI scripts. Is it even possible in IMC to do this? I know that it is quite simple in f.e. Solarwinds.

 

2 REPLIES 2
rgausman
Occasional Advisor

Re: CLI Script with dynamic variables

Would also like to know if there is a list of variables which can be incorporated into the 'Configuration Template' script such as hostname, host IP, Date/Time etc.

 

Bob G. 

 

RPapaux
Valued Contributor

Re: CLI Script with dynamic variables

Hello,

You can basically build variables with any SNMP object available on your switch.

Obviously the MIB must be loaded in your IMC, and you should know the MIB module name.

The format is $(MIBNAME|objectId|instanceNumber)

p.ex. if you want the systemName, the variable will look like this:

$(RFC1213-MIB|sysName|0) 

Ray