public List <DataStoreInfo> GetMonitoredDataStores(string serverName) { SqlCommand cmd = CreateCommand(CommandType.StoredProcedure, "SD_GetMonitoredSites"); cmd.AddVarChar("scoringDaemonName", serverName, 100); List <DataStoreInfo> hubs = new List <DataStoreInfo>(); ExecuteReader(cmd, delegate(IColumnReader reader) { reader.FixNulls = true; while (reader.Read()) { DataStoreInfo hub = new DataStoreInfo { ServiceType = reader.GetString("serviceType"), ServiceRole = reader.GetString("serviceRole"), ClientName = reader.GetString("clientname"), Environment = reader.GetString("environment"), PublicIP = reader.GetString("IP"), PrivateIP = reader.GetString("privateIP"), ServerName = reader.GetString("serverName"), DBName = reader.GetString("dbname"), }; hubs.Add(hub); } }); return(hubs); }
private void InternalGetKnownTypes(IClient client) { try { var response = new ServerDescriptionResponse(); foreach (var pair in _dataStores) { response.AddTypeDescription(pair.Value.TypeDescription); var dataStore = pair.Value; var info = new DataStoreInfo { Count = dataStore.Count, EvictionPolicy = dataStore.EvictionType, EvictionPolicyDescription = dataStore.EvictionPolicy.ToString(), FullTypeName = dataStore.TypeDescription.FullTypeName, AvailableData = dataStore.DomainDescription ?? new DomainDescription( dataStore.TypeDescription.FullTypeName), DataCompression = dataStore.TypeDescription.UseCompression, HitCount = dataStore.HitCount, ReadCount = dataStore.ReadCount }; response.AddDataStoreInfo(info); } var currentProcess = Process.GetCurrentProcess(); var assembly = Assembly.GetEntryAssembly(); response.ServerProcessInfo = new ServerInfo { ConnectedClients = (int)ActiveConnections, StartTime = StartTime, Bits = IntPtr.Size * 8, Threads = currentProcess.Threads.Count, WorkingSet = currentProcess.WorkingSet64, VirtualMemory = currentProcess.VirtualMemorySize64, SoftwareVersion = assembly != null ? assembly.GetName().Version.ToString() : "" }; client.SendResponse(response); } catch (Exception ex) { client.SendResponse(new ExceptionResponse(ex)); } }
public void PendingConnect() { InitConnection(); try { if (_conn.State != FdoConnectionState.Closed) { _conn.Close(); } _conn.ConnectionString = string.Format("{0}={1};{2}={3};{4}={5}", _view.ServiceParameter, _view.Service, _view.UsernameParameter, _view.Username, _view.PasswordParameter, _view.Password); if (_conn.Open() == FdoConnectionState.Pending) { List <DataStoreInfo> datastores = new List <DataStoreInfo>(); var cmds = _conn.Capability.GetArrayCapability(CapabilityType.FdoCapabilityType_CommandList); if (Array.IndexOf(cmds, CommandType.CommandType_ListDataStores) >= 0) { using (var svc = _conn.CreateFeatureService()) { var stores = svc.ListDataStores(false); foreach (var store in stores) { var ds = new DataStoreInfo( store.Name, store.Name + ((store.IsFdoEnabled) ? "" : " (*)"), store.IsFdoEnabled); datastores.Add(ds); } } } else { var prop = _conn.GetConnectTimeProperty(_view.DataStoreParameter) as EnumerableDictionaryProperty; if (prop != null) { foreach (string name in prop.Values) { datastores.Add(new DataStoreInfo(name, name, true)); } } } SetDataStore(datastores.ToArray()); } } catch (Exception ex) { _view.ShowError(ex.Message); } }
private void GetKnownTypes(IClient client) { try { var response = new ServerDescriptionResponse(); var stores = DataStores.Values; foreach (var store in stores) { response.AddTypeDescription(store.CollectionSchema); var info = new DataStoreInfo { Count = store.DataByPrimaryKey.Count, EvictionPolicy = store.EvictionType, EvictionPolicyDescription = store.EvictionPolicy.ToString(), FullTypeName = store.CollectionSchema.CollectionName, AvailableData = store.DomainDescription ?? new DomainDescription(null), DataCompression = store.CollectionSchema.UseCompression, HitCount = store.HitCount, ReadCount = store.ReadCount }; response.AddDataStoreInfo(info); } // add the special @ACTIVITY table (it may not be initialized in test environments) if (_serviceContainer.Log != null) { var activityInfo = new DataStoreInfo { FullTypeName = LogEntry.Table, Count = _serviceContainer.Log.ActivityTable.DataByPrimaryKey.Count }; response.AddDataStoreInfo(activityInfo); response.AddTypeDescription(_serviceContainer.Log.ActivityTable.CollectionSchema); } var currentProcess = Process.GetCurrentProcess(); var assembly = Assembly.GetAssembly(typeof(Server)); response.ServerProcessInfo = new ServerInfo { ConnectedClients = (int)ActiveConnections, StartTime = StartTime, Bits = IntPtr.Size * 8, Threads = currentProcess.Threads.Count, WorkingSet = currentProcess.WorkingSet64, VirtualMemory = currentProcess.VirtualMemorySize64, SoftwareVersion = assembly != null ? assembly.GetName().Version.ToString() : "" }; client.SendResponse(response); } catch (Exception ex) { client.SendResponse(new ExceptionResponse(ex)); } }