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

How can I set up a monitor for Citrix license use on license server?

Votes:

1

Trying to set up monitor to show real time license use on our Citrix license server. I used a template from PRTGPlugins, but it doesn't list the licenses. Only shows RDP and Ping monitors.

citrix licensebacklun-each prtg

Created on Dec 8, 2011 9:40:28 PM



14 Replies

Accepted Answer

Votes:

0

Hello,

I'm afraid that might only be possible with Custom EXE-Sensors, but of course you could also contact the developer of PRTGPlugins.

best regards.

Created on Dec 9, 2011 9:36:23 AM by  Torsten Lindner [Paessler Support]



Votes:

0

I have a custom WMI sensor setup that was monitoring license use fine, until I renewed my Citrix Licenses and restarted the license server. Now the sensor fails with "Query returned more than one record error: PE078". I have uninstalled the license server and re installed and also deleted and recreated the sensor. Still no luck getting the sensor to work again.

Created on May 22, 2012 6:07:40 PM



Votes:

0

As the sensor mentions, it seems more than one result is returned, and you need to adjust the query as it needs to be only one. You can use the WMI Tester to help with the testing.

Created on May 22, 2012 6:30:12 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Looks like it does indeed return two records, one looks bogus as it lists 0 in the in use count. They both look identical except for the fact one returns 0 in the in use count. Any idea how to get to read only the correct one?

Created on May 22, 2012 6:38:54 PM



Votes:

0

Sorry, no. How would we know that?

Created on May 23, 2012 11:56:15 AM by  Torsten Lindner [Paessler Support]



Votes:

0

Apparently that record is supposed to be there. I see it on all our license servers. So I'm back to the original problem of getting the "Query returned more than one record error: PE078" when running the custom WMI sensor with a WQL statement of "SELECT InUseCount FROM CITRIX_GT_LICENSE_POOL". Is there a way to get it to total the two records and present that to PRTG? I installed the PRTG Plugins, but it didn't have a template for Citrix Licensing. They have zero support and I haven't been able to get in touch with anyone from there to figure out why it doesn't work.

Created on May 23, 2012 8:03:51 PM



Votes:

0

You could try expanding the query with something like

... Where Name ="_Total"

Or if this does not help, do this with a vb-script which calculates the total itself.

Created on May 24, 2012 8:52:14 AM by  Torsten Lindner [Paessler Support]



Votes:

0

Unfortunately with Citrix licensing you need to enumerate them all to get the full license count and usage since all licenses are individually in WMI. This is why we made the plugin.

Created on Aug 24, 2012 7:00:20 PM



Votes:

0

I've been beating this horse on and off for a couple days. Here is my powershell script. No promises. It gets the total licenses, the amount in use, computes a percentage, and returns a value. Just copy and paste it the Powershell ISE on your sensor server and try it. You will need to adjust the server...it's all in the comments.

# Setup Variables
$Total = 0
$InUse = 0
$PercentUsed = 0
$Retstring = 0
$RetValue = 0

# Get Citrix licensing Info
# Use the IP address of the License server(-comp switch).  I got inconsistent results using the hostname
$licensePool = gwmi -class "Citrix_GT_License_Pool" -Namespace "ROOT\CitrixLicensing" -comp 172.16.10.14

# This will display all the license info....Uncomment for troubleshooting
# $licensePool | Select-Object @{n="Product";e={$_.PLD}},
#                            @{n="Installed";e={$_.Count}},
#                            @{n="In Use";e={$_.InUseCount}},
#                            @{n="Available";e={$_.PooledAvailable}},
#                            @{n="% in use";e={($_.InUseCount/$_.Count)*100}}
                            
# This loops through all the license info and adds up the total license count and in use count for MPS_ENT_CCU licenses
# If you do not have MPS_ENT_CCU licenses, uncomment the section above and look at the output.  Figure out your license count from that.  Edit Script as needed                            
$LicensePool | ForEach-Object{ If ($_.PLD -eq "MPS_ENT_CCU"){
    $Total = $Total + $_.count
    $InUse = $InUse + $_.InUseCount
    }
}

#  Uncomment to confirm values are correct    
# "Total = ", $Total
# "In Use = ", $Inuse

$PercentUsed = [Math]::Round($inuse/$total*100,0)

#  Determine return code.  Less than 90%, ok, 90-97 Warning, 98-100 Error
switch ($PercentUsed)
    {
        {$PercentUsed -lt 90} {
            $RetString = "0:OK"	
            $RetVal = 0
            break
            }
        {$PercentUsed -ge 90 -and $PercentUsed -lt 98} {
            $RetString = "1:Warning 90-97% License Usage"	
            $RetVal = 1
            break
            }
        {$PercentUsed -ge 98} {
            $RetString = "2:ALERT 98-100% License Usage"	
            $RetVal = 2
            }
}

# Return Info
Write-Host $RetString
exit $RetVal

Created on Jan 8, 2013 6:46:35 PM

