예제 #1
0
파일: Monitor.cs 프로젝트: hiciu/perflux
        public bool Start(HostControl hostControl)
        {
            PerfluxConfigurationSection config =
                ConfigurationManager.GetSection("perflux") as PerfluxConfigurationSection;

            if (config == null)
            {
                log.Error("Could not load configuration.");
                throw new ConfigurationErrorsException("Configuration section \"perflux\" is missing.");
            }

            ConnectionUri = config.Connection.GetConnectionUri();
            log.Info("InfluxDb host:{0} Port:{1} Database:{2}",
                     config.Connection.HostName,
                     config.Connection.Port,
                     config.Connection.DatabaseName);

            var configCounters = config.GetCounters();

            foreach (var series in configCounters.Keys)
            {
                log.Info("Adding counter {0}.", series);
                Counters.Add(series, new Counter(configCounters[series]));
            }

            countWorker   = new CountWorker(this, config.MonitorIntervalSeconds, config.RateLimit);
            postWorker    = new PostWorker(this, config.PostIntervalSeconds);
            cleanupWorker = new CleanupWorker(this, config.CounterCleanupIntervalSeconds);

            countWorker.Start();
            postWorker.Start();
            cleanupWorker.Start();

            return(true);
        }
예제 #2
0
 public ErgastMemoryCache(TimeSpan cacheEntryLifetime)
 {
     CacheEntryLifetime = cacheEntryLifetime;
     Cleaner            = new CleanupWorker(Cache, CleanupInterval);
 }