IMC
cancel
Showing results for 
Search instead for 
Did you mean: 

Insert variable into script

 
Mark-VGZ
Occasional Visitor

Insert variable into script

I'm trying to perform a task via IMC's configuration template feature which contains a variable dependent on the last octet of a device's IP address.

Is there a way to write a script that will insert this into a variable? So far, I've got:

mycommand ${variable name}

So I need the last octet to fill the ${variable name} part.

Thanks in advance!

1 REPLY
LindsayHill
Honored Contributor

Re: Insert variable into script

There's two different ways of handling variables with IMC. One way is to define a variable that you'll get asked for when you go to run the script. This is OK for a script that you want to run regularly against different devices, and don't mind manually entering a value each time you run it.

But for your case, I think you're looking more at using "MIB parameters"

2.Input MIB parameter, according with $(mibName|mibVariable|index).
For example: $(H3C-SYS-MAN-MIB|h3cSysImageSize|65537) or $(H3C-SYS-MAN-MIB|h3cSysImageSize|@(H3C-SYS-MAN-MIB|h3cSysReloadImage|65536)).

However...you might not be able to find a MIB parameter that matches the last octet.

If you can't, then you might be better off deploying a script that performs more complex processing on the switch itself. Depending on what your device can do, that might be Python or TCL.