Last change on Jan 9, 2013 10:21:57 AM by  Torsten Lindner [Paessler Support]



Votes:

0

It was requested that we keep track of the actual number of licenses used. I changed the switch statement to return that value instead of 0, 1, or 2. So your graph will now reflect the actual number of licenses used.

switch ($PercentUsed)
    {
        {$PercentUsed -lt 90} {
            $RetString = [string]$Inuse+":OK"	
            $RetVal = 0
            break
            }
        {$PercentUsed -ge 90 -and $PercentUsed -lt 98} {
            $RetString = [string]$Inuse+":Warning 90-97% License Usage"	
            $RetVal = 1
            break
            }
        {$PercentUsed -ge 98} {
            $RetString = [string]$Inuse+":ALERT 98-100% License Usage"	
            $RetVal = 2
            }
}

Created on Jan 9, 2013 9:13:04 PM

Last change on Jan 10, 2013 10:42:58 AM by  Torsten Lindner [Paessler Support]



Votes:

0

hello, i have added your script to my exe folder and added a custom sensor. but it display me 0 # . when i run the powershell script on the prtg server it shows me the correct entry like 100 licenses are active.

can you please help me adding the custom sensor and its settings?

kind regards,

sebastian

Created on Feb 6, 2017 10:54:33 AM



Votes:

0

Gret Job, but i get this error:

PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\Citrix_LIC03.ps1 Get-WmiObject : Zugriff verweigert (Ausnahme von HRESULT: 0x80070005 (E_ACCESSDENIED)) Bei C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\Citrix_LIC03.ps1:16 Zeichen:20 + $licensePool = gwmi <<<< -class "Citrix_GT_License_Pool" -Namespace "ROOT\CitrixLicensing" -comp $server + CategoryInfo : NotSpecified: (:) [Get-WmiObject], UnauthorizedAccessException + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

Es wurde versucht, durch 0 (null) zu teilen. Bei C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\Citrix_LIC03.ps1:37 Zeichen:37 + $PercentUsed = [Math]::Round($inuse/ <<<< $total*100,0) + CategoryInfo : NotSpecified: (:) [], RuntimeException + FullyQualifiedErrorId : RuntimeException

Can you help me?

Created on Jul 18, 2017 9:18:47 AM



Votes:

0

I have made a xml sensor out of this. Additionally I have made the target computer variable via a script parameter (host%)



param([string]$computername = "")

# Setup Variables
$Total = 0
$InUse = 0
$Available = 0
$PercentUsed = 0
$Retstring = 0
$RetValue = 0

# Get Citrix licensing Info
# Use the IP address of the License server(-comp switch).  I got inconsistent results using the hostname
$licensePool = gwmi -class "Citrix_GT_License_Pool" -Namespace "ROOT\CitrixLicensing" -comp $computername

# This will display all the license info....Uncomment for troubleshooting
# $licensePool | Select-Object @{n="Product";e={$_.PLD}},
#                            @{n="Installed";e={$_.Count}},
#                            @{n="In Use";e={$_.InUseCount}},
#                            @{n="Available";e={$_.PooledAvailable}},
#                            @{n="% in use";e={($_.InUseCount/$_.Count)*100}}
                            
# This loops through all the license info and adds up the total license count and in use count for MPS_ENT_CCU licenses
# If you do not have MPS_ENT_CCU licenses, uncomment the section above and look at the output.  Figure out your license count from that.  Edit Script as needed                            
#$LicensePool | ForEach-Object{ If ($_.PLD -eq "MPS_ENT_CCU"){
$LicensePool | ForEach-Object{ If ($_.PLD -eq "XDT_ENT_UD"){
    $Total = $Total + $_.count
    $InUse = $InUse + $_.InUseCount
    $Available = $Available + $_.PooledAvailable
    }
}

#  Uncomment to confirm values are correct    
# "Total = ", $Total
# "In Use = ", $Inuse

$PercentUsed = [Math]::Round($inuse/$total*100,0)


#Write Results
write-host "<prtg>"
 
Write-Host "<result>"
Write-Host "<channel>Total</channel>"
Write-Host "<value>$($Total)</value>"
Write-Host "</result>"
 
Write-Host "<result>"
Write-Host "<channel>In use</channel>"
Write-Host "<value>$($Inuse)</value>"
Write-Host "</result>"

Write-Host "<result>"
Write-Host "<channel>Available</channel>"
Write-Host "<value>$($Available)</value>"
Write-Host "</result>"
 
Write-Host "<result>"
Write-Host "<channel>Use Percentage</channel>"
Write-Host "<value>$($PercentUsed)</value>"
Write-Host "</result>"
 
write-host "</prtg>"

Created on May 5, 2020 7:26:08 AM

Last change on Mar 14, 2023 7:25:22 AM by  Felix Wiesneth [Paessler Support]



Votes:

0

Hi, do you have more Information how to create the xml sensor for this?

kind regards,

sebastian

Created on Mar 13, 2023 10:25:32 AM




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.