Defining the script output (Windows)
Single value
The script output must return a number at the first line that will be presented in the static monitor type named Script within the Value parameter. All the lines starting with the second line will be attached to the parameter value as an annotation.
Example
A script that invokes HTTP GET request and prints the HTTP RC and the page content
Multiple instances
The script output should return multiple lines, where each line simulates an instance with its corresponding parameters. The new instances gets displayed as new monitor types (dynamic monitor types based on the script output) with the corresponding parameters which are returned as an output upon execution of the script.
Script output metadata feature
Map script output instances to devices
Property name: I2D
Property value: True or false
Example: <metadata>I2D=true</metadata>
Optional use case: Discovered instances based on the script output are real devices.
Description: To map the script output instances to devices in TSPS feature named device mapping, the first line at the device output should be: <metadata>I2D=true</metadata>. To disable device mapping either remove this line from the script output or set it as: <metadata>I2D=false</metadata>
Override the monitor type name
Property name: MonitorTypeName
Property value: The name of the monitor type that will get created.
Example: <metadata>MonitorTypeName=Process</metadata>
Optional use case: Monitor type name must be a unique name, assuming that you configured two scripts:
get-process and get-service, both of them will get instantiate using the Name monitor type, hence each one of the Cmdlet creates the same monitor type named Name but with a different content, this will consider it as an invalid operation. In order to have a separate monitor type for each script configured to run, add the user defined name at the first line of each script output (example: for get-process set it as <metadata>MonitorTypeName=Process</metadata> and for get-service set it is as <metadata>MonitorTypeName=Service</metadata>).
Description: To set a user defined monitor type name based on the script output, the first line at the device output should be: <metadata>MonitorTypeName=MyMonitorTypeName</metadata>
- One-liner command supports formatted output by adding format-list.
For example: Get-process | Format-List Name,Id,PM,VM
- When running cmdlets, the default monitor type is Name. To override the default monitor type add the metadata to the first line in script output.
For example: <metadata>MonitorTypeName=ProcessName</metadata>
- You can add echo “metadata>MonitorTypeName=ProcessName</metadata>”;get-process. The monitor type should be a unique name across all configured scripts.
- You can merge arguments to create an unique instance name
For example: Get-process | Format-List Name+Id,PM,VM
PowerShell cmdlet output
Defining each line in the script output
With the output metadata
MonitorTypeName=instanceName1,parameter1=value,parameter2=value,parameterN=value
MonitorTypeName=instanceName2,parameter1=value,parameter2=value,parameterN=value
MonitorTypeName=instanceNameN,parameter1=value,parameter2=value,parameterN=value
where,
MonitorTypeName is the static name of the monitor type that is created to group all of the instances
instanceName is the instance name. This is a dynamic name. Each instance will be created in the MonitorTypeName container. This instance will hold all the user defined parameters.
parameter is the name of the parameter that will provide the value for each instance
Structure
+ MonitorTypeName
+ instanceName1
parameter1
parameter2
parameterN
+ instanceName2
parameter1
parameter2
parameterN
+ instanceNameN
parameter1
parameter2
parameterN
Without parameter names
MonitorTypeName=instanceName1,value,value,value
MonitorTypeName=instanceName2,value,value,value
MonitorTypeName=instanceNameN,value,value,value
where,
MonitorTypeName is the static name of the monitor type that is created to group all of the instances
instanceName is the instance name. This is a dynamic name. Each instance will be created in the MonitorTypeName container. This instance will hold all the user defined parameters.
parameter is none. The name of the parameters will be Value1,Value2,ValueN
Structure
+ MonitorTypeName
+ instanceName1
Value1
Value2
ValueN
+ instanceName2
Value1
Value2
ValueN
+ instanceNameN
Value1
Value2
ValueN
Example1
A script that returns the interfaces of the device. For each interface the script returns three parameters, InErr, OutErr, and Speed.
Example 2
A script that returns the interfaces of the device. For each interface the script returns three parameters values, without the parameters names.