Free 30 Day Trial
Find the root-cause of your cloud, hybrid-cloud
or on-prem performance issues
|
||
|
Writing a Script
In order to enable you to understand the basic ingredients of a script, the corrective script for the Service Availability measure of Windows Services test, has been provided below.
@echo off
rem The following is the format of the parameters
rem 1. <User parameters> (Anything that the user gives during test configuration will be here)
rem 2. -info (constant)
rem 3. <the value of the info>
rem We get all the parameters that the test gets
rem 4. -host (constant)
rem 5. <the monitored target, this could be IP or nick)
rem 6. -port (constant)
rem 7. <port number of the monitored target, if any>
rem 8. -serviceName (constant)
rem 9. <whatever is configured for process>
rem 14 -correct
rem 15 true (This will always be true, otherwise we wouldn't have come here)
rem 16 -userparams
rem 17 <whatever the user had configured>
rem 18 -correctivescript
rem 19 WinServiceTest_Availability.bat
rem 12 -rptName (constant)
rem 13 <the rpt name>
rem 14 -egMeasHost (constant)
rem 15 <the measurement host>
rem 16 -site (constant)
rem 17 <site name>
rem 18 -egMeasVals (constant)
rem The actual measures and the state follows
rem For WinServiceTestt, the following are the measures and state
rem 19 -Availability (measure name, constant)
rem 20 <state>
set service=%3
net start %service%
As is evident from the sample script above, a corrective script should include the following:
Besides, the script should extract the values of the test parameters provided in the test configuration page of . In case of the Windows Services Test, the parameters are as follows:
Finally, provide the command that will rectify the problems with the test, if any arise. Since the corrective script WinServiceTest should try to start the configured services if they stop, the command to that effect has been specified in the script file.
set service=%3
net start %service%
When an eG manager is installed on a host, a folder named AutoCorrect is created in the EG_INSTALL_DIR/bin directory. The AutoCorrect folder consists of some OS-specific folders (eg., folders named "Windows2003", "Linux", etc.). After building the custom script, save it to the OS-specific sub-folder that corresponds to the operating system on which the script is designed to execute.