Using the XmlServiceReader with Health Monitoring and Recovery (HMR)

by Nicholas Dille on 06/16/2009 | 0 Comments | 5,149 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

+++ Profile Migrator 2 - Ein neuer Desktop, ein frisches Benutzerprofile und alle bewährten Einstellungen und Daten. Jetzt kostenlos und unbefristet testen!

Add Comment

Der Inhalt dieses Feldes wird nicht öffentlich angezeigt.
Sicherheitscode
Diese Frage hat den Zweck zu testen, ob Sie ein menschlicher Benutzer sind und um automatisierten Spam vorzubeugen.
Bild-CAPTCHA
Geben Sie die Zeichen ein, die im Bild zu sehen sind.

Citrix Competence Blog

Der optimale Einsatz der Citrix Produktpalette steht seit Jahren Im Fokus der sepago Beratungsdienstleistung. In diesem Blog berichten wir über neue Trends, technische Details und unsere Erfahrungen aus vielen Citrix Projekten.

RSS-FeedAlle Artikel des Competence Blogs abonnieren.

 

Über den Autor

Bild von nicholas
Nicholas Dille
Head of Technology and Innovation
Blogs about Centralized computing, virtualization and performance monitoring

Alle Artikel des Bloggers