VMware Horizon Community
DanielKlewzyc
Contributor
Contributor

Windows NLB application level monitoring script

Hi, Attached is a script to monitor and restart view security server services and leverage windows NLB based on service failure.  Its adapted from: Windows NLB and Application Level health check | Tech Trail Mix

Figured it could be of some use to people and maybe get some feedback on how i can improve it.

Here’s a quick run through of  how to implement it:

1. Setup windows firewall to allow inbound and outbound traffic from the machine running the script.

2. Customise script for the servers we want to monitor, fire up powershell ISE and open up the script.

3. Pop in the hostnames of each pair of connection servers and setup the email address you want the notifications sent to.

            4. Set the execution policy in power shell to unrestricted on each nlb node Run power shell as Administrator and pop in the following:

    Set-ExecutionPolicy – Unrestricted

            5. Create a scheduled task to run the script at regular intervals, not on the servers you wish to monitor.

C:\schtasks /create /tn ViewHealthCheck /tr “powershell -NoLogo -WindowStyle hidden -file c:\ViewHealthCheck.ps1″ /sc minute /mo 1 /ru System

What it checks:

  1. Check the status of each NLB node
  2. Check the status of the view services
  3. If a service has failed then attempt to restart it then recheck the service and see if it has started successfully, if not stop that NLB node.

It will send email notifications if it detects a failure.

Currently it checks the following services in this order:

  1. MpsSvc - windows firewall
  2. wsnm - VMware Horizon View Framework Component
  3. PCOIPSG - VMware Horizon View PCoIP Secure Gateway
  4. wstunnel - VMware Horizon View Security Gateway Component
  5. wsbroker - VMware Horizon View Security Server
  6. VMware Horizon View Blast Secure Gateway - VMware Horizon View Blast Secure Gateway (so much for shortnames vmware!)

There’s lots of room for improvement, any suggestions/ammendments would be appreciated. It has been tested on View 6 security servers.

Probably need to check dependencies for certain services like windows firewall and framework and make it restart 'failed' NLB nodes automatically.

Cheers!

0 Kudos
1 Reply
rwagnerinf
Contributor
Contributor

Hi DanielKlewzyc, very cool!

This script tests only NLB in VmWare ?

These return codes are NLB VwWare , the " -eq statuscode " 1007 " ," for example ?

You know adapt to monitor the NLB manager windows ?

0 Kudos