New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Citrix XenApp 7.x Monitoring

Votes:

0

Your Vote:

Up

Down

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 by  Pilba (0) 1



Best Answer

Accepted Answer

Votes:

3

Your Vote:

Up

Down

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 by  Philipp (222) 1 1



9 Replies

Votes:

2

Your Vote:

Up

Down

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 by  Philipp (222) 1 1

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



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  Pilba (0) 1



Accepted Answer

Votes:

3

Your Vote:

Up

Down

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 by  Philipp (222) 1 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  Marius (0)

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



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  Marius (0)



Votes:

0

Your Vote:

Up

Down

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]



Please log in or register to enter your reply.


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.