Refactor Citrix virtual session data collection

This commit is contained in:
Drechsler, Meik
2026-07-22 11:57:15 +02:00
parent 02fabc91cf
commit 2770ebbb6d
12 changed files with 651 additions and 759 deletions

View File

@@ -1338,6 +1338,79 @@
</Table>
</DataCluster>
<DataCluster Name="citrixMetrics" Origin="Citrix" InformationClass="VirtualSession">
<Table Name="citrix-session-details" Type="Static" Key="Id">
<Table-Columns>
<!-- basic session properties -->
<Table-Column Name="Id" SourceName ="SessionKey" Type="guid" />
<Table-Column Name="StartDate" Type="datetime" />
<Table-Column Name="EndDate" Type="datetime" />
<Table-Column Name="LogOnDuration" Type="int" />
<Table-Column Name="ConnectionState" Type="int" Cardinal="64" />
<Table-Column Name="EndpointName" Type="string" Cardinal="64" />
<Table-Column Name="IsAnonymous" Type="boolean" />
<!-- machine properties -->
<Table-Column Name="Mch_Id" SourceName="Machine.Id" Type="guid" />
<Table-Column Name="Mch_Name" SourceName="Machine.Name" Type="string"/>
<Table-Column Name="Mch_DnsName" SourceName="Machine.DnsName" Type="string" />
<Table-Column Name="Mch_IPAddress" SourceName="Machine.IPAddress" Type="string" />
<Table-Column Name="Mch_HostedMachine" SourceName="Machine.HostedMachineId" Type="string" />
<Table-Column Name="Mch_IsInMaintenanceMode" SourceName="Machine.IsInMaintenanceMode" Type="boolean" />
<Table-Column Name="Mch_AgentVersion" SourceName="Machine.AgentVersion" Type="string" />
<Table-Column Name="Mch_CurrentRegistrationState" SourceName="Machine.CurrentRegistrationState" Type="int" Default="0" />
<Table-Column Name="Mch_CurrentSessionCount" SourceName="Machine.CurrentSessionCount" Type="int" />
<Table-Column Name="Mch_WindowsConnectionSetting" SourceName="Machine.WindowsConnectionSetting" Type="int" Default="0" />
<Table-Column Name="Mch_OSType" SourceName="Machine.OSType" Type="string" />
<Table-Column Name="Ctl_Name" SourceName="Machine.Catalog.Name" Type="string" Default="0" />
<Table-Column Name="Ctl_AllocationType" SourceName="Machine.Catalog.AllocationType" Type="int" Default="0" />
<Table-Column Name="DGrp_Name" SourceName="Machine.DesktopGroup.Name" Type="string" />
<Table-Column Name="CLI_Cpu" SourceName="Machine.CurrentLoadIndex.Cpu" Type="int" Default="0" />
<Table-Column Name="CLI_Memory" SourceName="Machine.CurrentLoadIndex.Memory" Type="int" Default="0" />
<Table-Column Name="CLI_Disk" SourceName="Machine.CurrentLoadIndex.Disk" Type="int" Default="0" />
<!-- user properties -->
<Table-Column Name="Usr_Id" SourceName="User.Id" Type="int" />
<Table-Column Name="Usr_Name" SourceName="User.UserName" Type="string"/>
<Table-Column Name="Usr_FullName" SourceName="User.FullName" Type="string"/>
<Table-Column Name="Usr_Domain" SourceName="User.Domain" Type="string"/>
<!-- connection properties -->
<Table-Column Name="Con_Id" SourceName="CurrentConnection.Id" Type="guid" />
<Table-Column Name="Con_ClientName" SourceName="CurrentConnection.ClientName" Type="string" />
<Table-Column Name="Con_ClientAddress" SourceName="CurrentConnection.ClientAddress" Type="string" />
<Table-Column Name="Con_ClientVersion" SourceName="CurrentConnection.ClientVersion" Type="string" />
<Table-Column Name="Con_ClientPlatform" SourceName="CurrentConnection.ClientPlatform" Type="string" />
<Table-Column Name="Con_ConnectedViaIPAddress" SourceName="CurrentConnection.ConnectedViaIPAddress" Type="string" />
<Table-Column Name="Con_LaunchedViaHostName" SourceName="CurrentConnection.LaunchedViaHostName" Type="string" />
<Table-Column Name="Con_LogOnStartDate" SourceName="CurrentConnection.LogOnStartDate" Type="datetime" />
<Table-Column Name="Con_LogOnEndDate" SourceName="CurrentConnection.LogOnEndDate" Type="datetime" />
<Table-Column Name="Con_BrokeringDuration" SourceName="CurrentConnection.BrokeringDuration" Type="int" />
<Table-Column Name="Con_VMStartStartDate" SourceName="CurrentConnection.VMStartStartDate" Type="datetime" />
<Table-Column Name="Con_VMStartEndDate" SourceName="CurrentConnection.VMStartEndDate" Type="datetime" />
<Table-Column Name="Con_HdxStartDate" SourceName="CurrentConnection.HdxStartDate" Type="datetime" />
<Table-Column Name="Con_HdxEndDate" SourceName="CurrentConnection.HdxEndDate" Type="datetime" />
<Table-Column Name="Con_AuthenticationDuration" SourceName="CurrentConnection.AuthenticationDuration" Type="int" />
<Table-Column Name="Con_GpoStartDate" SourceName="CurrentConnection.GpoStartDate" Type="datetime" />
<Table-Column Name="Con_GpoEndDate" SourceName="CurrentConnection.GpoEndDate" Type="datetime" />
<Table-Column Name="Con_LogOnScriptsStartDate" SourceName="CurrentConnection.LogOnScriptsStartDate" Type="datetime" />
<Table-Column Name="Con_LogOnScriptsEndDate" SourceName="CurrentConnection.LogOnScriptsEndDate" Type="datetime" />
<Table-Column Name="Con_ProfileLoadStartDate" SourceName="CurrentConnection.ProfileLoadStartDate" Type="datetime" />
<Table-Column Name="Con_ProfileLoadEndDate" SourceName="CurrentConnection.ProfileLoadEndDate" Type="datetime" />
<Table-Column Name="Con_InteractiveStartDate" SourceName="CurrentConnection.InteractiveStartDate" Type="datetime" />
<Table-Column Name="Con_InteractiveEndDate" SourceName="CurrentConnection.InteractiveEndDate" Type="datetime" />
<Table-Column Name="Con_UserInitStartDate" SourceName="CurrentConnection.UserInitStartDate" Type="datetime" />
<Table-Column Name="Con_UserInitEndDate" SourceName="CurrentConnection.UserInitEndDate" Type="datetime" />
<Table-Column Name="Con_AppxAssociationStartDate" SourceName="CurrentConnection.AppxAssociationStartDate" Type="datetime" />
<Table-Column Name="Con_AppxAssociationEndDate" SourceName="CurrentConnection.AppxAssociationEndDate" Type="datetime" />
<Table-Column Name="Con_AppxLoadPackageStartDate" SourceName="CurrentConnection.AppxLoadPackageStartDate" Type="datetime" />
<Table-Column Name="Con_AppxLoadPackageEndDate" SourceName="CurrentConnection.AppxLoadPackageEndDate" Type="datetime" />
<!-- additional site infos from configuration-->
<Table-Column Name="SiteId" Type="guid" />
<Table-Column Name="SiteName" Type="guid" />
</Table-Columns>
</Table>
<Table Name="citrix-session" Type="Static" Key="Id">
<Table-Columns>
<Table-Column Name="Id" SourceName ="SessionKey" Type="guid" />

