nas - Pass Argument to Script from Auto Operator Profile
search cancel

nas - Pass Argument to Script from Auto Operator Profile

book

Article ID: 35011

calendar_today

Updated On:

Products

DX Unified Infrastructure Management (Nimsoft / UIM)

Issue/Introduction



How can I pass argument(s) from nas Auto-Operator profile when choosing the Action Type, "script"?

 

 

 

Environment

Release: CNMSPP99000-7.6-Unified Infrastructure Mgmt-Server Pack-- On Prem
Component:

Resolution

In "Script Parameter" field, type dollar sign ($) and wait for a moment for a popup with available arguments to show. You can then pick one from the list or just type in e.g
$nimid

If you want to pass more than one argument, separate them with comma - e.g 
$nimid,$hostname


To capture the arguments in script, you will need to use SCRIPT_ARGUMENT variable - e.g:

args = split(SCRIPT_ARGUMENT)

and then use them as needed, eg.

To print them out:

print(args[1],args[2])

To write to a file:

buff = args[1],args[2]
fname  = "test.txt"   
file.create (fname)
file.write (fname,buff)