Starting a RM Agent as a service on Windows
To ensure that the Resource Monitoring agent starts by itself when the host is running, you can set up the environment in such a way that the Resource Monitoring agent can be started as a service.
Before you begin
Previously to starting a Resource Monitoring Agent as a service on Windows, you need to have:
- Java 8 installed on the host.
- HCL OneTest™ Server added to the PATH environment variable.
- An offline token to connect the agent securely with appropriate permissions. You
can create an offline token from the User menu of the Resource Monitoring page
or you can re-use your active offline token. The token expires if it is not used
for a month.
To allow remote access to the performance data on Windows 10, you must have considered the following information:
- The user name and password are the same on the local and remote servers. Otherwise you must have provided remote server credentials.
- The remote user must be a member of the Performance Monitor Users group (start lusrmgr.msc and add the user to this group).
- The Remote Registry service must be running on the remote host (start services.msc) and must have verified the Remote Registry status).
- File and printer sharing must be enabled on the Network Interface of the remote host that is implied in the communication with the local host.
- The remote firewall is not blocking access; the following Windows
Firewall rules must be activated:
- File and Printer Sharing (NB-Name-In)
- File and Printer Sharing (NB-Session-In)
- File and Printer Sharing (*)
Procedure
- Download the latest release of winsw. You can choose to download WinSW.Net2.exe or WinSW.Net4.exe depending on the version of .Net framework that you already have on the host Windows.
- Create a folder on your local hard drive like RMAgent-winservice.
- Copy the downloaded executable to this new folder and rename the file to RMAgent-winservice.exe.
- Create a new text file in the same folder and name it RMAgent-winservice.xml.
-
To set up the offline token, copy and adapt the following content to this new
RMAgent-winservice.xml file:
<service> <id>RMAgent-winservice</id> <name>Resource Monitoring Agent</name> <description>This service runs the Resource Monitoring Agent.</description> <executable>java</executable> <env name="HCL_ONETEST_OFFLINE_TOKEN" value="(Enter your offline token here"/> <arguments>-jar %BASE%\RMAgent.jar --serviceUrl=https://<service-host>/rm --projectId=<projet-id> --autoUpgradeDownloadThen=execute:cmd,/c,start,%BASE%\auto-upgrade.bat</arguments> <onfailure action="restart" delay="10 sec"/> <logmode>rotate</logmode> </service>
Note:- Replace <service-host> by the host name of the host that runs HCL OneTest™ Server.
- Replace <project-id> which is the number you find after /projects/ in the browser's URL when browsing to this project.
- Create a new text file in the same folder and name it auto-upgrade.bat.
-
To upgrade the agent .jar file automatically, copy the following content to
this new file:
@echo off for /f "tokens=*" %%a in ('dir /b /od %BASE%\com.hcl.test.rm.agent-*.jar') do set newest=%%a %BASE%\RMAgent-winservice.exe stop del %BASE%\RMAgent.jar mklink %BASE%\RMAgent.jar %BASE%\%newest% %BASE%\RMAgent-winservice.exe start
- Start the command prompt as an administrator and change the directory to the newly created directory RMAgent-winservice.
- Download the Agent .jar file that is available from the Agents page in the Resource Monitoring service, under the Extend the Resource Monitoring service with agents section and save it to the same directory.
-
In the command prompt, type the following command to create a symbolic link
named RMAgent.jar to the agent jar file:
mklink RMAgent.jar com.hcl.test.rm.agent-<version-and-datetime>.jar
-
Type the following commands:
RMAgent-winservice install
RMAgent-winservice start
- In the Services Windows application, you can check whether the service is up and running.
- You can see in the Resource Monitoring page whether the Resource Monitoring Agent is disconnected or connected.
Results
The Windows Agent is added to the main page of the Resource Monitoring service in HCL OneTest™ Server.