Populate the Value field on the Classifier Parameter form

The value field defines two JavaScript objects, called resourceType and isMatch.

About this task

The resourceType value refers to the Resource Type column in the Windows Cluster Resources table [cmdb_ci_win_cluster_resource]. The resourceType value can not be empty or null.

Procedure

  1. Navigate to a Windows cluster page to access the Windows Cluster Resources table.
  2. Click the Windows Cluster Resources tab.

Example

The isMatch value evaluates whether the process is a clustered process.
  • An evaluation that returns true indicates the process is a clustered application, and the process is classified as a clustered application in the cluster.
  • An evaluation that returns false classifies the process as a regular application running on the cluster node.
The isMatch value is a function that contains two input variables, process and resource:
  • process: Process is the GlideRecord of the process application. It is determined by the Table field in the classifier. In this example, it is the GlideRecord entry of the Application table (cmdb_ci_app) for the process that is being classified. You have access to any field values for the CI type such as name or version.
  • resource: Resource is the GlideRecord entry in the Windows Cluster Resource table after the resourceType condition has been applied. In the example, it is the GlideRecord entry of the sixth row.

Examples of JavaScript for the Value field

In the following example code: resourceType: "SQL Server" the query filters the Windows Cluster Resources table entry for the Resource Type field that has a value that is equal to SQL Server. In the following example table, the sixth record would be returned.

The following script indicates that if there is a resource of type SQL Server, the process is classified as a clustered application.
resourceType: "SQL Server" 
isMatch: function(process, resource) { 
    return true; 
}
The following script indicates that if if there is a resource of type SQL Server, and the application name is equal to the resource name, then the process is classified as a clustered application.
resourceType: "SQL Server" 
isMatch: function(process, resource) { 
    if (process.name == resource.name) 
        return true; 
}
If there are multiple matches to the resourceType condition, the matching function is called multiple times. For the following resourceType example, the matching function is called twice because there are two entries that have Physical Disk in the Resource Type column in the sample Windows Cluster Resources table.
resourceType: "Physical Disk" 
Windows Cluster Resources tab