What is the output format of Script Templates?

To get the desired output for monitoring a device with scripts, it is important to define the Script Message and Script Data while configuring the script template in OpManager.

Output Message:

When a script is down or becomes active again, an alarm is raised to notify the user. An alarm message will be displayed in the notification. This alarm message is customizable and can be specified in the Script Body field while adding a script template.

Output Message Format:

Message: <Custom Message>

Example Script:

Message: This is a custom message

Sample Script Messages

VBScript:
WScript.Echo "Message: This is a custom message"
Powershell Script:
Write-Host "Message: This is a custom message"
Shell Script:
echo "Message: This is a custom message"

The alarm for the above scripts will display the message along with the notification as given in the image below.

Output Format of Script templates

When you do not specify the message description in the Script Body field, OpManager, by default, will display the script name along with its status as the alarm message(<scriptMonitorName>is up or <scriptMonitorName> is down).

Have a look at the example below where we have not specified a message in the Script Body field. So OpManager, displays the name of the script in the alarm notification.

Output Format of Script templates

Output Data Format

Specifying the format of the data used is important because the output data of the scripts are used to generate graphs and as are defined as input values for threshold limits for monitors.

The data should be specified in the given format below.

Data Format Syntax:
Data:
Instance1    value1
Instance2    value2
..
InstanceN    ValueN

Samples for expected Script output

OpManager supports three types of data types: Integer, Decimal and Strings. Based on the Data type selected, the output value will be compiled. Take a look at some of the sample script outputs based on the different data types.

Integer type
        
Data:    
Instance1    10
Instance2    20
..        
InstanceN    50
        
Decimal Type         
        
Data:        
Instance1    11.21
Instance2    15.123
..        
InstanceN    50.21
        
String Type         
        
Data:        
Instance1    NoIssues
Instance2    Up

Sample data format used in different scripts

Below we have given the output format for the script languages that are most commonly used. You can infer from these examples and implement a customized script or you can directly use these example scripts to obtain the desired results.

VB Script:

..

WScript.Echo "Message: This is a custom message"

..

..

WScript.Echo "Data:"

WScript.Echo "MemoryUsage "&memoryUsageValue

WScript.Echo "DiskUsage "&diskUsageValue

Powershell Script:

..

Write-Host "Message:This is a custom message"

..

..

Write-Host "Data:"

Write-Host "MemoryUsage "$memoryUsageValue

Write-Host "DiskUsage "$diskUsageValue

Shell Script :

..

echo "Message: This is a custom message"

..

..

echo "Data:"

echo "MemoryUsage $memoryUsage"

echo "DiskUsage $diskUsageValue"

 

 

 

 
 Pricing  Get Quote