I need a sensor for monitoring the concurrent user of our Citrix farm. I a sensor available for monitoring this?


Article Comments

Hello,

I'm afraid there is no dedicated sensor in PRTG for this. But maybe you can use the Custom Script Sensors to do that.

best regards


Sep, 2011 - Permalink

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

Jan, 2013 - Permalink

Hi,

great job, that looks pretty nice.

I made two little improvement to the script:

  • use a parameter for submitting the ip from prtg as parameter '-server <ip-address>', your ip-address is set as default if no parameter is given
  • rewritten the output to use xml-syntax of our Custom Script-advanced-Sensor in which you have 2 values: the percentage itself as well as a calculated state. This way you can follow the history of license-usage.

Unfortunately we don't have a citrix-server to test the script. May you create a new sensor to test it before we publish your solution?

Param( $server="172.16.10.14" )
# Setup Variables

$Total = 0
$InUse = 0
$PercentUsed = 0
$Retstring = 0
$RetValue = 0

$returnStateOK = 0
$returnStateWarning = 1
$returnStateCritical = 2

# Get Citrix licensing Info
# Use the IP address of the License server as parameter -server <ip-address>.  I got inconsistent results using the hostname
$licensePool = gwmi -class "Citrix_GT_License_Pool" -Namespace "ROOT\CitrixLicensing" -comp $server

# 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 state.  Less than 90%, ok, 90-97 Warning, 98-100 Error
switch ($PercentUsed)
    {
        {$PercentUsed -lt 90} {
            $RetString = "OK"    
            $RetState = $returnStateOK
            break
            }
        {$PercentUsed -ge 90 -and $PercentUsed -lt 98} {
            $RetString = "Warning"    
            $RetState = $returnStateWarning
            break
            }
        {$PercentUsed -ge 98} {
            $RetString = "ALERT"    
            $RetState = $returnStateCritical
            }
}

$retXml = "<prtg>`n"
$retXml += "  <result>`n"
$retXml += "    <channel>Value</channel>`n"
$retXml += "    <value>$PercentUsed</value>`n"
$retXml += "    <unit>Percent</unit>`n"
$retXml += "    <limitMaxError>98</limitMaxError>`n"
$retXml += "    <limitErrorMsg>ALERT 98-100% License Usage</limitErrorMsg>`n"
$retXml += "    <limitMaxWarning>90</limitMaxWarning>`n"
$retXml += "    <limitWarningMsg>Warning 90-97% License Usage</limitWarningMsg>`n"
$retXml += "  </result>`n"
$retXml += "  <result>`n"
$retXml += "    <channel>State</channel>`n"
$retXml += "    <value>$RetState</value>`n"
$retXml += "  </result>`n"
$retXml += "  <text>$RetString</text>`n"
$retXml += "</prtg>`n"

# Return Info
write-host $retXml
exit 0

Jan, 2013 - Permalink

Hey, we also need a solution for this. Is it possible to monitor the login and logoff length? I miss some good sensors for XenApp monitoring.


Jan, 2013 - Permalink

I'm not quite sure what you are asking for? Are you looking to gather the amount of time a user is connected? Would you build a sensor for every user than? I'm confused. Sorry.

Can you explain a bit more?


Jan, 2013 - Permalink

Marcel, we've implemented PRTGplugins.com to monitor Citrix login/logoff times. http://www.prtgplugins.com/

We bought it especially for Citrix performance measurement, but there are a lot of others features included in the price.

The implementation didn't went smoothly, so I contacted the developers. Now it's running on 30 locations. If you have questions about the implementation, write a reply. I can post the " shortened but clearer steps " here.


May, 2013 - Permalink

Hello Pieter,

I have recently tried to install prtgplugins on my network, and i'm running into issues as well. would you be able to help me implement it on my network? I would appreciate it. Thank you


Jul, 2013 - Permalink

Hello,

this might be an interesting blog post to follow if you want to monitor your citrix environment:

How can I monitor Citrix environments?


Jul, 2013 - Permalink

William, today I'm not available. Send me a email with your contact information. My email can be found on my LinkedIn profile. http://bit.ly/preitsma


Jul, 2013 - Permalink