public Graphite(ApplicationConfiguration config) { using (Profiler.Step("Graphite Init")) { _config = config; _client = new GraphiteTcpClient("192.168.10.34", 2003); } }
public MemoryPlugin(ApplicationConfiguration config) { using (Profiler.Step("Memory Init")) { _config = _config; var category = new PerformanceCounterCategory("Memory"); _counters = category.GetCounters(); } }
public CpuPlugin(ApplicationConfiguration config) { using (Profiler.Step("CPU Init")) { _config = config; var category = new PerformanceCounterCategory("Processor"); _counters = (from name in category.GetInstanceNames() select category.GetCounters(name)) .SelectMany(x => x) .ToArray(); } }
/// <summary> /// Handles the setting of the Hostname and FQDNLookup values. /// </summary> /// <param name="config">The Application Configuration.</param> /// <param name="configFile">The conf file content.</param> private void MungeHostName(ApplicationConfiguration config, ConfigurationFile configFile) { if (configFile.ContainsKey(HostnameKey)) { config.Hostname = configFile[HostnameKey]; } else if (configFile.ContainsKey(FQDNookupKey) && configFile[FQDNookupKey].IsTrueString()) { config.Hostname = GetFQDN(); } else { config.Hostname = Environment.MachineName; } }
private ApplicationConfiguration ProcessConfig(ConfigurationFile configFile) { var x = typeof(IConfigurationWhatsit); var interestedParties = AppDomain.CurrentDomain.GetAssemblies() .ToList() .SelectMany(a => a.GetTypes()) .Where(t => x.IsAssignableFrom(t)) .Where(t => t.IsClass) .Where(t => !t.IsAbstract); var config = new ApplicationConfiguration(); foreach (var type in interestedParties) { var instance = (IConfigurationWhatsit)Activator.CreateInstance(type); instance.Munge(config, configFile); } return config; }
public void Munge(ApplicationConfiguration config, ConfigurationFile configFile) { MungeHostName(config, configFile); }