So, I've been following this tutorial on how to monitor citrix environnements via PRTG. I've based my self on Pim van Denderen's script and modified it a little bit to get all the datas i needed and to put them like i winted in PRTG :
# Import module if (-not (Get-module prtgshell)) { Import-Module -Verbose prtgshell } # Create a powershell session connection to the remote computer $session = New-PSSession -ComputerName $citrixddc # Run the commands on the remote computer #Group-BrokerMachine gives us a count already of what we want $result = Invoke-command -Session $session -scriptBlock { Add-PSSnapin Citrix* Group-BrokerMachine -Property SummaryState } # Start writing output to PRTG. $XMLOutput = "<prtg>`n" # temporary variable which gives us a table (Name,Count) so we get the count's value of Off, Available,InUse et Unregistered. $temp = ($result | Select Name, Count) #for each variable we get the count value $off = ($temp | Where {$_.Name -eq "Off"}).count $available = ($temp | Where {$_.Name -eq "Available"}).count $inUse = ($temp | Where {$_.Name -eq "InUse"}).count $unregistered = ($temp | Where {$_.Name -eq "Unregistered"}).count $total = $off + $available + $inUse + $unregistered #writing xml PRTG $XMLOutput += Set-PrtgResult "Desktops: Total" -Value $total -Unit "Desktops" #Desktops Connected $XMLOutput += Set-PrtgResult "Desktops: Connected / Active" -Value $inUse -Unit "Desktops" #Desktops Disconnected $XMLOutput += Set-PrtgResult "Desktops: Disconnected" $off "Desktops" # Desktops non enregistrés $XMLOutput += Set-PrtgResult "Desktops: Unregistered" $unregistered "Desktops" #Desktops available $XMLOutput += Set-PrtgResult "Desktops: Available" $available "Desktops" # Disconnect the session Remove-PSSession $session #Finish writing to PRTG $XMLOutput += "</prtg>" write-host $XMLOutput
I tried to execute it in the powershell commandline and it worked perfectly fine, i gathered all the datas i wanted :
So I've made a custom sensor on PRTG on the remote probe but it looks like it doesn't get the datas bc it only show 0 for each channels i've made... Do you guys have any ideas ? I think it's comming from the account permissions but I'm not sure and I don't really know how to fix it
Add comment