What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Citrix XenApp 7.x Monitoring

Votes:

0

Hi everyone,

we're currently redesign our infrastructure. Within this we will monitor it better, so we want to use our prtg more. I've googled the hole day now for looking any suggestions about monitoring XenApp/XenDesktop Provisioning Server etc with PRTG. How do you manage it? The "old" PRTG-Scripts for 6.5 won't work anymore. :(

regards, pilba

citrix xenapp xendesktop

Created on Apr 16, 2018 2:44:21 PM



Best Answer

Accepted Answer

Votes:

3

Hi,

First step I store Windows credentials in PRTG - so you can use them as parameters for your script. Using these credentials you can establish a remote Powershell session. Make sure your user account has the necessary rights for remote Powershell. For example local Admin. If you are working with Citrix cmdlets make sure your user has read only rights configured in Citrix Studio.

Sensor Parameters -server '<FQDN>' -domain '%windowsdomain' -username '%windowsuser' -password '%windowspassword'

Powershell Script Read and store the PRTG Sensor Parameters param ( [string]$server, [string]$domain, [string]$username, [string]$password )

With these parameters from PRTG you can store them in a variable $credentials $credentials = New-Object System.Management.Automation.PSCredential (($domain+'\'+$username), (ConvertTo-SecureString $password -AsPlainText -Force))

There are several ways to establishing a remote Powershell session. After some tests i decided to do it with Invoke-Command and run it as a job. It gives us some performance. $job = Invoke-Command -Computername $server -credential $credentials -ScriptBlock { ... } -asjob

Inside the ScriptBlock you can get your Data. The ScriptBlock is running on the remote Server. For example if you want to use Citrix cmdlets you can just add them to your session on a Citrix Controller. add-pssnapin citrix*

Now you can get all your Information like Get-BrokerServiceStatus Worker in maintenance= Get-BrokerMachine | Select -ExpandProperty "InMaintenanceMode" Active Session = (Get-BrokerSession | where {$_.SessionState -eq "Active" }).Count

Some cmdlets like Get-BrokerServiceStatus will give Data in Tform of text. You can substitute these to numbers and translate them back later by a value lookupskript.

Now we have our information and need them to get back to PRTG. In my Opinion its quite comfortable to put them in an Object and return it.

$Data= [PSCustomObject]@{ Data_1 = $Data_1 ... } return $Data

Now outside of the ScriptBlock we wait for the job to complete its work and give us our Data back Wait-Job $job | Out-Null $Data= Receive-Job -Job $job

Now you can create the XML Output for PRTG to display by accessing your Data like $Data.Data_1

Best regards, Phil

Created on Apr 19, 2018 12:05:00 PM



11 Replies

Votes:

2

We actualy use a custom Powershell Skript to monitor Citrix. Citrix itself provides a lot of cmdlets which you can use nearly out of the box. For better Performance run your remote powershell session as Job.

for Example:

Get-BrokerServiceStatus (Ok, Failed, DBNotFound,...)
Worker in maintenance= Get-BrokerMachine | Select -ExpandProperty "InMaintenanceMode"
Active Session = (Get-BrokerSession | where {$_.SessionState -eq "Active" }).Count

For better Performance run your remote powershell as Job.

-ScriptBlock {...} -asjob

Created on Apr 17, 2018 2:28:28 PM

Last change on Apr 18, 2018 5:18:30 AM by  Luciano Lingnau [Paessler]



Votes:

0

Hi there,

Thank you for your contribution, 19phila19.

You can find some third party scripts that may help you within the Script-World:
https://www.paessler.com/script-world/all/all/all?stats=all&fulltext=Citrix&newOnly=false&scroll=300&key=1524049638149

Best regards.

Created on Apr 18, 2018 11:08:18 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

Thank you 19phila91 for sharing your ideas,

I'm new to citrix and citrix powershell so i'm getting hard, I will try to create a script this afternoon to get the results in PRTG, how did you manage it? Did you install the Citrix-Commandlets on your PRTG-Machine or do you connect to the Delivery Controller?

Regards, Pilba

Created on Apr 19, 2018 7:00:53 AM



Accepted Answer

Votes:

3

Hi,

First step I store Windows credentials in PRTG - so you can use them as parameters for your script. Using these credentials you can establish a remote Powershell session. Make sure your user account has the necessary rights for remote Powershell. For example local Admin. If you are working with Citrix cmdlets make sure your user has read only rights configured in Citrix Studio.

Sensor Parameters -server '<FQDN>' -domain '%windowsdomain' -username '%windowsuser' -password '%windowspassword'

Powershell Script Read and store the PRTG Sensor Parameters param ( [string]$server, [string]$domain, [string]$username, [string]$password )

With these parameters from PRTG you can store them in a variable $credentials $credentials = New-Object System.Management.Automation.PSCredential (($domain+'\'+$username), (ConvertTo-SecureString $password -AsPlainText -Force))

There are several ways to establishing a remote Powershell session. After some tests i decided to do it with Invoke-Command and run it as a job. It gives us some performance. $job = Invoke-Command -Computername $server -credential $credentials -ScriptBlock { ... } -asjob

Inside the ScriptBlock you can get your Data. The ScriptBlock is running on the remote Server. For example if you want to use Citrix cmdlets you can just add them to your session on a Citrix Controller. add-pssnapin citrix*

Now you can get all your Information like Get-BrokerServiceStatus Worker in maintenance= Get-BrokerMachine | Select -ExpandProperty "InMaintenanceMode" Active Session = (Get-BrokerSession | where {$_.SessionState -eq "Active" }).Count

Some cmdlets like Get-BrokerServiceStatus will give Data in Tform of text. You can substitute these to numbers and translate them back later by a value lookupskript.

Now we have our information and need them to get back to PRTG. In my Opinion its quite comfortable to put them in an Object and return it.

$Data= [PSCustomObject]@{ Data_1 = $Data_1 ... } return $Data

Now outside of the ScriptBlock we wait for the job to complete its work and give us our Data back Wait-Job $job | Out-Null $Data= Receive-Job -Job $job

Now you can create the XML Output for PRTG to display by accessing your Data like $Data.Data_1

Best regards, Phil

Created on Apr 19, 2018 12:05:00 PM



Votes:

0

Hi 19phila19,

Thank you for your extensive answer and contribution! I have set the answer as Best Answer for this thread so it is easier to find.

Best regards.

Created on Apr 19, 2018 1:34:11 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

Hello,

I am trying to add a similar sensor with this script:

Invoke-Command -ComputerName CTXDC2001 -ScriptBlock `

{{{ { Add-PSSnapin Citrix*

$sessies = (Get-BrokerSession -MaxRecordCount 1000 | where {$_.SessionState -eq "Active" }).count

$sessies } }}}

When I execute the scirpt i get a result.

When I add the script to PRTG with a Custom exe I get the following result.

Response not well-formed: "(164 )" (code: PE132) Where 164 is the number of active users.

Where is the script wrong? How do I get PRTG to know the right value without the failure message.

Thanks.

Created on Dec 28, 2018 10:00:48 AM

Last change on Dec 28, 2018 11:46:03 AM by  Isidora Jeremic [Paessler Support]



Votes:

0

Hello Marius,

The output does not contain a PRTG-compatible sensor result.

That would be of the format

value:message

for example:

164:Message

Please change the script so that it produces a format which can be read by PRTG.

Created on Dec 28, 2018 2:23:18 PM by  Isidora Jeremic [Paessler Support]



Votes:

0

Thanks Isidora,

That is my question, how to I change the script that I get a format which PRTG can read.

Where is my script wrong ?

Created on Jan 8, 2019 3:17:14 PM



Votes:

0

Hi Marius,

As Isidora tried to explain, the current output is this:

164

PRTG can't know what this is as it is not in the correct format. For example, this would be the correct format:

164:My sensor message

Here PRTG knows that left of the double-point is the value and right of is the sensor message. Therefore please adapt the script output to the example above. If you don't want to transmit a specific message, then output the result like this:

164:Ok

Best regards.

Created on Jan 8, 2019 3:28:53 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

Hi

Thanks for the information above, I too am trying to monitor

  1. Current sessions (and present that back to PRTG as a number)
  2. Certain status of services, Like the BrokerService status, Be good to present that back to PRTG as "OK" if no errors, or "ERROR" if the service has any issues

I can run the commands manually to get what i need, but i am not sure how to put it together from PRTG, do you have a copy of the sensor, or script i could leverage off?

Do i need to install the Powershell Citrix Modules on the PRTG probe?

Created on Jun 11, 2021 1:10:23 AM

Last change on Jun 11, 2021 6:10:01 AM by  Felix Wiesneth [Paessler Support]



Votes:

0

Hi,

If the powershell script needs the Citrix modules in order to retrieve the data, then you will need to install them on the probe that runs the sensor.
Maybe you can find some good examples for the script in our "PRTG Sensor Hub".


Kind regards,
Sasa Ignjatovic, Tech Support Team

Created on Jun 14, 2021 7:49:11 AM by  Sasa Ignjatovic [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.