How to use script in Location Awareness table
search cancel

How to use script in Location Awareness table

book

Article ID: 140109

calendar_today

Updated On:

Products

CA Client Automation - IT Client Manager CA Client Automation

Issue/Introduction

In configuration policy under DSM/Agent/Common Agent/Common/Location Awareness/Locations it is possible to add rules in a table.

On column of the table is script.

How to use it ?

 

 

Environment

Client Automation - 14.x

 

 

Resolution

1- Create a file aware.ips containing these lines :


rem ---------------------------------------------------------------------

rem Simple location aware server identification script

rem This script writes a hard coded server name to the output file

rem ---------------------------------------------------------------------

 

dim sMatchingAddress as string

dim sOutputFileName as string

dim sErrorFileName as string

 

dim X as Integer

FOR X=0 to argc()

      

   rem Read the output file from the provided parameters

   if (argv(X)="-o") THEN

      sOutputFileName = argv(X+1)

   ENDIF

      

   rem read the matching address from the provided parameters

   if (argv(X)="-a") THEN

      sMatchingAddress = argv(X+1)

   ENDIF

 

   rem read the matching address from the provided parameters

   if (argv(X)="-x") THEN

      sErrorFileName = argv(X+1)

   ENDIF

 

NEXT X

 

dim fHandle as integer

 

fHandle = OpenFile(sOutputFileName,O_WRITE)

IF NOT(EOF(fHandle)) Then

   WriteFile(fHandle,"JY-PC4")

   CloseFile(fHandle)

   exit

ENDIF

exit



Replace JY-PC4 by Scalablity Server Name to use.




2- Copy the file aware.ips to the Agents under C:\Program Files (x86)\CA\DSM



3- In configuration policy location Awareness table, add aware.ips in script column.






This script will be executed by "caf register" with following command line :

 

dmscript.exe aware.ips -o "C:\WINDOWS\TEMP\itcm_server_id_script_output.txt" -x "C:\WINDOWS\TEMP\itcm_server_id_script_errors.txt" -a "192.168.1.153" -e "C:\WINDOWS\TEMP\itcm_server_id_engine_errors.txt"

-a : is the ipaddress to agent matching the rule

-o : is the output file which should contain the Scalability Server Name to use



If Agent ipaddress matches the rule TEST, "caf register" executes the script aware.ips and read the file C:\WINDOWS\TEMP\itcm_server_id_script_output.txt to find which scalability server to use.

If communication with this scalability server is working, it is used by Agent.