This article has been updated to reference Goliath Agent version 12.0 and newer.
Goliath Performance Monitor has the ability to trigger an alert notification based on scheduled script execution results. Using this functionality, Goliath can execute a Windows Powershell script on the Citrix Delivery Controller to check if there are any machines in the Citrix site with the power state of "unmanaged". If so, the below sample script & monitoring rule configuration will:
- Create a text file in C:\Temp on the Citrix Delivery Controller with a list of machines with the power state of unmanaged
- Send an email notification through Goliath to email users of unmanaged power state
- Save the event in the Goliath database to be reported on or viewed in our alerting dashboards
Sample Script
Here is a sample powershell script for you to save on to one of your Citrix Delivery Controllers. We recommend saving the script to C:\Program Files\MonitorIT.
asnp Citrix*
$getDate = Get-Date -Format "MMddyy_HHmmss"
$powerStateUK = @()
$powerStateUK = get-brokermachine -powerstate unknown | select HostedMachineName
if($powerStateUK.count -eq 0){
#exit code - success, no issue
[Environment]::Exit(0)
}else{
#write machines to file
$powerStateUK | Out-File -FilePath C:\Temp\UnknownPowerState-$getDate.txt
#exit code - fail, machines found
[Environment]::Exit(1)
}
Configure Monitoring
- Ensure script is saved to C:\Program Files\MonitorIT on one of the Citrix Delivery Controllers
- If saving script to a different location be sure to update the configuration in step 7 below.
- Navigate to the Configure - Monitoring Rules page in the Goliath web console
- Click the New button
- Chose the option for Advanced Watch
- Configure the rule name, optional description, and severity
- Configure the Program Name field to be the following:
-
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
-
- Configure the Cmd-line Options field to be the following, updating the script name and path as applicable
-
"& 'C:\Program Files\MonitorIT\PowerState.ps1'"
-
- Configure the Exit Code field to be =0
- This means if something other then 0 is returned it will trigger an alert
- This setting is only applicable if you would like Goliath to trigger an alert based on this script. If you would like the script to just run and not alert, leave this field blank.
- In the selection tree, select the Citrix Delivery Controller where the powershell script is saved
- Click the Schedule tab within the rule window
- Using the Run Program Every field, configure how frequently you would this script to run
- Using the Start At Date/Time field, configure the date/time in which the first script execution will take place
- Click the Notification tab within the rule window
- Optionally, enable email notifications to be sent when exit code is triggered
- Recommend configuring the Email Subject to be something along the lines of "Machines w/unmanaged power state detected"
- Recommend configuring the Custom Text to be something along the lines of "Machine(s) in an unmanaged power state detected, please see latest text tile on &N at 'C:Temp' for a list of machine(s)"
- see Configure Email and Text Alert Notifications for full configuration details
- Save the monitoring rule configuration
see article Configure Advanced Watch Rules for full configuration details
Please note, this configuration depends the Goliath Agent being in a connected state on the Citrix Delivery Controller.