View File

@@ -1530,7 +1530,7 @@
<State-Info Name="User Info" ValueTable="Computation_EmptyConstant" ValueColumn="default">
<Name Lang="DE">Benutzer-Informationen</Name>
</State-Info>
<State-Info Name="User Name" ValueTable="citrix-session-user" ValueColumn="UserName">
<State-Info Name="User Name" ValueTable="citrix-session-details" ValueColumn="Usr_Name">
<Name Lang="DE">Benutzername</Name>
</State-Info>
<State-Info Name="Fullname" ValueTable="citrix-session-user" ValueColumn="FullName">

View File

@@ -680,49 +680,49 @@
SELECT @cnt
</Query>
<Query Name="UpdateDbTablesV1.9">
DECLARE @cnt INT
SET @cnt = 0
<Query Name="UpdateDbTablesV1.9">
DECLARE @cnt INT
SET @cnt = 0
IF EXISTS(SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N&apos;[main-user]&apos;) AND type in (N&apos;U&apos;))
AND NOT EXISTS (SELECT * FROM Information_Schema.Columns WHERE Table_Name = &apos;main-user&apos; AND Column_Name = &apos;id_citrix&apos;)
BEGIN
PRINT N&apos;Start adding column [id_citrix] to table [main-user] ...&apos;;
ALTER Table [main-user] ADD [id_citrix] int NULL;
SET @cnt = @cnt + 1;
PRINT N&apos;... done.&apos;
END
IF EXISTS(SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N&apos;[main-user]&apos;) AND type in (N&apos;U&apos;))
AND NOT EXISTS (SELECT * FROM Information_Schema.Columns WHERE Table_Name = &apos;main-user&apos; AND Column_Name = &apos;id_citrix&apos;)
BEGIN
PRINT N&apos;Start adding column [id_citrix] to table [main-user] ...&apos;;
ALTER Table [main-user] ADD [id_citrix] int NULL;
SET @cnt = @cnt + 1;
PRINT N&apos;... done.&apos;
END
IF EXISTS(SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N&apos;[main-user]&apos;) AND type in (N&apos;U&apos;))
AND NOT EXISTS (SELECT * FROM Information_Schema.Columns WHERE Table_Name = &apos;main-user&apos; AND Column_Name = &apos;tenant_citrix&apos;)
BEGIN
PRINT N&apos;Start adding column [tenant_citrix] to table [main-user] ...&apos;;
ALTER Table [main-user] ADD [tenant_citrix] nvarchar(100) NULL;
SET @cnt = @cnt + 1;
PRINT N&apos;... done.&apos;
END
IF EXISTS(SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N&apos;[main-user]&apos;) AND type in (N&apos;U&apos;))
AND NOT EXISTS (SELECT * FROM Information_Schema.Columns WHERE Table_Name = &apos;main-user&apos; AND Column_Name = &apos;tenant_citrix&apos;)
BEGIN
PRINT N&apos;Start adding column [tenant_citrix] to table [main-user] ...&apos;;
ALTER Table [main-user] ADD [tenant_citrix] nvarchar(100) NULL;
SET @cnt = @cnt + 1;
PRINT N&apos;... done.&apos;
END
IF EXISTS(SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N&apos;[QActions]&apos;) AND type in (N&apos;U&apos;))
AND NOT EXISTS (SELECT * FROM Information_Schema.Columns WHERE Table_Name = &apos;QActions&apos; AND Column_Name = &apos;TimeStamp&apos;)
BEGIN
PRINT N&apos;Start adding column [TimeStamp] to table [QActions] ...&apos;;
ALTER Table [QActions] ADD [TimeStamp] Datetime NULL;
SET @cnt = @cnt + 1;
PRINT N&apos;... done.&apos;
END
IF EXISTS(SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N&apos;[QActions]&apos;) AND type in (N&apos;U&apos;))
AND NOT EXISTS (SELECT * FROM Information_Schema.Columns WHERE Table_Name = &apos;QActions&apos; AND Column_Name = &apos;TimeStamp&apos;)
BEGIN
PRINT N&apos;Start adding column [TimeStamp] to table [QActions] ...&apos;;
ALTER Table [QActions] ADD [TimeStamp] Datetime NULL;
SET @cnt = @cnt + 1;
PRINT N&apos;... done.&apos;
END
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = &apos;IX_main-user_upn_external&apos;)
BEGIN
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = &apos;IX_main-user_upn_external&apos;)
BEGIN
CREATE NONCLUSTERED INDEX [IX_main-user_upn_external] ON [main-user] ([upn_external] ASC);
CREATE NONCLUSTERED INDEX [IX_main-user_upn_external] ON [main-user] ([upn_external] ASC);
SET @cnt = @cnt+1;
PRINT N&apos;... done.&apos;
SET @cnt = @cnt+1;
PRINT N&apos;... done.&apos;
END
END
SELECT @cnt
</Query>
SELECT @cnt
</Query>
<!--<Query Name="UpdateDbTablesV1.10"/> used in the past and removed-->
<Query Name="UpdateDbTablesV1.11">
DECLARE @cnt INT
@@ -943,12 +943,12 @@
</Query>
<Query Name="UpdateComputerAzure">
UPDATE [main-computer] SET [id_azure]=@id, [deviceid_azure]=@deviceid, tenant_azure = @tenant WHERE [sid_bin]=@sid_bin
</Query>
</Query>
<Query Name="UpdateComputerIntune">
UPDATE [main-computer] SET [id_intune]=@id WHERE [deviceId_azure]=@deviceId
</Query>
<Query Name="UpdateComputerIntune2">
UPDATE [main-computer] SET [id_intune]=@id, [deviceid_azure]=@deviceid, tenant_azure = @tenant WHERE upn_internal = @upn_internal and [domainNB] is null
<Query Name="UpdateComputerIntune2">
UPDATE [main-computer] SET [id_intune]=@id, [deviceid_azure]=@deviceid, tenant_azure = @tenant WHERE upn_internal = @upn_internal and [domainNB] is null
</Query>
<Query Name="GetUserBySidOrUpn">
DECLARE @ID UNIQUEIDENTIFIER
@@ -967,8 +967,8 @@
<Query Name="UpdateUserCitrix">
UPDATE [main-user] SET [id_citrix]=@id WHERE [sid_bin]=@sid_bin
</Query>
<Query Name="UpdateUserCitrix2">
UPDATE [main-user] SET [id_citrix]=@id WHERE upn_internal = @upn_internal AND [id_citrix] is null
<Query Name="UpdateUserCitrix2">
UPDATE [main-user] SET [id_citrix]=@id WHERE upn_internal = @upn_internal AND [id_citrix] is null
</Query>
<Query Name="UpdateMainUserAgent">
UPDATE [main-user] SET [id_agent]=@id_agent WHERE [sid_bin]=@sid_bin AND ([id_agent] is null OR [id_agent] != @id_agent)
@@ -1011,11 +1011,11 @@
SELECT [id] FROM [main-user] WHERE [account] like @account AND ([domainNB] like @domain OR [domainDns] like @domain)
</Query>
<Query Name="GetConnectorIdsFromComputerId">
SELECT [sid_bin], [id_agent], [Name], [last_seen_by_agent], NULL , [tenant_azure],[id_intune], [deviceId_azure],null,null FROM [main-computer] WHERE id = @id
</Query>
SELECT [sid_bin], [id_agent], [Name], [last_seen_by_agent], NULL , [tenant_azure],[id_intune], [deviceId_azure],null,null FROM [main-computer] WHERE id = @id
</Query>
<Query Name="GetConnectorIdsFromUserId">
SELECT [sid_bin], [id_agent], [account], [last_seen_by_agent], [id_agent_azure], [tenant_azure], [id_azure],null,[id_citrix],[tenant_citrix] FROM [main-user] WHERE id = @id
</Query>
SELECT [sid_bin], [id_agent], [account], [last_seen_by_agent], [id_agent_azure], [tenant_azure], [id_azure],null,[id_citrix],[tenant_citrix] FROM [main-user] WHERE id = @id
</Query>
<Query Name="GetUserInfoFromAgentId">
SELECT [id], [full_name], [is_active], [account], COALESCE([domainDns], [domainNB] ), CASE WHEN [id_agent] &lt;&gt; @id THEN 1 ELSE 0 END FROM [main-user] WHERE [id_agent] = @id OR [id_agent_azure] = @id
</Query>
@@ -1675,22 +1675,22 @@
PRINT N&apos; ...done.&apos;;
END
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N&apos;[Tickets]&apos;) AND type in (N&apos;U&apos;))
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N&apos;[Tickets]&apos;) AND type in (N&apos;U&apos;))
BEGIN
PRINT N&apos;start creating table [Tickets]...&apos;;
CREATE TABLE [Tickets](
[TicketId] [uniqueidentifier] NOT NULL,
[Status] [nvarchar](16) NOT NULL,
[Start] [datetime] NULL,
[Finish] [datetime] NULL,
[ActiveTime] [int] NULL,
[UserId] [uniqueidentifier] NOT NULL,
[CaseId] [uniqueidentifier] NOT NULL
)
CREATE TABLE [Tickets](
[TicketId] [uniqueidentifier] NOT NULL,
[Status] [nvarchar](16) NOT NULL,
[Start] [datetime] NULL,
[Finish] [datetime] NULL,
[ActiveTime] [int] NULL,
[UserId] [uniqueidentifier] NOT NULL,
[CaseId] [uniqueidentifier] NOT NULL
)
PRINT N&apos; ...done.&apos;;
PRINT N&apos; ...done.&apos;;
END
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N&apos;[QActions]&apos;) AND type in (N&apos;U&apos;))
@@ -1831,20 +1831,20 @@
CREATE NONCLUSTERED INDEX [IX_UserSession_SessionId] ON [UserSessions]
([SessionId] ASC) INCLUDE([UserId]) WITH (DROP_EXISTING = OFF) ON [PRIMARY];
CREATE NONCLUSTERED INDEX [IX_Cases_CaseId] ON [Cases]
([CaseId] ASC) INCLUDE(SessionId) WITH (DROP_EXISTING = OFF) ON [PRIMARY];
CREATE NONCLUSTERED INDEX [IX_CaseTime_CaseId] ON [CaseTime]
([CaseId] ASC) INCLUDE(StatusId) WITH (DROP_EXISTING = OFF) ON [PRIMARY];
CREATE NONCLUSTERED INDEX [IX_QActionExecutions_ExecutionId_CaseId] ON [QActionExecutions]
([ExecutionId],[CaseId] ASC) WITH (DROP_EXISTING = OFF) ON [PRIMARY];
CREATE NONCLUSTERED INDEX [IX_Tickets_TicketId_CaseId] ON [dbo].[Cases]
([TicketId] ASC, [CaseId] ASC) WITH (DROP_EXISTING = OFF) ON [PRIMARY];
END
</Query>
<Query Name="Update_F4SDAnalyticsMainTables">
@@ -1886,8 +1886,8 @@
SET @cnt = @cnt+1;
PRINT N&apos;... done.&apos;
END
END
IF EXISTS (SELECT 1 FROM sys.objects WHERE name = &apos;FK_Cases_SessionId&apos; AND type=&apos;F&apos;)
BEGIN
ALTER TABLE Cases DROP CONSTRAINT FK_Cases_SessionId
@@ -2460,67 +2460,67 @@
</Query>
<Query Name="CloseUserSession">
IF EXISTS (SELECT TOP 1 * FROM UserSessions WHERE SessionId = @SessionId)
BEGIN
UPDATE [UserSessions]
SET [Finish] = @SessionDate
WHERE SessionId = @SessionId;
END
IF NOT EXISTS (SELECT TOP 1 * FROM UserSessions WHERE SessionId = @SessionId) AND EXISTS (SELECT TOP 1 * FROM dbo.Cases WHERE SessionId = @SessionId)
BEGIN
DECLARE @CurrentTimeStamp DATETIME = GETUTCDATE();
INSERT INTO UserSessions
( UserId, SessionId, [Start], [Finish] )
SELECT TOP 1 UserId,SessionId,[Start],@CurrentTimeStamp FROM Cases
WHERE SessionId = @SessionId ORDER BY [Start] ASC;
END
IF EXISTS (SELECT TOP 1 * FROM UserSessions WHERE SessionId = @SessionId)
BEGIN
UPDATE [UserSessions]
SET [Finish] = @SessionDate
WHERE SessionId = @SessionId;
END
IF EXISTS (SELECT TOP 1 * FROM dbo.Cases WHERE SessionId = @SessionId)
BEGIN
INSERT INTO [CaseTime]
( CaseId, StatusId, [TimeStamp] )
SELECT CaseId, 4, @SessionDate
FROM dbo.Cases
WHERE SessionId = @SessionId AND Finish IS NULL;
IF NOT EXISTS (SELECT TOP 1 * FROM UserSessions WHERE SessionId = @SessionId) AND EXISTS (SELECT TOP 1 * FROM dbo.Cases WHERE SessionId = @SessionId)
BEGIN
DECLARE @CurrentTimeStamp DATETIME = GETUTCDATE();
INSERT INTO UserSessions
( UserId, SessionId, [Start], [Finish] )
SELECT TOP 1 UserId,SessionId,[Start],@CurrentTimeStamp FROM Cases
WHERE SessionId = @SessionId ORDER BY [Start] ASC;
END
UPDATE [Cases]
SET [Finish] = @SessionDate
WHERE SessionId = @SessionId AND Finish IS NULL;
END
IF EXISTS (SELECT TOP 1 * FROM dbo.Cases WHERE SessionId = @SessionId)
BEGIN
INSERT INTO [CaseTime]
( CaseId, StatusId, [TimeStamp] )
SELECT CaseId, 4, @SessionDate
FROM dbo.Cases
WHERE SessionId = @SessionId AND Finish IS NULL;
</Query>
UPDATE [Cases]
SET [Finish] = @SessionDate
WHERE SessionId = @SessionId AND Finish IS NULL;
END
</Query>
<Query Name="UpdateCases">
DECLARE @CurrentTimeStamp DATETIME = GETUTCDATE();
IF EXISTS (SELECT TOP 1 * FROM dbo.Cases JOIN dbo.CaseTime ON Cases.CaseId = CaseTime.CaseId WHERE Cases.CaseId = @CaseId AND CaseTime.StatusId = 4 )
BEGIN
UPDATE [CaseTime]
SET Statusid = 2
FROM dbo.Cases
JOIN dbo.CaseTime ON Cases.CaseId = CaseTime.CaseId
WHERE Cases.CaseId = @CaseId AND
CaseTime.StatusId = 4
UPDATE [CaseTime]
SET Statusid = 2
FROM dbo.Cases
JOIN dbo.CaseTime ON Cases.CaseId = CaseTime.CaseId
WHERE Cases.CaseId = @CaseId AND
CaseTime.StatusId = 4
INSERT INTO [CaseTime]
( CaseId, StatusId, [TimeStamp] )
SELECT @CaseId, 3, @CurrentTimeStamp;
INSERT INTO [CaseTime]
( CaseId, StatusId, [TimeStamp] )
SELECT @CaseId, 3, @CurrentTimeStamp;
UPDATE [Cases]
SET [Finish] = NULL
WHERE CaseId = @CaseId;
UPDATE [Cases]
SET [Finish] = NULL
WHERE CaseId = @CaseId;
END
</Query>
</Query>
<Query Name="InsertTicket">
IF NOT EXISTS (SELECT [TicketId], [UserId],[CaseId],[Status],[Start], [Finish],ActiveTime FROM [Tickets]
WHERE [TicketId] = @TicketId AND [UserId] = @UserId AND [CaseId] = @CaseId AND [Status] = @Status AND [Start] = @Start AND [Finish] = @Finish AND ActiveTime = @ActiveTime )
BEGIN
INSERT INTO [Tickets]
([TicketId], [UserId],[CaseId],[Status],[Start], [Finish],ActiveTime)
SELECT @TicketId,@UserId,@CaseId,@Status,@Start,@Finish,@ActiveTime;
END
</Query>
IF NOT EXISTS (SELECT [TicketId], [UserId],[CaseId],[Status],[Start], [Finish],ActiveTime FROM [Tickets]
WHERE [TicketId] = @TicketId AND [UserId] = @UserId AND [CaseId] = @CaseId AND [Status] = @Status AND [Start] = @Start AND [Finish] = @Finish AND ActiveTime = @ActiveTime )
BEGIN
INSERT INTO [Tickets]
([TicketId], [UserId],[CaseId],[Status],[Start], [Finish],ActiveTime)
SELECT @TicketId,@UserId,@CaseId,@Status,@Start,@Finish,@ActiveTime;
END
</Query>
<Query Name="AnalyticsReportQuickActionExecution">
INSERT INTO [QActionExecutions]

