Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Citrix Collector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
Citrix Collector
Commits
3030a9f0
Commit
3030a9f0
authored
4 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Add scripts and example config
parent
a7929ccd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Configuration/Config-Example.psd1
+10
-0
10 additions, 0 deletions
Configuration/Config-Example.psd1
New-CitrixMetrics.ps1
+87
-0
87 additions, 0 deletions
New-CitrixMetrics.ps1
citrix_collector.ps1
+8
-0
8 additions, 0 deletions
citrix_collector.ps1
with
105 additions
and
0 deletions
Configuration/Config-Example.psd1
0 → 100644
+
10
−
0
View file @
3030a9f0
@{
CitrixDC
=
"delivercontroller.sitename.xy"
MachineNamePrefix
=
"DOMAINNAME\citrix-vm-"
PrometheusCollectorPrefix
=
"citrix"
PrometheusCollectorDir
=
"C:\ProgramData\windows_exporter\textfile_inputs"
PrometheusCollectorFile
=
"citrix_xendesktop.prom"
StripCatalogPrefix
=
"CITRIX - "
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
New-CitrixMetrics.ps1
0 → 100644
+
87
−
0
View file @
3030a9f0
$Error
ActionPreference
=
"Stop"
$Config
=
Import-PowerShellDataFile
"
$PSScriptRoot
\Configuration\Config.psd1"
Add-PSSnapIn
Citrix.
*
$Pfx
=
$Config
.
PrometheusCollectorPrefix
$MSPrefix
=
"
${Pfx}
_machine_status"
$PfxDuration
=
"
${Pfx}
_collector_duration_ms"
function
Write-Performance
{
param
(
# the collector's name, e.g. "licenses"
[
Parameter
(
Mandatory
=
$True
)]
[
string
]
$Name
,
# the collector's command, e.g. "Get-BrokerSite"
[
Parameter
(
Mandatory
=
$True
)]
[
string
]
$Command
,
# the stopwatch instance used to measure the collector's performance
[
Parameter
(
Mandatory
=
$True
)]
[
Diagnostics.Stopwatch
]
$StopWatch
)
if
(
$StopWatch
.
IsRunning
)
{
$StopWatch
.
Stop
()
}
$Message
=
"
${PfxDuration}
{collector=
`"
$Name
`"
, command=
`"
$Command
`"
} "
$Message
+=
$
(
$StopWatch
.
ElapsedMilliseconds
)
Write-Output
$Message
}
$StopWatch
=
[
Diagnostics.Stopwatch
]::
StartNew
()
$BrokerSite
=
Get-BrokerSite
Write-Performance
-Name
"licenses"
-Command
"Get-BrokerSite"
-StopWatch
$StopWatch
Write-Output
"
${Pfx}
_licenses_sessions_active{}
$(
$BrokerSite
.
LicensedSessionsActive
)
"
Write-Output
"
${Pfx}
_licenses_peak_concurrent_users{}
$(
$BrokerSite
.
PeakConcurrentLicenseUsers
)
"
# Get-BrokerCatalog
# Get-BrokerController
# Get-BrokerDesktopGroup
$StopWatch
=
[
Diagnostics.Stopwatch
]::
StartNew
()
$MachineStatus
=
&
"
$PSScriptRoot
\Get-MachineStatus.ps1"
-Format
rawfull
Write-Performance
-Name
"machine_status"
-Command
"Get-BrokerMachine"
-StopWatch
$StopWatch
foreach
(
$Machine
in
$MachineStatus
)
{
$MachineName
=
$Machine
.
MachineName
.
split
(
"\"
)[
1
]
$Catalog
=
$Machine
.
CatalogName
if
(
$Config
.
StripCatalogPrefix
.
Length
-gt
0
)
{
$Catalog
=
$Catalog
.
Replace
(
$Config
.
StripCatalogPrefix
,
""
)
}
$Status
=
$Machine
.
SummaryState
$Maintenance
=
0
if
(
$Machine
.
InMaintenanceMode
-eq
$True
)
{
$Maintenance
=
1
}
$Username
=
$Machine
.
SessionUserName
if
(
$null
-ne
$Username
)
{
$Username
=
$Username
.
split
(
"\"
)[
1
]
}
$Name
=
$Machine
.
AssociatedUserFullNames
$Email
=
$Machine
.
AssociatedUserUPNs
$Session_Start
=
$Machine
.
SessionStartTime
$Session_Change
=
$Machine
.
SessionStateChangeTime
$Entry
=
"
$MSPrefix
{"
$Entry
+=
"machine_name=
`"
$MachineName
`"
, "
# $Entry += "catalog=`"$Catalog`", "
$Entry
+=
"status=
`"
$Status
`"
, "
$Entry
+=
"maintenance=
`"
$Maintenance
`"
, "
$Entry
+=
"username=
`"
$Username
`"
, "
$Entry
+=
"name=
`"
$Name
`"
, "
$Entry
+=
"email=
`"
$Email
`"
, "
$Entry
+=
"session_start=
`"
$Session_Start
`"
, "
$Entry
+=
"session_change=
`"
$Session_Change
`"
"
$Entry
+=
"} 1"
Write-Output
$Entry
}
This diff is collapsed.
Click to expand it.
citrix_collector.ps1
0 → 100644
+
8
−
0
View file @
3030a9f0
$Config
=
Import-PowerShellDataFile
"
$PSScriptRoot
\Configuration\Config.psd1"
$FileName
=
"
$(
$Config
.
PrometheusCollectorDir
)
\
$(
$Config
.
PrometheusCollectorFile
)
"
while
(
$True
)
{
&
.
\New-CitrixMetrics.ps1
|
Out-File
$FileName
-Encoding
"UTF8"
Start-Sleep
-Seconds
30
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment