Module: check_mk
Branch: master
Commit: 0b0402c7a5cbb8d5586e4ceda1f556cc93fea156
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0b0402c7a5cbb8…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Aug 7 07:41:38 2017 +0200
5089 FIX: citrix_xenapp.ps1: Refactored; now uses powershell commands for Citrix
environment instead of WMI objects which caused runtime errors
Change-Id: I518fae36620681fd6607369c85f478fb6ad3c26d
---
.werks/5089 | 11 +++++++++++
agents/windows/plugins/citrix_xenapp.ps1 | 17 +++++++++--------
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/.werks/5089 b/.werks/5089
new file mode 100644
index 0000000..a272a01
--- /dev/null
+++ b/.werks/5089
@@ -0,0 +1,11 @@
+Title: citrix_xenapp.ps1: Refactored; now uses powershell commands for Citrix environment
instead of WMI objects which caused runtime errors
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1502083451
+
+
diff --git a/agents/windows/plugins/citrix_xenapp.ps1
b/agents/windows/plugins/citrix_xenapp.ps1
index 8084244..f77c2bc 100644
--- a/agents/windows/plugins/citrix_xenapp.ps1
+++ b/agents/windows/plugins/citrix_xenapp.ps1
@@ -1,14 +1,15 @@
-$computer = "localhost"
+Add-PSSnapin Citrix*
### Citrix XenApp Serverload
-$loadObject = Get-WmiObject -Namespace 'Root\Citrix' -class
'MetaFrame_Server_LoadLevel' -ComputerName $computer -ErrorAction Stop
+$load = Get-XAServerLoad -ServerName $env:computername | Select-Object -ExpandProperty
load
"<<<citrix_serverload>>>"
-$loadObject.LoadLevel
-$computer = "localhost"
+$load
### Citrix XenApp Sessions
-$serverObject = Get-WmiObject -Namespace root\citrix -Class Metaframe_Server
-ComputerName $computer
+$disc = (Get-XASession -ServerName $env:computername |Where {$_.State -eq
"Disconnected" }).count
+$activ = (Get-XASession -ServerName $env:computername |Where {$_.State -eq
"Active" }).count
+$all = ($disc + $activ)
"<<<citrix_sessions>>>"
-"sessions {0}" -f $serverObject.NumberOfSessions
-"active_sessions {0}" -f $serverObject.NumberOfActiveSessions
-"inactive_sessions {0}" -f $serverObject.NumberOfDisconnectedSessions
+"sessions {0}" -f $all
+"active_sessions {0}" -f $activ
+"inactive_sessions {0}" -f $disc
\ No newline at end of file