View File

@@ -44,24 +44,6 @@ namespace C4IT_DataHistoryProvider_Test
ctrlProtocolBox1.ProcessMessage($"Validating Citrix connections finished.");
return;
foreach (var _system in systems)
{
if (!(_system is cDataHistoryCitrixCloudTenant Tenant))
continue;
var result = await Program.Collector.CitrixCollector.GetCitrixCommunicationForSystemAsync(Tenant.TenantID, false);
if (result != null)
{
ctrlProtocolBox1.ProcessMessage($"Citrix connection for tenant {Tenant.TenantID} successful");
}
else
{
ctrlProtocolBox1.ProcessMessage($"Citrix connection for tenant {Tenant.TenantID} failed");
}
}
}
catch (Exception E)
{
@@ -91,26 +73,6 @@ namespace C4IT_DataHistoryProvider_Test
Program.Collector.ProcessUiMessage += ctrlProtocolBox1.ProcessMessage;
var _requestInfo = new cF4sdWebRequestInfo("btnConnectCitrix_Click", null);
var systems = Program.Collector.InfrastructureConfig.Citrix.Systems;
foreach (var _system in systems)
{
if (!(_system is cDataHistoryCitrixCloudTenant Tenant))
continue;
var result = await Program.Collector.CitrixCollector.GetCitrixUsersAsync();
if (result)
{
ctrlProtocolBox1.ProcessMessage($"Citrix connection for tenant {Tenant.TenantID} successful");
}
else
{
ctrlProtocolBox1.ProcessMessage($"Citrix connection for tenant {Tenant.TenantID} failed");
}
}
}
catch (Exception E)
{
@@ -139,26 +101,6 @@ namespace C4IT_DataHistoryProvider_Test
Program.Collector.CleanupUiMessageHandler();
Program.Collector.ProcessUiMessage += ctrlProtocolBox1.ProcessMessage;
var _requestInfo = new cF4sdWebRequestInfo("btnGetSessions_Click", null);
var systems = Program.Collector.InfrastructureConfig.Citrix.Systems;
foreach (var _system in systems)
{
if (!(_system is cDataHistoryCitrixCloudTenant Tenant))
continue;
var result = await Program.Collector.CitrixCollector.GetCitrixSessionsAsync();
if (result)
{
ctrlProtocolBox1.ProcessMessage($"Citrix connection for tenant {Tenant.TenantID} successful");
}
else
{
ctrlProtocolBox1.ProcessMessage($"Citrix connection for tenant {Tenant.TenantID} failed");
}
}
}
catch (Exception E)
{

View File

@@ -42,13 +42,15 @@ namespace C4IT_DataHistoryProvider_Test
this.label4 = new System.Windows.Forms.Label();
this.buttonClear = new System.Windows.Forms.Button();
this.checkBoxFiltered = new System.Windows.Forms.CheckBox();
this.comboBoxSessions = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.ctrlProtocolBox1 = new C4IT_DataHistoryProvider_Test.ctrlProtocolBox();
this.SuspendLayout();
//
// buttonGetUserComputerActivities
//
this.buttonGetUserComputerActivities.Location = new System.Drawing.Point(554, 17);
this.buttonGetUserComputerActivities.Margin = new System.Windows.Forms.Padding(2);
this.buttonGetUserComputerActivities.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.buttonGetUserComputerActivities.Name = "buttonGetUserComputerActivities";
this.buttonGetUserComputerActivities.Size = new System.Drawing.Size(164, 32);
this.buttonGetUserComputerActivities.TabIndex = 1;
@@ -97,7 +99,7 @@ namespace C4IT_DataHistoryProvider_Test
// buttonComputerUserActivities
//
this.buttonComputerUserActivities.Location = new System.Drawing.Point(554, 65);
this.buttonComputerUserActivities.Margin = new System.Windows.Forms.Padding(2);
this.buttonComputerUserActivities.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.buttonComputerUserActivities.Name = "buttonComputerUserActivities";
this.buttonComputerUserActivities.Size = new System.Drawing.Size(164, 32);
this.buttonComputerUserActivities.TabIndex = 5;
@@ -129,7 +131,7 @@ namespace C4IT_DataHistoryProvider_Test
//
this.buttonGetRawValues.Enabled = false;
this.buttonGetRawValues.Location = new System.Drawing.Point(554, 118);
this.buttonGetRawValues.Margin = new System.Windows.Forms.Padding(2);
this.buttonGetRawValues.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.buttonGetRawValues.Name = "buttonGetRawValues";
this.buttonGetRawValues.Size = new System.Drawing.Size(164, 32);
this.buttonGetRawValues.TabIndex = 9;
@@ -150,7 +152,7 @@ namespace C4IT_DataHistoryProvider_Test
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(760, 22);
this.label4.Location = new System.Drawing.Point(768, 22);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(63, 20);
this.label4.TabIndex = 12;
@@ -172,28 +174,50 @@ namespace C4IT_DataHistoryProvider_Test
this.checkBoxFiltered.AutoSize = true;
this.checkBoxFiltered.Checked = true;
this.checkBoxFiltered.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxFiltered.Location = new System.Drawing.Point(840, 67);
this.checkBoxFiltered.Location = new System.Drawing.Point(840, 68);
this.checkBoxFiltered.Name = "checkBoxFiltered";
this.checkBoxFiltered.Size = new System.Drawing.Size(175, 24);
this.checkBoxFiltered.Size = new System.Drawing.Size(182, 24);
this.checkBoxFiltered.TabIndex = 15;
this.checkBoxFiltered.Text = "Only with current use";
this.checkBoxFiltered.UseVisualStyleBackColor = true;
this.checkBoxFiltered.CheckedChanged += new System.EventHandler(this.checkBoxFiltered_CheckedChanged);
//
// comboBoxSessions
//
this.comboBoxSessions.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSessions.FormattingEnabled = true;
this.comboBoxSessions.Location = new System.Drawing.Point(1191, 18);
this.comboBoxSessions.Name = "comboBoxSessions";
this.comboBoxSessions.Size = new System.Drawing.Size(328, 28);
this.comboBoxSessions.TabIndex = 18;
this.comboBoxSessions.SelectedValueChanged += new System.EventHandler(this.comboBoxSessions_SelectedValueChanged);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(1090, 23);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(97, 20);
this.label5.TabIndex = 17;
this.label5.Text = "V. Sessions:";
//
// ctrlProtocolBox1
//
this.ctrlProtocolBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ctrlProtocolBox1.Location = new System.Drawing.Point(9, 169);
this.ctrlProtocolBox1.Margin = new System.Windows.Forms.Padding(2);
this.ctrlProtocolBox1.Name = "ctrlProtocolBox1";
this.ctrlProtocolBox1.Size = new System.Drawing.Size(1068, 79);
this.ctrlProtocolBox1.Size = new System.Drawing.Size(1510, 78);
this.ctrlProtocolBox1.TabIndex = 16;
//
// ctrlTestFunctions
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.comboBoxSessions);
this.Controls.Add(this.label5);
this.Controls.Add(this.checkBoxFiltered);
this.Controls.Add(this.buttonClear);
this.Controls.Add(this.comboBoxTickets);
@@ -209,7 +233,7 @@ namespace C4IT_DataHistoryProvider_Test
this.Controls.Add(this.buttonGetUserComputerActivities);
this.Controls.Add(this.ctrlProtocolBox1);
this.Name = "ctrlTestFunctions";
this.Size = new System.Drawing.Size(1088, 268);
this.Size = new System.Drawing.Size(1530, 268);
this.Load += new System.EventHandler(this.ctrlTestFunctions_Load);
this.ResumeLayout(false);
this.PerformLayout();
@@ -232,5 +256,7 @@ namespace C4IT_DataHistoryProvider_Test
private System.Windows.Forms.Button buttonClear;
private System.Windows.Forms.CheckBox checkBoxFiltered;
private ctrlProtocolBox ctrlProtocolBox1;
private System.Windows.Forms.ComboBox comboBoxSessions;
private System.Windows.Forms.Label label5;
}
}

View File

@@ -54,6 +54,9 @@ namespace C4IT_DataHistoryProvider_Test
if (Program.Collector.M42WpmCollector != null)
await Program.Collector.M42WpmCollector.ValidateConnectionAsync(true, CancellationToken.None);
if (Program.Collector.CitrixCollector != null)
await Program.Collector.CitrixCollector.ValidateConnectionsAsync(CancellationToken.None);
}
catch (Exception E)
{
@@ -117,20 +120,37 @@ namespace C4IT_DataHistoryProvider_Test
ctrlProtocolBox1.ProcessMessage("no further information found.");
else
{
comboBoxTickets.Items.Clear();
ctrlProtocolBox1.ProcessMessage($"{RetVal.Count} related objects found:");
// fill the drop down boxes for the realtions found
comboBoxTickets.Items.Clear();
comboBoxSessions.Items.Clear();
foreach (var Entry2 in RetVal)
{
if (Entry2.Type == enumF4sdSearchResultClass.Ticket)
comboBoxTickets.Items.Add(Entry2);
switch(Entry2.Type)
{
case enumF4sdSearchResultClass.Ticket:
comboBoxTickets.Items.Add(Entry2);
break;
case enumF4sdSearchResultClass.VirtualSession:
if (!string.IsNullOrEmpty(Entry2.DisplayName))
comboBoxSessions.Items.Add(Entry2);
break;
}
ctrlProtocolBox1.ProcessMessage($" {Entry2.Type} {Entry2.Name} {{{Entry2.id}}}:");
ctrlProtocolBox1.ProcessMessage($" LastUsed: {Entry2.LastUsed}");
ctrlProtocolBox1.ProcessMessage($" Usage weight: {Entry2.UsingLevel}");
foreach (var Entry3 in Entry2.Infos)
ctrlProtocolBox1.ProcessMessage($" {Entry3.Key}: {Entry3.Value}");
}
if (comboBoxTickets.Items.Count > 0)
comboBoxTickets.SelectedIndex = 0;
if (comboBoxSessions.Items.Count > 0)
comboBoxSessions.SelectedIndex = 0;
}
}
catch (Exception E)
@@ -196,6 +216,11 @@ namespace C4IT_DataHistoryProvider_Test
GetTables();
}
private void comboBoxSessions_SelectedValueChanged(object sender, EventArgs e)
{
GetTables();
}
private void GetTables()
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
@@ -204,13 +229,15 @@ namespace C4IT_DataHistoryProvider_Test
bool HasUser = comboBoxUserSelect.SelectedItem != null;
bool HasComputer = comboBoxComputerSelect.SelectedItem != null;
bool HasTicket = comboBoxTickets.SelectedItem != null;
bool HasSession = comboBoxSessions.SelectedItem != null;
var Tables = new List<cDataHistoryConfigTable>();
foreach (var table in Program.Collector.ClusterConfig.Tables.Values)
{
if ((HasUser && table.ParentCluster.InformationClass == C4IT.FASD.Base.enumFasdInformationClass.User) ||
(HasComputer && table.ParentCluster.InformationClass == C4IT.FASD.Base.enumFasdInformationClass.Computer) ||
(HasTicket && table.ParentCluster.InformationClass == C4IT.FASD.Base.enumFasdInformationClass.Ticket))
(HasTicket && table.ParentCluster.InformationClass == C4IT.FASD.Base.enumFasdInformationClass.Ticket) ||
(HasSession && table.ParentCluster.InformationClass == enumFasdInformationClass.VirtualSession))
{
Tables.Add(table);
}
@@ -278,6 +305,8 @@ namespace C4IT_DataHistoryProvider_Test
Identities.Add(new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = UserEntry.id, AccountType = enumAccountType.AD });
if (comboBoxTickets.SelectedItem is cF4sdApiSearchResultRelation TicketEntry)
Identities.Add(new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Ticket, Id = TicketEntry.id });
if (comboBoxSessions.SelectedItem is cF4sdApiSearchResultRelation SessionEntry)
Identities.Add(new cF4sdIdentityEntry() { Class = enumFasdInformationClass.VirtualSession, Id = SessionEntry.id, Instance = SessionEntry.Instance });
if (!(comboBoxTable.SelectedItem is cDataHistoryConfigTable Table))
return;
@@ -467,5 +496,6 @@ namespace C4IT_DataHistoryProvider_Test
}
}
}