private List <DeviceData> GetDeviceData(string header, long deviceID, ECollectorType collectorType, IStartEndTime start_end) { //Stopwatch watch = Stopwatch.StartNew(); List <DeviceData> data = m_repo.GetDeviceData(deviceID, collectorType, start_end); return(data); }
public static string CollectorName(this ECollectorType c) { switch (c) { case ECollectorType.Memory: return(Resources.StringMemory); case ECollectorType.Disk: return(Resources.StringDisk); case ECollectorType.CPUUsage: return(Resources.StringCpuUsage); case ECollectorType.NICUsage: return(Resources.StringNicUsage); case ECollectorType.Uptime: return(Resources.StringUptime); case ECollectorType.LastBootTime: return(Resources.StringLastBootTime); case ECollectorType.Processes: return(Resources.StringProcesses); case ECollectorType.Ping: return(Resources.StringPing); case ECollectorType.InstalledApplications: return(Resources.StringInstalledApplications); case ECollectorType.Services: return(Resources.StringServices); case ECollectorType.SystemErrors: return(Resources.StringSystemErrors); case ECollectorType.ApplicationErrors: return(Resources.StringApplicationErrors); case ECollectorType.DatabaseSize: return(Resources.StringDatabaseSize); case ECollectorType.UPS: return(Resources.StringUPS); case ECollectorType.DiskSpeed: return(Resources.StringDiskSpeed); case ECollectorType.Unknown: return(Resources.StringUnknown); default: // If we can't get a translated version, use the best thing we have instead of choking return(c.ToString()); //throw new ArgumentOutOfRangeException(nameof(c), c, null); } }
public CollectAssetInfo(ECollectorType collectorType, string bundleName, string address, string assetPath, List <string> assetTags, bool isRawAsset) { CollectorType = collectorType; BundleName = bundleName; Address = address; AssetPath = assetPath; AssetTags = assetTags; IsRawAsset = isRawAsset; }
public List <DeviceData> GetDeviceData(long deviceID, ECollectorType collectorType, IStartEndTime start_end) { List <DeviceData> device_data = new List <DeviceData>(); device_data.Add(new DeviceData() { collectorID = 2233, dataID = 3344, timeStamp = DateTimeOffset.Now.AddHours(-6), value = "{}" }); return(device_data); }
public static bool IsValidCollector(this EDeviceType d, ECollectorType c) { bool is_collector = false; if (c_device_to_collectors.ContainsKey(d)) { is_collector = c_device_to_collectors[d].Contains(c); } return(is_collector); }
//private CollectorInfo() //{ // CID = new CollectorID(-1, string.Empty); // DID = new DeviceID(-1, string.Empty); // collectorType = ECollectorType.Unknown; // isEnabled = true; // frequencyInMinutes = collectorType.GetFrequencyInMinutes(); // SkipConfiguration = collectorType.GetSkipConfiguration(); // lastCollectionAttempt = lastCollectedAt = nextCollectionTime = null; // successfullyCollected = true; // isBeingCollected = false; //} public CollectorInfo(ECollectorType type) { CID = new CollectorID(-1, string.Empty); DID = new DeviceID(-1, string.Empty); collectorType = type; isEnabled = true; frequencyInMinutes = collectorType.GetFrequencyInMinutes(); SkipConfiguration = collectorType.GetSkipConfiguration(); lastCollectionAttempt = lastCollectedAt = nextCollectionTime = null; successfullyCollected = true; isBeingCollected = false; }
public static bool GetSkipConfiguration(this ECollectorType c) { bool skip_configuration = false; Type type = c.GetType(); MemberInfo[] memInfo = type.GetMember(c.ToString()); if (memInfo != null && memInfo.Length > 0) { object[] attrs = memInfo[0].GetCustomAttributes(typeof(SkipConfigurationAttribute), false); if (attrs != null && attrs.Length > 0) { skip_configuration = (attrs[0] as SkipConfigurationAttribute).SkipConfiguration; } } return(skip_configuration); }
public static int GetFrequencyInMinutes(this ECollectorType c) { int frequency = 0; Type type = c.GetType(); MemberInfo[] memInfo = type.GetMember(c.ToString()); if (memInfo != null && memInfo.Length > 0) { object[] attrs = memInfo[0].GetCustomAttributes(typeof(DefaultCollectionFrequencyAttribute), false); if (attrs != null && attrs.Length > 0) { frequency = (attrs[0] as DefaultCollectionFrequencyAttribute).FrequencyInMinutes; } } return(frequency); }
public EventLogCollector(CollectorID id, Remote remote_info, ECollectorType type) : base(new DataCollectorContext(id, type)) { RemoteInfo = remote_info; m_machine_name = Context.ID.Name; CollectorType = type; if (type != ECollectorType.SystemErrors && type != ECollectorType.ApplicationErrors) { throw new Exception($"EventLogCollector: invalid collector type {type}"); } // So we don't keep getting log entries that have already been retrieved, keep track // of the RecordNumber, which is an ever-increasing number for each of the different // types of logfiles (System, or Application), and the dates. // We need to keep the dates because if a particular machine is rebuilt, the RecordNumber // will get reset and we'll stop getting any errors from the event log. // Originally, we just kept the record number, but that's not good enough, so we // switched to using the date as the primary clause. m_log_data = new EventLogData(); SystemErrorsInfoRequest.EType req_type = SystemErrorsInfoRequest.EType.System; switch (CollectorType) { case ECollectorType.ApplicationErrors: req_type = SystemErrorsInfoRequest.EType.Application; break; case ECollectorType.SystemErrors: req_type = SystemErrorsInfoRequest.EType.System; break; default: throw new Exception($"EventLogCollector: failure to handle type conversion from {CollectorType}"); } SystemErrorsInfoRequest request = new SystemErrorsInfoRequest(m_machine_name, req_type); RequestBus.Instance.MakeRequest(request); if (request.IsHandled) { m_log_data.Assign(request.LogData); } }
public BuildAssetInfo(ECollectorType collectorType, string assetPath) { CollectorType = collectorType; Address = string.Empty; AssetPath = assetPath; IsRawAsset = false; System.Type assetType = UnityEditor.AssetDatabase.GetMainAssetTypeAtPath(assetPath); if (assetType == typeof(UnityEngine.Shader)) { IsShaderAsset = true; } else { IsShaderAsset = false; } }
public BuildAssetInfo(ECollectorType collectorType, string mainBundleName, string address, string assetPath, bool isRawAsset) { _mainBundleName = mainBundleName; CollectorType = collectorType; Address = address; AssetPath = assetPath; IsRawAsset = isRawAsset; System.Type assetType = UnityEditor.AssetDatabase.GetMainAssetTypeAtPath(assetPath); if (assetType == typeof(UnityEngine.Shader)) { IsShaderAsset = true; } else { IsShaderAsset = false; } }
public static List <EDeviceType> GetDevices(this ECollectorType c) { List <EDeviceType> types = new List <EDeviceType>(); Type type = c.GetType(); MemberInfo[] memInfo = type.GetMember(c.ToString()); if (memInfo != null && memInfo.Length > 0) { object[] attrs = memInfo[0].GetCustomAttributes(typeof(DevicesAttribute), false); if (attrs != null) { foreach (object o in attrs) { DevicesAttribute attr = o as DevicesAttribute; types.AddRange(attr.Devices); } } } return(types); }
private static void PruneCollector(CollectorInfo collector, SQLiteConnection conn) { Console.WriteLine($">>> Starting prune for {collector.name}"); ECollectorType type = collector.collectorType; int default_frequency = type.GetFrequencyInMinutes(); TimeSpan span = TimeSpan.FromMinutes(default_frequency); Stopwatch watch = Stopwatch.StartNew(); List <long> doomed = GatherDoomedData(collector, span, out long saved_count, conn); Console.WriteLine($"Found {doomed.Count} records to delete, {saved_count} will be retained"); Console.WriteLine($"Search took {watch.ElapsedMilliseconds} ms"); watch.Restart(); MeetTheirDemise(doomed, conn); Console.WriteLine($"<<< Completed prune for {collector.name}, it took {watch.ElapsedMilliseconds} ms"); }
public DataCollectorContext(CollectorID id, ECollectorType collector_type) { ID = id; Type = collector_type; }
public static ECollectorType CollectorTypeFromCollectorNameString(string collector_name) { ECollectorType type = ECollectorType.Unknown; return(type); }
public List <DeviceData> GetDeviceData(long deviceID, ECollectorType collectorType, IStartEndTime start_end) { return(new List <DeviceData>()); }