-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPRTG-CitrixSessionsCount.ps1
68 lines (58 loc) · 2.81 KB
/
PRTG-CitrixSessionsCount.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Citrix - Get Sessions stats for PRTG Monitoring
# Abdellatif Housni 2020
# Monitoring des Sessions Citrix
# pré-requis : Broker_PowerShellSnapIn_x64.msi
#
asnp citrix*
# Adresse du Citrix Delivery Controller
$DeliveryControllerHost = $args[0]
# Scope IP VPN
$IP_VPN = '192.168.*'
# All Sessions
$Citrix_All_Sessions = ((Get-BrokerSession -AdminAddress $DeliveryControllerHost -MaxRecordCount 1200 -Filter { BrokeringUserName -ne $null}) `
| select BrokeringUserName,BrokeringTime,CatalogName,ClientAddress, `
ClientName,ClientPlatform,ClientVersion,ConnectedViaHostName, `
ConnectedViaIP,ControllerDNSName,DNSName,DesktopGroupName, `
EstablishmentDuration,EstablishmentTime,IPAddress,InMaintenanceMode,`
LaunchedViaHostName,LaunchedViaIP,LogoffInProgress,LogonInProgress,`
MachineName,ReceiverIPAddress,ReceiverName,SecureIcaActive,`
SessionKey,SessionState ).count
# VPN Sessions
$Citrix_VPN_Sessions = ((Get-BrokerSession -AdminAddress $DeliveryControllerHost -MaxRecordCount 1200 -Filter { BrokeringUserName -ne $null -and ClientAddress -like $IP_VPN }) `
| select BrokeringUserName,BrokeringTime,CatalogName,ClientAddress, `
ClientName,ClientPlatform,ClientVersion,ConnectedViaHostName, `
ConnectedViaIP,ControllerDNSName,DNSName,DesktopGroupName, `
EstablishmentDuration,EstablishmentTime,IPAddress,InMaintenanceMode,`
LaunchedViaHostName,LaunchedViaIP,LogoffInProgress,LogonInProgress,`
MachineName,ReceiverIPAddress,ReceiverName,SecureIcaActive,`
SessionKey,SessionState ).count
# Non-VPN Sessions
$Citrix_Non_VPN_Sessions = ((Get-BrokerSession -AdminAddress $DeliveryControllerHost -MaxRecordCount 1200 -Filter { BrokeringUserName -ne $null -and ClientAddress -notlike $IP_VPN }) `
| select BrokeringUserName,BrokeringTime,CatalogName,ClientAddress, `
ClientName,ClientPlatform,ClientVersion,ConnectedViaHostName, `
ConnectedViaIP,ControllerDNSName,DNSName,DesktopGroupName, `
EstablishmentDuration,EstablishmentTime,IPAddress,InMaintenanceMode,`
LaunchedViaHostName,LaunchedViaIP,LogoffInProgress,LogonInProgress,`
MachineName,ReceiverIPAddress,ReceiverName,SecureIcaActive,`
SessionKey,SessionState ).count
# Proportion d'utilisateurs VPN
$Citrix_VPN_Sessions_Proportion = [math]::Round((($Citrix_VPN_Sessions/$Citrix_All_Sessions)*100))
"<prtg>"
"<result>"
"<channel>Citrix - Toutes Sessions</channel>"
"<value>$Citrix_All_Sessions</value>"
"</result>"
"<result>"
"<channel>Citrix - Sessions Sur Site</channel>"
"<value>$Citrix_Non_VPN_Sessions</value>"
"</result>"
"<result>"
"<channel>Citrix - Sessions via VPN</channel>"
"<value>$Citrix_VPN_Sessions</value>"
"</result>"
"<result>"
"<channel>Citrix - Sessions via VPN vs Sessions Sur Site</channel>"
"<Unit>Percent</Unit>"
"<value>$Citrix_VPN_Sessions_Proportion</value>"
"</result>"
"</prtg>"