protected override IMonitor BuildFromConfig(Configuration config) { var log = LogManager.GetLogger(typeof(PerformanceMonitor)); var instance = new PerformanceMonitor(log, config.MachineName); MapConfiguration(config.CpuUsageSeverity, instance.CpuUsageSeverity); MapConfiguration(config.DiskSpaceAvailableSeverity, instance.DiskSpaceAvailableSeverity); MapConfiguration(config.MemoryAvailableSeverity, instance.MemoryAvailableSeverity); MapConfiguration(config.MSMQStorageUsageSeverity, instance.MSMQStorageUsageSeverity); return(instance); }
protected override IEnumerable <IMonitor> BuildFromConfig(Configuration config) { config.ThrowIfNull(nameof(config.MachineNames)); foreach (var currentName in config.MachineNames) { var instance = new PerformanceMonitor(LogManager.GetLogger(typeof(PerformanceMonitor)), currentName); MapConfiguration(config.CpuUsageSeverity, instance.CpuUsageSeverity); MapConfiguration(config.DiskSpaceAvailableSeverity, instance.DiskSpaceAvailableSeverity); MapConfiguration(config.MemoryAvailableSeverity, instance.MemoryAvailableSeverity); MapConfiguration(config.MSMQStorageUsageSeverity, instance.MSMQStorageUsageSeverity); yield return(instance); } }