public CheckMeterService(MeterStorageConfigurationModel config)
        {
            meterInstanceRepository = new AzureTableMeterInstanceRepository(config.StorageKey, config.StorageSecret, config.StorageTableName);
            checkMeterProviders     = new Dictionary <nMeterTypes, ICheckMeterProvider>();
            checkMeterProviders.Add(nMeterTypes.Heartbeat, new HeartbeatCheckMeterProvider());
            checkMeterProviders.Add(nMeterTypes.MinValue, new MinValueCheckMeterProvider());
            checkMeterProviders.Add(nMeterTypes.MaxValue, new MaxValueCheckMeterProvider());
            checkMeterProviders.Add(nMeterTypes.EqualsValue, new EqualsValueCheckMeterProvider());

            // add the notification providers
            if (config.PushOverEnabled)
            {
                notificationProviders.Add(new PushOverNotificationProvider(config.PushOverToken, config.PushOverUser));
            }
        }
Ejemplo n.º 2
0
        public Boolean VerifyAndStoreConfiguration(MeterStorageConfigurationModel configuration)
        {
            // Verify the config
            configuration.Valid = true;

            // build the file name
            var settingsFileName = GetSettingsFileName();

            // serialize JSON directly to a file
            using (StreamWriter file = File.CreateText(settingsFileName))
            {
                JsonSerializer serializer = new JsonSerializer();
                serializer.Serialize(file, configuration);
            }

            // done
            return(true);
        }
Ejemplo n.º 3
0
 public MeterManagerEx(MeterStorageConfigurationModel config)
 {
     MeterManagerRepository = new AzureTableMeterManagerExRepository(config.StorageKey, config.StorageSecret, config.StorageTableName);
 }