Defining the script output (Linux)

Using the PATROL for Scripting KM for monitoring your environment is a two-stage process:

  • Define execution plan for your monitoring environment- Select or write scripts, place the scripts at the respective locations, define the script output
  • Monitor the environment- Configure the scripts (locally or remotely)

You can define the script output, and the definitions are set on the PATROL Agent when the policy is applied. The script output should be returned to the standard output and must be defined in one of the following ways:

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

Example

200 
The page content 1 
The page content N/2 
The page content N

Multiple instances

The script output should return multiple lines, where each line simulates an instance with its corresponding parameters. The new instances will be displayed as a new monitor types (dynamic monitor types based on the script output) with the corresponding parameters. 

Note

Before configuring multiple instances using a script, make sure that the script output does not create instances on TrueSight Operations Management console with ‘|’ character in their name. The TSOM instances are created based on the script output, instance name that contains a  ‘|’ character in the name need to be replaced with any other special character, such as the ‘_’ character.


If the script output is based on multiple instances then the Script value parameter in the LINUX-UNIX shell script monitor type will be set to value 0 since it is not relevant for multiple instances output base (the Script value attribute is relevant only if the script output is considered as single value option).

Note

In this option, all the lines must have the same metadata, each line with the same monitor type name and the same parameters names.

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

Interfaces=Ethernet1,InErr=3,OutErr=5,Speed=7 

Interfaces=Ethernet2,InErr=3,OutErr=5,Speed=7 

Interfaces=Ethernet3,InErr=3,OutErr=5,Speed=7 

Interfaces=Ethernet4,InErr=3,OutErr=5,Speed=7 

Structure

+ Interfaces 

+ Ethernet1 

InErr 

OutErr 

Speed 

+ Ethernet2 

InErr 

OutErr 

Speed 

+ Ethernet3 

InErr 

OutErr 

Speed 

+ Ethernet4 

InErr 

OutErr 

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

Interfaces=Ethernet1,3,5,7 

Interfaces=Ethernet2,3,5,7 

Interfaces=Ethernet3,3,5,7 

Interfaces=Ethernet4,3,5,7 

Structure 

+ Interfaces 

+ Ethernet1 

Value1 

Value2

Value3

+ Ethernet2

Value1

Value2

Value3

+ Ethernet3

Value1

Value2

Value3

+ Ethernet4

Value1

Value2

Value3 

Was this page helpful? Yes No Submitting... Thank you

Comments