This is another post on XenApp 6.5 scripting. And yes, again, the reason for that is a ton of people are still on XenApp 6.5 and not everyone has a budget for all the fancy and pretty monitoring tools out there. Not saying they are not good. They are great. But money talks at the end and the economy is not that great for many XenApp customers out there so cheapo is the way to go sometimes.
Based on the work of others (my apologies but honestly I cannot find where this came from originally – if the author contacts me, all credits for the initial script will be given here), I tweaked this script to get me the load on a particular worker group, in an easy to read graph. Take a look at it:
I agree it is not the fanciest graph out there but allows you to see all servers in the farm and how much load you have on each of them. You can then add to a web page that will refresh itself every 60 seconds for example so you always have the latest and greatest data from the farm. So here you have the script:
# load the appropriate assemblies
Add-PSSnapin Citrix* -ErrorAction SilentlyContinue
# get the server names and load
$XALoad = Get-XAServer -WorkerGroup YourWorkerGroup | Get-XAServerLoad | Select-Object ServerName,Load
$XALoad = $XALoad.GetEnumerator() | sort ServerName
# create chart object
$Chart = New-object System.Windows.Forms.DataVisualization.Charting.Chart
$Chart.Width = 1000
$Chart.Height = 600
$Chart.Left = 10
$Chart.Top = 10
# create a chartarea to draw on and add to chart
$ChartArea = New-Object System.Windows.Forms.DataVisualization.Charting.ChartArea
$ChartArea.AxisX.Interval = 1
$ChartArea.AxisX.Title = “PROD”
$ChartArea.AxisY.Interval = 1000
$ChartArea.AxisY.Title = “Load”
# add a data point for each server
foreach ($server in $XALoad)
$dp1 = new-object System.Windows.Forms.DataVisualization.Charting.DataPoint(0, $server.Load)
$xlabel = $server.ServerName
$dp1.AxisLabel = $xlabel.Substring(3)
# set the title to the date and time
$title = new-object System.Windows.Forms.DataVisualization.Charting.Title
$Chart.Titles.Add( $title )
$Chart.Titles.Text = date
# save the chart to a file
Make sure you change the Worker Group name and the location where you want the graph saved (it is in PNG format and the folder must exist). In my case I run the script on the XenApp controller.
There is still some stuff I want to add like:
– Different colours based on the load (i.e. red if over 8000, green if under 5000, etc).
– As each server can have up to 9999 as its load index before being unavailable (10000) if you know the number of servers you have you can indeed show a load percentage for the whole farm. Sure it is not a perfect metric but it is a good indicator. For example if you have 10 servers and the load on all of them adds up to 84350 we can be pretty sure you are at around 84.4% capacity on your farm. Again this is not an exact number but a pretty good idea where things stand when looking at the graph.
The idea here is to create a bunch of these graphing scripts and add all to a single ‘dashboard’ page that will show you the most relevant quick information you need when monitoring a XenApp environment.
Contributions to this in terms of scripts and new ideas are more than welcome.
2,542 total views, 0 views today