diff --git a/app/support_packet.go b/app/support_packet.go index 84236c7daf..7f6115daf3 100644 --- a/app/support_packet.go +++ b/app/support_packet.go @@ -71,32 +71,67 @@ func (a *App) generateSupportPacketYaml() (*model.FileData, string) { } // Here we are getting information regarding the database (mysql/postgres + current schema version) - databaseType, databaseVersion := a.Srv().DatabaseTypeAndSchemaVersion() + databaseType, databaseSchemaVersion := a.Srv().DatabaseTypeAndSchemaVersion() + + databaseVersion, _ := a.Srv().Store().GetDbVersion(false) uniqueUserCount, err := a.Srv().Store().User().Count(model.UserCountOptions{}) if err != nil { return nil, errors.Wrap(err, "error while getting user count").Error() } + analytics, err := a.GetAnalytics("standard", "") + if analytics == nil { + return nil, errors.Wrap(err, "error while getting analytics").Error() + } + + elasticPostIndexing, _ := a.Srv().Store().Job().GetAllByTypePage("elasticsearch_post_indexing", 0, 2) + elasticPostAggregation, _ := a.Srv().Store().Job().GetAllByTypePage("elasticsearch_post_aggregation", 0, 2) + ldapSyncJobs, _ := a.Srv().Store().Job().GetAllByTypePage("ldap_sync", 0, 2) + messageExport, _ := a.Srv().Store().Job().GetAllByTypePage("message_export", 0, 2) + dataRetentionJobs, _ := a.Srv().Store().Job().GetAllByTypePage("data_retention", 0, 2) + complianceJobs, _ := a.Srv().Store().Job().GetAllByTypePage("compliance", 0, 2) + migrationJobs, _ := a.Srv().Store().Job().GetAllByTypePage("migrations", 0, 2) + + licenseTo := "" supportedUsers := 0 if license := a.Srv().License(); license != nil { supportedUsers = *license.Features.Users + licenseTo = license.Customer.Company } // Creating the struct for support packet yaml file supportPacket := model.SupportPacket{ - ServerOS: runtime.GOOS, - ServerArchitecture: runtime.GOARCH, - ServerVersion: model.CurrentVersion, - BuildHash: model.BuildHash, - DatabaseType: databaseType, - DatabaseVersion: databaseVersion, - LdapVendorName: vendorName, - LdapVendorVersion: vendorVersion, - ElasticServerVersion: elasticServerVersion, - ElasticServerPlugins: elasticServerPlugins, - ActiveUsers: int(uniqueUserCount), - LicenseSupportedUsers: supportedUsers, + LicenseTo: licenseTo, + ServerOS: runtime.GOOS, + ServerArchitecture: runtime.GOARCH, + ServerVersion: model.CurrentVersion, + BuildHash: model.BuildHash, + DatabaseType: databaseType, + DatabaseVersion: databaseVersion, + DatabaseSchemaVersion: databaseSchemaVersion, + LdapVendorName: vendorName, + LdapVendorVersion: vendorVersion, + ElasticServerVersion: elasticServerVersion, + ElasticServerPlugins: elasticServerPlugins, + ActiveUsers: int(uniqueUserCount), + LicenseSupportedUsers: supportedUsers, + TotalChannels: int(analytics[0].Value) + int(analytics[1].Value), + TotalPosts: int(analytics[2].Value), + TotalTeams: int(analytics[4].Value), + WebsocketConnections: int(analytics[5].Value), + MasterDbConnections: int(analytics[6].Value), + ReplicaDbConnections: int(analytics[7].Value), + DailyActiveUsers: int(analytics[8].Value), + MonthlyActiveUsers: int(analytics[9].Value), + InactiveUserCount: int(analytics[10].Value), + ElasticPostIndexingJobs: elasticPostIndexing, + ElasticPostAggregationJobs: elasticPostAggregation, + LdapSyncJobs: ldapSyncJobs, + MessageExportJobs: messageExport, + DataRetentionJobs: dataRetentionJobs, + ComplianceJobs: complianceJobs, + MigrationJobs: migrationJobs, } // Marshal to a Yaml File diff --git a/model/system.go b/model/system.go index 7a5d2ee696..fbc2aaa684 100644 --- a/model/system.go +++ b/model/system.go @@ -76,18 +76,36 @@ type ServerBusyState struct { } type SupportPacket struct { - ServerOS string `yaml:"server_os"` - ServerArchitecture string `yaml:"server_architecture"` - ServerVersion string `yaml:"server_version"` - BuildHash string `yaml:"build_hash,omitempty"` - DatabaseType string `yaml:"database_type"` - DatabaseVersion string `yaml:"database_version"` - LdapVendorName string `yaml:"ldap_vendor_name,omitempty"` - LdapVendorVersion string `yaml:"ldap_vendor_version,omitempty"` - ElasticServerVersion string `yaml:"elastic_server_version,omitempty"` - ElasticServerPlugins []string `yaml:"elastic_server_plugins,omitempty"` - ActiveUsers int `yaml:"active_users"` - LicenseSupportedUsers int `yaml:"license_supported_users,omitempty"` + LicenseTo string `yaml:"license_to"` + ServerOS string `yaml:"server_os"` + ServerArchitecture string `yaml:"server_architecture"` + ServerVersion string `yaml:"server_version"` + BuildHash string `yaml:"build_hash,omitempty"` + DatabaseType string `yaml:"database_type"` + DatabaseVersion string `yaml:"database_version"` + DatabaseSchemaVersion string `yaml:"database_schema_version"` + LdapVendorName string `yaml:"ldap_vendor_name,omitempty"` + LdapVendorVersion string `yaml:"ldap_vendor_version,omitempty"` + ElasticServerVersion string `yaml:"elastic_server_version,omitempty"` + ElasticServerPlugins []string `yaml:"elastic_server_plugins,omitempty"` + ActiveUsers int `yaml:"active_users"` + LicenseSupportedUsers int `yaml:"license_supported_users,omitempty"` + TotalChannels int `yaml:"total_channels"` + TotalPosts int `yaml:"total_posts"` + TotalTeams int `yaml:"total_teams"` + DailyActiveUsers int `yaml:"daily_active_users"` + MonthlyActiveUsers int `yaml:"monthly_active_users"` + WebsocketConnections int `yaml:"websocket_connections"` + MasterDbConnections int `yaml:"master_db_connections"` + ReplicaDbConnections int `yaml:"read_db_connections"` + InactiveUserCount int `yaml:"inactive_user_count"` + ElasticPostIndexingJobs []*Job `yaml:"elastic_post_indexing_jobs"` + ElasticPostAggregationJobs []*Job `yaml:"elastic_post_aggregation_jobs"` + LdapSyncJobs []*Job `yaml:"ldap_sync_jobs"` + MessageExportJobs []*Job `yaml:"message_export_jobs"` + DataRetentionJobs []*Job `yaml:"data_retention_jobs"` + ComplianceJobs []*Job `yaml:"compliance_jobs"` + MigrationJobs []*Job `yaml:"migration_jobs"` } type FileData struct {