Using the XmlServiceReader with Health Monitoring and Recovery (HMR)

by Nicholas Dille on 06/16/2009 | 0 Comments | 5,160 Views

After publishing the XmlServiceReader and writing about the shortcomings of the health check for the XML service provided by Citrix, I like to expand on the process of creating a custom health check using the XmlServiceReader.

According to an article in the Citrix community, health checks are easily created in any language and even scripts. Such a script needs to return a zero exit code to indicate success and needs to return one if the test failed. The following code demonstrates how a custom request can be supplied and the response can be tested to contain a predefined string. See this article for a detailed description of the XmlServiceReader.

@Echo Off SetLocal Set MyDir=%~dp0 Set MyDir=%MyDir:~0,-1% ( Echo <RequestCapabilities> Echo <Nil /> Echo </RequestCapabilities> )>"%Temp%\XmlServiceReader-request.txt" Type "%Temp%\XmlServiceReader-request.txt" | "%MyDir%\XmlServiceReader.exe" -server %ComputerName% -port 8080 –stream >"%Temp%\XmlServiceReader-response.txt" Type "%Temp%\XmlServiceReader-response.txt" | Find /i "separate-credentials-validation" If ErrorLevel 1 Exit 1 EndLocal Exit 0

Please note that the following script tests the XML service located on port 8080 which may not apply in your environment. The port of the XML service can be read from the TcpPort value located under HKLM\SYSTEM\CurrentControlSet\Services\CtxHttp. Unfortunately, the contents of this value needs to be converted from hexadecimal to decimal.

Before deploying your own script on any of your servers, be sure to use the HMRSDKTester supplied by the HMR SDK. It creates a temporary service running with LocalSystem privileges and displays the output and return code of the script. Citrix also documents the security requirements for HMR tests. I have used this tool to validate the above script.

References

How to Write Your First Health Monitoring & Recovery Test

Health Monitoring & Recovery SDK 4.5

Security Requirements for Health Monitoring & Recovery Tests

Monitoring & Recovery Tests in any Language

+++ Your opportunity +++ Use Profile Migrator 2, the new sepago product that makes migrating user personalities between different platforms a breeze.! Download your free version now!

Add Comment

The content of this field is kept private and will not be shown publicly.
Captcha
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.

Citrix Competence Blog

The perfect integration of Citrix products is one main focus of sepago consulting services. In this blog our consultants are reporting about trends, new technologies and technical deep dives.The best place for straight talk about Citrix Products.

RSS-FeedSubscribe all Articles

 

About the author

nicholas's picture
Nicholas Dille
Head of Technology and Innovation
Blogs about Centralized computing, virtualization and performance monitoring

All articles