Пример #1
0
 public Graphite(ApplicationConfiguration config)
 {
     using (Profiler.Step("Graphite Init"))
     {
         _config = config;
         _client = new GraphiteTcpClient("192.168.10.34", 2003);
     }
 }
Пример #2
0
        public MemoryPlugin(ApplicationConfiguration config)
        {
            using (Profiler.Step("Memory Init"))
            {
                _config = _config;
                var category = new PerformanceCounterCategory("Memory");

                _counters = category.GetCounters();
            }
        }
Пример #3
0
        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();
            }
        }
Пример #4
0
 /// <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;
     }
 }
Пример #5
0
        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;
        }
Пример #6
0
 public void Munge(ApplicationConfiguration config, ConfigurationFile configFile)
 {
     MungeHostName(config, configFile);
 }