Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutliple Zones within Sites #62

Open
ChrisDJ-TY1 opened this issue Jan 29, 2019 · 4 comments
Open

Mutliple Zones within Sites #62

ChrisDJ-TY1 opened this issue Jan 29, 2019 · 4 comments

Comments

@ChrisDJ-TY1
Copy link

Expected Behavior

If zones are used, only DG's per zone should be enumerated in the Test-XdSessionInfo.ps1 script.

Current Behavior

If zones are used in the Site, the Test-XdSessionInfo.ps1 script is enumerating all desktop delivery groups info multiple times as you use

    $ZoneNames = (Get-ConfigZone -AdminAddress $Broker).Name
            Foreach ($ZoneName in $ZoneNames) {
                    Get-BrokerDesktopGroup -AdminAddress $Broker

This implicates that if I have 5 DG's with 3 zones, I get all info 3 times instead of 1 team per Zone.
currently in our LTSR 7.15 CU1 I don't see a relation yet between zones and delivery gorups eventhough wihtin the console it is visible (see at zones section).
If we can get the same info from within powershell then we can get the DG's per Zone which should be perfect. but now getting it multiple times is worthless.

Possible Solution

Try to find how to accomplish getting DG's per zones. I haven't found it yet.
Or removing the zoning part from the script so that we only enumerate the DG's without zone info.

Steps to Reproduce (for bugs)

  1. Create 2 or more zones and run you script.
  2. User session details will be doubled, trippled, ....

Context

We don't get the correct user sessions details in the grafana dashboard.

Your Environment

XD 7.15 LTSR CU1

Please don't hesitate contacting me by email if needed.

@ChrisDJ-TY1
Copy link
Author

It seems that zones are linked to Machine catalogs
Get-BrokerCatalog -AdminAddress $Broker | select Name, ZoneName

Other issue is that DesktopGroups are not linked to Machine Catalogs, only the Broker Desktops have a reference to the MachineCatalog and DesktopGroupNames.

Get-BrokerDesktop -AdminAddress $Broker | select MachineName, CatalogName, DesktopGroupName

There is no list that contains CatalogName, DesktopGroupName, Zonename.

with the following code we can create this list.

$CatalogNameZones = Get-BrokerCatalog -AdminAddress $Broker | select Name, ZoneName

$CatalogDesktopGroupZones = Get-BrokerDesktop -AdminAddress $Broker | select CatalogName, DesktopGroupName, @{Name = 'ZoneName'; Expression = {($CatalogNameZones -match $_.CatalogName).ZoneName}} | sort ZoneName, CatalogName, DesktopGroupName | Get-Unique -AsString

$CatalogNameZones will give an overview of each Machine Catalog and the corresponding zone it is linked with as can be seen in Citrix Studio in the Zones section.
$CatalogDesktopGroupZones will lookup for each found DesktopGroup within all Broker Desktops, the Machine Catalog Name, matches this against the $CatalogNameZones array finding its ZoneName. And grab only the Unique (Get-Unique) values.

$CatalogDesktopGroupZones will give us then a unique list of all Machine Catalogs, being used in Desktop Groups within the corresponding zone.

For each zone we need to filter the $CatalogDesktopGroupZones containing only the info for the specific zone, therefore we can use the following code
$ZoneDeliveryGroups = $CatalogDesktopGroupZones | ? { $_.ZoneName -eq $ZoneName}

Having all this information, we can change the following in Test-XdSessionInfo.ps1

    $SiteName = (Get-BrokerSite -AdminAddress $Broker).Name
    $ZoneNames = (Get-ConfigZone -AdminAddress $Broker).Name
    
    Foreach ($ZoneName in $ZoneNames) {

        Get-BrokerDesktopGroup -AdminAddress $Broker | ForEach-Object {

as follows

    $SiteName = (Get-BrokerSite -AdminAddress $Broker).Name
    $ZoneNames = (Get-ConfigZone -AdminAddress $Broker).Name

    $CatalogNameZones = Get-BrokerCatalog -AdminAddress $Broker | select Name, ZoneName 
    $CatalogDesktopGroupZones = Get-BrokerDesktop -AdminAddress $Broker | select CatalogName, DesktopGroupName, @{Name = 'ZoneName'; Expression = {($CatalogNameZones -match $_.CatalogName).ZoneName}} | sort ZoneName, CatalogName, DesktopGroupName | Get-Unique -AsString
    Foreach ($ZoneName in $ZoneNames) {
        $ZoneDeliveryGroups = $CatalogDesktopGroupZones | ? { $_.ZoneName -eq $ZoneName} | Select CatalogName, DesktopGroupName, ZoneName

        Get-BrokerDesktopGroup -AdminAddress $Broker | ?{ (($ZoneDeliveryGroups).DesktopGroupName -match $_.Name) } | ForEach-Object {

By doing this we only give the information of each DesktopGroup within each zone and not all Desktop Groups in all Zones.

IMPORTANT REMARK:
My assumption is that delivery groups are not going to use machine catalogs from different zones. Currently I'm not able to test this :(

Happy to discuss this.

@littletoyrobots
Copy link
Collaborator

You're right. We've already addressed that in the newer iteration, but it was definitely an oversight. Will merge back into v2. Also, with CatalogName only fetching from appropriate zones, the Get-BrokerSession calls later on will already be filtered with the zone as well. Thanks for the input! Here's what the current code for v3 looks like..
`
$SiteName = (Get-BrokerSite -AdminAddress $Broker).Name

        $ZoneNames = (Get-ConfigZone -AdminAddress $Broker).Name

        foreach ($ZoneName in $ZoneNames) {

            $CatalogNames = (Get-BrokerCatalog -AdminAddress $Broker -ZoneName $ZoneName).Name
            foreach ($CatalogName in $CatalogNames) {                 
                foreach ($DeliveryGroup in $DeliveryGroups) {
                    $DeliveryGroupName = $DeliveryGroup.Name
                    $DGMaintMode = $DeliveryGroup.InMaintenanceMode
                    $Params = @{
                        AdminAddress     = $Broker;
                        ZoneName         = $ZoneName;
                        CatalogName      = $CatalogName;
                        DesktopGroupName = $DeliveryGroupName;
                        MaxRecordCount   = 99999
                    }
                    $Machines = Get-BrokerMachine @Params

`

@ChrisDJ-TY1
Copy link
Author

Hi,

where is the $DeliveryGroups variable created? Will this be linked to the Catalog Names within the zone?

but this can only be done via the BrokerDesktops as they only have both (Catalog/DesktopGroup) reference.

@littletoyrobots
Copy link
Collaborator

A few lines above them. You can check it out here, which started as a port to make things easier to use with Telegraf, and is now turning into what looks like v3. (Sorry for the sparse commenting, still a work in progress)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants