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

Getting Lockstep Citrix Sensors to not read 0

Votes:

0

We want to use PRTG to monitor our Citrix environment. Its taken a while, but we seem to have gotten things to work finally with the Lockstep monitor. When adding in a sensor, we get a formatted reply.

Problem is, all the values are 0. I'm having a hard time troubleshooting things at this point. I'll let you know anything you need, but I'm not sure if this is a standard issue? I'm not getting any errors.....

citrix format lockstep

Created on Jul 18, 2014 7:04:11 PM



5 Replies

Votes:

0

Hello,

I'm afraid it's very tricky for us to support custom scripts. Did you check with Lockstep already for this? Do the scripts also show 0-results when you execute them manually?

best regards.

Created on Jul 22, 2014 9:29:02 AM by  Torsten Lindner [Paessler Support]



Votes:

0

I understand that. You all can't troubleshoot everyone's scripts.

However, this script seems to be the ones you all suggest for Citrix monitoring. Also, being as I'm far from an expert in powershell, I was hoping if you could tell me if this is just an issue with the script, or in a PRTG setting?

Below is the script we added to PRTG. When I get it happy, it complains I'm missing '%host' which makes sense as thats the parameter they tell you to add when adding in the sensor. I don't see where to add it in.....

I'm not sure if I'm testing this wrong, but I just add it to powershell ISE and hit the run button. Am I missing something? Like I said, in this area, I'm a bit of a NOOB.

###############################################################################
# 
# prtg citrix xenapp monitor (generic performance)
# mar 4, 2013
# [email protected]
#
###############################################################################
#
# Citrix documentation on this subject
# http://support.citrix.com/article/CTX133540
#
###############################################################################
#
# PRTG configuration:
#   ensure the executing security context has the needed permissions
#    this likely means "Use Windows credentials of parent device"
#   also set "Parameters to "%host" (without the quotes).
#
###############################################################################
# script parameters

Param (
	[Parameter(Position=0)]
	[string]$ComputerName
)

# parameter options to require this don't send enough info back to prtg. do it manual!
# is there a better way to handle this?
if (!($ComputerName)) {
	return @"
<prtg>
  <error>1</error>
  <text>Required parameter not specified: please provide target hostname (or %host)</text>
</prtg>
"@
}

$TimerStart = Get-Date

###############################################################################
# load the prtgshell module

function Import-MyModule {
	Param(
		[string]$Name
	)
	
	if ( -not (Get-Module -Name $Name) ) {
		if ( Get-Module -ListAvailable | Where-Object { $_.Name -eq $Name } ) {
			Import-Module -Name $Name
			$true # module installed + loaded
		} else {
			$false # module not installed
		}
	}
	else {
		$true # module already loaded
	}
}

$ModuleImportSuccess = Import-MyModule PrtgShell

if (!($ModuleImportSuccess)) {
	return @"
<prtg>
  <error>1</error>
  <text>PrtgShell module not loaded: ensure the module is visible for 32-bit PowerShell</text>
</prtg>
"@
}

###############################################################################
# initial wmi connection tests (fail-fast)

function Get-TargetStatus {
	Param (
		[Parameter(mandatory=$True,Position=0)]
		[string]$ComputerName,
		[Parameter(Position=1)]
		[string]$ServiceName = "SamSs"
	)

	$wmi = [WMISearcher]""
	$wmi.options.timeout = '0:0:5' # 5-second timeout
	$wmi.scope.path = "\\$ComputerName\Root\CIMV2"
	$wmi.query = 'Select Status from Win32_Service where Name= "' + $ServiceName + '"'
	
	try {
		$ServiceStatus = ($wmi.Get() | select Status).Status
	} catch {
		if ($_.Exception.InnerException) {
			return "Error: $ComputerName: " + $_.Exception.InnerException.Message
		} else {
			return "Error: $ComputerName: " + $_.Exception.Message
		}
	}
	
	if ($ServiceStatus -eq "OK") {
		return $true
	} else {
		return "Error: $ComputerName: $ServiceName not running."
	}
}

$CheckServer = Get-TargetStatus $ComputerName

if ($CheckServer -ne $true) {
	return @"
<prtg>
  <error>1</error>
  <text>$CheckServer</text>
</prtg>
"@
}

###############################################################################

$ReturnText = "OK" # this is the default

###############################################################################
#### queries from citrix documentation: "Operations Guide - Monitoring.pdf"

# system counters

$wql = "Select PercentProcessorTime from Win32_PerfFormattedData_PerfOS_Processor where name='_total'"
$QueryObject = Get-WmiObject -Query $wql -computername $computername
$SystemPercentProcessorTime = $QueryObject.PercentProcessorTime # warn at 80% for 15 minutes

# this is for the script metrics, not xenapp
$TimerInitialExecution = Get-Date

$wql = "Select ProcessorQueueLength from Win32_PerfFormattedData_PerfOS_System"
$QueryObject = Get-WmiObject -Query $wql -computername $computername
$SystemProcessorQueueLength = $QueryObject.ProcessorQueueLength # warn at 5 (per Core) for 5 minutes

$wql = "Select AvailableBytes,PagesPerSec from Win32_PerfFormattedData_PerfOS_Memory"
$QueryObject = Get-WmiObject -Query $wql -computername $computername
$SystemAvailableBytes = $QueryObject.AvailableBytes # warn at <30% of total RAM
$SystemPagesPerSec = $QueryObject.PagesPerSec # warn at >10

$wql = "Select CurrentUsage from Win32_PageFileUsage"
$QueryObject = @(Get-WmiObject -Query $wql -computername $computername)
$SystemPagefileCurrentUsage = $QueryObject[0].CurrentUsage # warn at >40%

if ($QueryObject.Count -gt 1) {
	$ReturnText = "Multiple Page Files!"
}

$wql = "Select PercentDiskTime,CurrentDiskQueueLength,AvgDisksecPerRead,AvgDisksecPerTransfer,AvgDisksecPerWrite from Win32_PerfFormattedData_PerfDisk_PhysicalDisk where name='_Total'"
$QueryObject = Get-WmiObject -Query $wql -computername $computername
$SystemPercentDiskTime = $QueryObject.PercentDiskTime # warn at >70% consistently
$SystemCurrentDiskQueueLength = $QueryObject.CurrentDiskQueueLength # warn at >=1 (per spindle) consistently
$SystemAvgDisksecPerRead = $QueryObject.AvgDisksecPerRead # warn at >=15ms consistently
$SystemAvgDisksecPerTransfer = $QueryObject.AvgDisksecPerTransfer # warn at >=15ms consistently
$SystemAvgDisksecPerWrite = $QueryObject.AvgDisksecPerWrite # warn at >=15ms consistently


###############################################################################

$TimerStop = Get-Date

$InitialExecutionTime = $TimerInitialExecution - $TimerStart
$ExecutionTime = $TimerStop - $TimerStart

###############################################################################
# output

$XMLOutput = "<prtg>`n"

$XMLOutput += Set-PrtgResult "Sensor Initial WMI Connection Time" $InitialExecutionTime.TotalMilliseconds "ms" -ShowChart
$XMLOutput += Set-PrtgResult "Sensor Total Execution Time" $ExecutionTime.TotalMilliseconds "ms" -ShowChart
$XMLOutput += Set-PrtgResult "Processor Time (Percent)" $SystemPercentProcessorTime "Percent" -ShowChart -MaxWarn 80 -WarnMsg "CPU Usage high"
$XMLOutput += Set-PrtgResult "Processor Queue Length" $SystemProcessorQueueLength "#" -ShowChart
$XMLOutput += Set-PrtgResult "Memory - Available Bytes" $SystemAvailableBytes "BytesMemory" -ShowChart
$XMLOutput += Set-PrtgResult "Memory - Pages/sec" $SystemPagesPerSec "#" -ShowChart -MaxWarn 10 -WarnMsg "Potential memory bottleneck"
$XMLOutput += Set-PrtgResult "Page File Percent Usage" $SystemPagefileCurrentUsage "Percent" -ShowChart
$XMLOutput += Set-PrtgResult "Disk Time (Percent)" $SystemPercentDiskTime "Percent" -ShowChart -MaxWarn 40 -WarnMsg "High Page File usage"
$XMLOutput += Set-PrtgResult "Disk Queue Length (Current)" $SystemCurrentDiskQueueLength "#" -ShowChart -MaxWarn 70 -WarnMsg "High disk queue length"
$XMLOutput += Set-PrtgResult "Disk Average Seconds Per Read" $SystemAvgDisksecPerRead "ms" -ShowChart -MaxWarn 15 -WarnMsg "High Average Disk Seconds Per Read"
$XMLOutput += Set-PrtgResult "Disk Average Seconds Per Transfer" $SystemAvgDisksecPerTransfer "ms" -ShowChart -MaxWarn 15 -WarnMsg "High Average Disk Seconds Per Transfer"
$XMLOutput += Set-PrtgResult "Disk Average Seconds Per Write" $SystemAvgDisksecPerWrite "ms" -ShowChart -MaxWarn 15 -WarnMsg "High Average Disk Seconds Per Write"

$XMLOutput += "  <text>$ReturnText</text>"
$XMLOutput += "</prtg>"

$XMLOutput

Created on Jul 23, 2014 3:00:27 PM

Last change on Jul 24, 2014 8:24:55 AM by  Torsten Lindner [Paessler Support]



Votes:

0

The script of course looks correct, but while we recommend these scripts, we cannot do the troubleshooting or provide support for them. Sorry.

Created on Jul 24, 2014 8:25:51 AM by  Torsten Lindner [Paessler Support]



Votes:

0

I guess this is a fine line to run then. I'm not asking for support on a custom script. I'm asking for help setting up PRTG to run a script that obviously is programmed fine. If the script, of course, looks correct, then isn't it PRTG that isnt' working?

Besides, isn't this a support forum? Can't I ask anyone for help, or is it only Paessler employees responding. Is there a general forum with just general IT folks somewhere?

Created on Jul 24, 2014 11:45:29 AM



Votes:

0

Of coruse other users can jump in and help as well. Please don't understand me wrong. Most likely, the developers of the scripts, encountered the issue already, which may help solve it quicker. We don't have the scripts running here, because we do not have a Citrix Environment. So it's hard for us to support this or give troubleshooting advice.
If the example powershell scripts for PRTG run (those that are installed with PRTG), then it should be an issue "inside" in PRTG, and is probably more in the area of permissions or access to the counters (which the script accesses).

Created on Jul 24, 2014 11:59:32 AM by  Torsten Lindner [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.