Script-Variables
Used In: Script sections
Status: Optional
Note: Script-Variables
are not allowed if the Script-Schedule
attribute is defined in the same section, because scheduled scripts must have all necessary data defined for them at runtime.
You use the optional Script-Variables
attribute to define data input prompts to be displayed to the user when manually executing a CCS script. This is how you allow user input into an executed CCS script. The CCS script uses the values entered by the user as it executes. The Script-Variables attribute requires one or more variable definitions. Each variable must be defined on its own line, as in the following example:
Script-Variables:
$usernameword "User Name"
$password "New Password" string
The exact format of a Script-Variable definition is:
<variableName> <inputType> <defaultValue> <evalType>
<variableName>
can be any string (without blanks) that starts with $.
Note: Variable names are case-insensitive. Script variables can be referenced from anywhere in the script, but only in lower case.
<inputType>
determines the type of HTML entry used in the script input form and enforces input validation on values entered into the form. For example, to ensure that an IP address in dotted notation (or hostname) is entered, declare a variable with <inputType>
of <ipaddress>
. The following inputTypes are supported, with the associated HTML entry fields:
inputType | Corresponding HTML | Input method notes |
---|---|---|
string, word, int, integer, double, datetime, duration, url, id, phoneno, zipcode, email, ipaddress, regular ssi | Text | One line of text can be entered in the input form field |
list | listName (from NetMRI), ColumnLookupName, KeyValueName, ReturnColumnValue, DefaultName | Use a separately defined list (see The getListValue( ) Function section for more information). |
password | Password | Same as Text, except all characters entered into the form are obscured |
text | Textarea | Multiple lines of text can be entered in the input form field |
boolean | check box | If checked, value sent to server is "on"; Otherwise it is "off" |
When first shown, <defaultValue>
appears as the variable value in the script input form. You can overwrite the value as needed before submitting the form. <EvalType>
specifies how the value should be evaluated when used in a logical filter expression. The <evalType>
can be specified as string (this is the default if nothing is specified), number, or ipaddr. For example, to look for interfaces where $ifIndex < 10
, specify "number" as the <evalType>
for the $ifIndex
variable.
Note: By default, all variables are evaluated as strings in filter expressions.
Example
Script-Variables:
|
| |
|
|
|
|
| |
|
|
|