public BackgroundInventory(int parallelTasksCount, Dictionary <string, object> plugins) { if (plugins == null) { throw new ArgumentNullException(nameof(plugins)); } this.scheduler = new QueuedTaskScheduler <SolarWinds.Orion.Core.BusinessLayer.BackgroundInventory.BackgroundInventory.InventoryTask>(new QueuedTaskScheduler <SolarWinds.Orion.Core.BusinessLayer.BackgroundInventory.BackgroundInventory.InventoryTask> .TaskProcessingRoutine(this.DoInventory), parallelTasksCount); this.scheduler.TaskProcessingFinished += new EventHandler(this.scheduler_TaskProcessingFinished); this.snmpGlobals = new SnmpGlobalSettings(); this.snmpGlobals.set_MaxReplies(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-SNMP MaxReps", 5)); this.snmpGlobals.set_RequestTimeout(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-SNMP Timeout", 2500)); this.snmpGlobals.set_RequestRetries(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-SNMP Retries", 2)); this.snmpGlobals.set_HsrpEnabled((bool)SettingsDAL.GetCurrent <bool>("SWNetPerfMon-Settings-SNMP HSRPEnabled", (M0)1)); this.wmiGlobals = new WmiGlobalSettings(); this.wmiGlobals.set_UserImpersonationLevel((ImpersonationLevel)SettingsDAL.GetCurrent <ImpersonationLevel>("SWNetPerfMon-Settings-Wmi UserImpersonationLevel", (M0)0)); this.wmiGlobals.set_ConnectionRationMode((WmiConnectionRationMode)SettingsDAL.GetCurrent <WmiConnectionRationMode>("SWNetPerfMon-Settings-Wmi ConnectionRationMode", (M0)1)); this.wmiGlobals.set_MaxRationedConnections(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-Wmi MaxRationedConnections", 0)); this.wmiGlobals.set_KillProcessExcessiveError((bool)SettingsDAL.GetCurrent <bool>("SWNetPerfMon-Settings-Wmi KillProcessExcessiveError", (M0)1)); this.wmiGlobals.set_ExcessiveErrorThreshhold(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-Wmi ExcessiveErrorThreshhold", 50)); this.wmiGlobals.set_WmiRetries(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-WMI Retries", 0)); this.wmiGlobals.set_WmiRetryInterval(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-WMI Retry Interval", 0)); this.wmiGlobals.set_WmiAutoCorrectRDNSInconsistency(Convert.ToBoolean(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-WMI Auto Correct Reverse DNS", 0))); this.wmiGlobals.set_WmiDefaultRootNamespaceOverrideIndex(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-WMI Default Root Namespace Override Index", 0)); this.inventories = plugins; }
// Token: 0x060008D8 RID: 2264 RVA: 0x0003F7E4 File Offset: 0x0003D9E4 public BackgroundInventory(int parallelTasksCount, Dictionary <string, object> plugins) { if (plugins == null) { throw new ArgumentNullException("plugins"); } this.scheduler = new QueuedTaskScheduler <BackgroundInventory.InventoryTask>(new QueuedTaskScheduler <BackgroundInventory.InventoryTask> .TaskProcessingRoutine(this.DoInventory), parallelTasksCount); this.scheduler.TaskProcessingFinished += this.scheduler_TaskProcessingFinished; this.snmpGlobals = new SnmpGlobalSettings(); this.snmpGlobals.MaxReplies = SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-SNMP MaxReps", 5); this.snmpGlobals.RequestTimeout = SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-SNMP Timeout", 2500); this.snmpGlobals.RequestRetries = SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-SNMP Retries", 2); this.snmpGlobals.HsrpEnabled = SettingsDAL.GetCurrent <bool>("SWNetPerfMon-Settings-SNMP HSRPEnabled", true); this.wmiGlobals = new WmiGlobalSettings(); this.wmiGlobals.UserImpersonationLevel = SettingsDAL.GetCurrent <ImpersonationLevel>("SWNetPerfMon-Settings-Wmi UserImpersonationLevel", ImpersonationLevel.Default); this.wmiGlobals.ConnectionRationMode = SettingsDAL.GetCurrent <WmiConnectionRationMode>("SWNetPerfMon-Settings-Wmi ConnectionRationMode", 1); this.wmiGlobals.MaxRationedConnections = SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-Wmi MaxRationedConnections", 0); this.wmiGlobals.KillProcessExcessiveError = SettingsDAL.GetCurrent <bool>("SWNetPerfMon-Settings-Wmi KillProcessExcessiveError", true); this.wmiGlobals.ExcessiveErrorThreshhold = SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-Wmi ExcessiveErrorThreshhold", 50); this.wmiGlobals.WmiRetries = SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-WMI Retries", 0); this.wmiGlobals.WmiRetryInterval = SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-WMI Retry Interval", 0); this.wmiGlobals.WmiAutoCorrectRDNSInconsistency = Convert.ToBoolean(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-WMI Auto Correct Reverse DNS", 0)); this.wmiGlobals.WmiDefaultRootNamespaceOverrideIndex = SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-WMI Default Root Namespace Override Index", 0); this.inventories = plugins; }
public BackgroundInventoryManager(int parallelTasksCount) { this.scheduler = new QueuedTaskScheduler <BackgroundInventoryManager.InventoryTask>(new QueuedTaskScheduler <BackgroundInventoryManager.InventoryTask> .TaskProcessingRoutine(this.DoInventory), parallelTasksCount); this.scheduler.TaskProcessingFinished += new EventHandler(this.scheduler_TaskProcessingFinished); this.globals = new SnmpGlobalSettings(); this.globals.set_MaxReplies(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-SNMP MaxReps", 5)); this.globals.set_RequestTimeout(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-SNMP Timeout", 2500)); this.globals.set_RequestRetries(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-SNMP Retries", 2)); this.globals.set_HsrpEnabled((bool)SettingsDAL.GetCurrent <bool>("SWNetPerfMon-Settings-SNMP HSRPEnabled", (M0)1)); this.inventories = new Dictionary <string, BackgroundInventoryManager.DoInventoryDelegate>((IEqualityComparer <string>)StringComparer.OrdinalIgnoreCase); this.inventories.Add("Cpu", new BackgroundInventoryManager.DoInventoryDelegate(this.DoCpuInventory)); this.inventories.Add("Memory", new BackgroundInventoryManager.DoInventoryDelegate(this.DoMemoryInventory)); }
public ScheduledJob CreateDiscoveryJob( DiscoveryConfiguration configuration, IDiscoveryPluginFactory pluginFactory) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } Engine engine = this.engineDAL.GetEngine(((DiscoveryConfigurationBase)configuration).get_EngineId()); DiscoveryPollingEngineType?pollingEngineType = OrionDiscoveryJobFactory.GetDiscoveryPollingEngineType(configuration.get_EngineID(), this.engineDAL); int result; if (!int.TryParse(SettingsDAL.Get("SWNetPerfMon-Settings-SNMP MaxReps"), out result)) { result = 5; } OrionDiscoveryJobDescription discoveryJobDescription1 = new OrionDiscoveryJobDescription(); discoveryJobDescription1.set_ProfileId(((DiscoveryConfigurationBase)configuration).get_ProfileId()); discoveryJobDescription1.set_EngineId(((DiscoveryConfigurationBase)configuration).get_EngineId()); discoveryJobDescription1.set_HopCount(configuration.get_HopCount()); discoveryJobDescription1.set_IcmpTimeout(configuration.get_SearchTimeout()); DiscoveryCommonSnmpConfiguration snmpConfiguration = new DiscoveryCommonSnmpConfiguration(); snmpConfiguration.set_MaxSnmpReplies(result); snmpConfiguration.set_SnmpRetries(configuration.get_SnmpRetries()); snmpConfiguration.set_SnmpTimeout(configuration.get_SnmpTimeout()); snmpConfiguration.set_SnmpPort(configuration.get_SnmpPort()); snmpConfiguration.set_PreferredSnmpVersion(configuration.get_PreferredSnmpVersion()); discoveryJobDescription1.set_SnmpConfiguration(snmpConfiguration); discoveryJobDescription1.set_DisableICMP(configuration.get_DisableICMP()); discoveryJobDescription1.set_PreferredPollingMethod(((CoreDiscoveryPluginConfiguration)((DiscoveryConfigurationBase)configuration).GetDiscoveryPluginConfiguration <CoreDiscoveryPluginConfiguration>()).get_PreferredPollingMethod()); discoveryJobDescription1.set_VulnerabilityCheckDisabled(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-VulnerabilityCheckDisabled", 0) == 1); discoveryJobDescription1.set_MaxThreadsInDetectionPhase(SettingsDAL.GetCurrentInt("Discovery-MaxThreadsInDetectionPhase", 5)); discoveryJobDescription1.set_MaxThreadsInInventoryPhase(SettingsDAL.GetCurrentInt("Discovery-MaxThreadsInInventoryPhase", 5)); discoveryJobDescription1.set_PreferredDnsAddressFamily(SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-Default Preferred AddressFamily DHCP", 4)); discoveryJobDescription1.set_TagFilter(configuration.get_TagFilter()); discoveryJobDescription1.set_DefaultProbes(configuration.get_DefaultProbes()); OrionDiscoveryJobDescription discoveryJobDescription2 = discoveryJobDescription1; List <DiscoveryPluginInfo> discoveryPluginInfos = DiscoveryPluginFactory.GetDiscoveryPluginInfos(); IList <IDiscoveryPlugin> plugins = pluginFactory.GetPlugins((IList <DiscoveryPluginInfo>)discoveryPluginInfos); List <DiscoveryPluginInfo> pluginInfos = new List <DiscoveryPluginInfo>(); IDictionary <IDiscoveryPlugin, DiscoveryPluginInfo> pairsPluginAndInfo = DiscoveryPluginHelper.CreatePairsPluginAndInfo((IEnumerable <IDiscoveryPlugin>)plugins, (IEnumerable <DiscoveryPluginInfo>)discoveryPluginInfos); bool flag1 = RegistrySettings.IsFreePoller(); using (IEnumerator <IDiscoveryPlugin> enumerator = ((IEnumerable <IDiscoveryPlugin>)plugins).GetEnumerator()) { while (((IEnumerator)enumerator).MoveNext()) { IDiscoveryPlugin current = enumerator.Current; if (flag1 && !(current is ISupportFreeEngine)) { OrionDiscoveryJobFactory.log.DebugFormat("Discovery plugin {0} is not supported on FPE machine", (object)current); } else if (!((DiscoveryConfigurationBase)configuration).get_ProfileId().HasValue&& !(current is IOneTimeJobSupport)) { OrionDiscoveryJobFactory.log.DebugFormat("Plugin {0} is not supporting one time job and it's description woun't be added.", (object)((object)current).GetType().FullName); } else { if (configuration.get_TagFilter() != null && configuration.get_TagFilter().Any <string>()) { if (!(current is IDiscoveryPluginTags idiscoveryPluginTags)) { OrionDiscoveryJobFactory.log.DebugFormat("Discovery job for tags requested, however plugin {0} doesn't support tags, skipping.", (object)current); continue; } if (!configuration.get_TagFilter().Intersect <string>(idiscoveryPluginTags.get_Tags() ?? Enumerable.Empty <string>(), (IEqualityComparer <string>)StringComparer.InvariantCultureIgnoreCase).Any <string>()) { OrionDiscoveryJobFactory.log.DebugFormat("Discovery job for tags [{0}], however plugin {1} doesn't support any of the tags requested, skipping.", (object)string.Join(",", (IEnumerable <string>)configuration.get_TagFilter()), (object)current); continue; } } if (configuration.get_IsAgentJob() && (!(current is IAgentPluginJobSupport pluginJobSupport) || !((IEnumerable <string>)configuration.get_AgentPlugins()).Contains <string>(pluginJobSupport.get_PluginId()))) { OrionDiscoveryJobFactory.log.DebugFormat("Plugin {0} is not contained in supported agent plugins and will not be used.", (object)((object)current).GetType().FullName); }
// Token: 0x0600037A RID: 890 RVA: 0x00015B20 File Offset: 0x00013D20 public ScheduledJob CreateDiscoveryJob(DiscoveryConfiguration configuration, IDiscoveryPluginFactory pluginFactory) { if (configuration == null) { throw new ArgumentNullException("configuration"); } Engine engine = this.engineDAL.GetEngine(configuration.EngineId); DiscoveryPollingEngineType?discoveryPollingEngineType = OrionDiscoveryJobFactory.GetDiscoveryPollingEngineType(configuration.EngineID, this.engineDAL); int maxSnmpReplies; if (!int.TryParse(SettingsDAL.Get("SWNetPerfMon-Settings-SNMP MaxReps"), out maxSnmpReplies)) { maxSnmpReplies = 5; } OrionDiscoveryJobDescription orionDiscoveryJobDescription = new OrionDiscoveryJobDescription { ProfileId = configuration.ProfileId, EngineId = configuration.EngineId, HopCount = configuration.HopCount, IcmpTimeout = configuration.SearchTimeout, SnmpConfiguration = new DiscoveryCommonSnmpConfiguration { MaxSnmpReplies = maxSnmpReplies, SnmpRetries = configuration.SnmpRetries, SnmpTimeout = configuration.SnmpTimeout, SnmpPort = configuration.SnmpPort, PreferredSnmpVersion = configuration.PreferredSnmpVersion }, DisableICMP = configuration.DisableICMP, PreferredPollingMethod = configuration.GetDiscoveryPluginConfiguration <CoreDiscoveryPluginConfiguration>().PreferredPollingMethod, VulnerabilityCheckDisabled = (SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-VulnerabilityCheckDisabled", 0) == 1), MaxThreadsInDetectionPhase = SettingsDAL.GetCurrentInt("Discovery-MaxThreadsInDetectionPhase", 5), MaxThreadsInInventoryPhase = SettingsDAL.GetCurrentInt("Discovery-MaxThreadsInInventoryPhase", 5), PreferredDnsAddressFamily = SettingsDAL.GetCurrentInt("SWNetPerfMon-Settings-Default Preferred AddressFamily DHCP", 4), TagFilter = configuration.TagFilter, DefaultProbes = configuration.DefaultProbes }; List <DiscoveryPluginInfo> discoveryPluginInfos = DiscoveryPluginFactory.GetDiscoveryPluginInfos(); IList <IDiscoveryPlugin> plugins = pluginFactory.GetPlugins(discoveryPluginInfos); List <DiscoveryPluginInfo> list = new List <DiscoveryPluginInfo>(); IDictionary <IDiscoveryPlugin, DiscoveryPluginInfo> dictionary = DiscoveryPluginHelper.CreatePairsPluginAndInfo(plugins, discoveryPluginInfos); bool flag = RegistrySettings.IsFreePoller(); foreach (IDiscoveryPlugin discoveryPlugin in plugins) { if (flag && !(discoveryPlugin is ISupportFreeEngine)) { OrionDiscoveryJobFactory.log.DebugFormat("Discovery plugin {0} is not supported on FPE machine", discoveryPlugin); } else if (configuration.ProfileId == null && !(discoveryPlugin is IOneTimeJobSupport)) { OrionDiscoveryJobFactory.log.DebugFormat("Plugin {0} is not supporting one time job and it's description woun't be added.", discoveryPlugin.GetType().FullName); } else { if (configuration.TagFilter != null && configuration.TagFilter.Any <string>()) { IDiscoveryPluginTags discoveryPluginTags = discoveryPlugin as IDiscoveryPluginTags; if (discoveryPluginTags == null) { OrionDiscoveryJobFactory.log.DebugFormat("Discovery job for tags requested, however plugin {0} doesn't support tags, skipping.", discoveryPlugin); continue; } if (!configuration.TagFilter.Intersect(discoveryPluginTags.Tags ?? Enumerable.Empty <string>(), StringComparer.InvariantCultureIgnoreCase).Any <string>()) { OrionDiscoveryJobFactory.log.DebugFormat("Discovery job for tags [{0}], however plugin {1} doesn't support any of the tags requested, skipping.", string.Join(",", configuration.TagFilter), discoveryPlugin); continue; } } if (configuration.IsAgentJob) { IAgentPluginJobSupport agentPluginJobSupport = discoveryPlugin as IAgentPluginJobSupport; if (agentPluginJobSupport == null || !configuration.AgentPlugins.Contains(agentPluginJobSupport.PluginId)) { OrionDiscoveryJobFactory.log.DebugFormat("Plugin {0} is not contained in supported agent plugins and will not be used.", discoveryPlugin.GetType().FullName); continue; } } if (discoveryPollingEngineType != null && !OrionDiscoveryJobFactory.IsDiscoveryPluginSupportedForDiscoveryPollingEngineType(discoveryPlugin, discoveryPollingEngineType.Value, dictionary)) { if (OrionDiscoveryJobFactory.log.IsDebugEnabled) { OrionDiscoveryJobFactory.log.DebugFormat(string.Format("Plugin {0} is not supported for polling engine {1}", discoveryPlugin.GetType().FullName, configuration.EngineID), Array.Empty <object>()); } } else { DiscoveryPluginJobDescriptionBase discoveryPluginJobDescriptionBase = null; Exception ex = null; try { discoveryPluginJobDescriptionBase = discoveryPlugin.GetJobDescription(configuration); } catch (Exception ex2) { discoveryPluginJobDescriptionBase = null; ex = ex2; } if (discoveryPluginJobDescriptionBase == null) { string text = "Plugin " + discoveryPlugin.GetType().FullName + " was not able found valid job description."; if (ex != null) { OrionDiscoveryJobFactory.log.Warn(text, ex); } else { OrionDiscoveryJobFactory.log.Warn(text); } } else { orionDiscoveryJobDescription.DiscoveryPluginJobDescriptions.Add(discoveryPluginJobDescriptionBase); DiscoveryPluginInfo item = dictionary[discoveryPlugin]; list.Add(item); } } } } JobDescription jobDescription = new JobDescription { TypeName = typeof(OrionDiscoveryJob).AssemblyQualifiedName, JobDetailConfiguration = this.GetOrionDiscoveryJobDescriptionString(orionDiscoveryJobDescription, list, configuration.UseJsonFormat), JobNamespace = "orion", ResultTTL = TimeSpan.FromMinutes(10.0), TargetNode = new HostAddress(IPAddressHelper.ToStringIp(engine.IP), 4), LegacyEngine = engine.ServerName.ToLowerInvariant(), EndpointAddress = (configuration.IsAgentJob ? configuration.AgentAddress : null), SupportedRoles = 7 }; jobDescription.Timeout = OrionDiscoveryJobFactory.GetDiscoveryJobTimeout(configuration); ScheduledJob scheduledJob; if (configuration.CronSchedule != null) { bool flag2 = false; string text2 = configuration.CronSchedule.CronExpression; if (string.IsNullOrWhiteSpace(text2)) { DateTime t = configuration.CronSchedule.StartTime.ToLocalTime(); if (t < DateTime.Now) { OrionDiscoveryJobFactory.log.InfoFormat("Profile (ID={0}) with past Once(Cron) schedule. We should not create job for it.", configuration.ProfileID); return(null); } text2 = string.Format("{0} {1} {2} {3} *", new object[] { t.Minute, t.Hour, t.Day, t.Month }); flag2 = true; } scheduledJob = new ScheduledJob(jobDescription, text2, "net.pipe://localhost/orion/core/scheduleddiscoveryjobsevents2", configuration.ProfileID.ToString()); scheduledJob.RunOnce = flag2; scheduledJob.TimeZoneInfo = TimeZoneInfo.Local; if (!flag2) { scheduledJob.Start = configuration.CronSchedule.StartTime.ToUniversalTime(); DateTime?endTime = configuration.CronSchedule.EndTime; DateTime maxValue = DateTime.MaxValue; if ((endTime == null || (endTime != null && endTime.GetValueOrDefault() != maxValue)) && configuration.CronSchedule.EndTime != null) { scheduledJob.End = configuration.CronSchedule.EndTime.Value.ToUniversalTime(); } } } else if (!configuration.ScheduleRunAtTime.Equals(DateTime.MinValue)) { scheduledJob = new ScheduledJob(jobDescription, configuration.ScheduleRunAtTime, "net.pipe://localhost/orion/core/scheduleddiscoveryjobsevents2", configuration.ProfileID.ToString()); } else { scheduledJob = new ScheduledJob(jobDescription, configuration.ScheduleRunFrequency, "net.pipe://localhost/orion/core/scheduleddiscoveryjobsevents2", configuration.ProfileID.ToString()); } return(scheduledJob); }