Пример #1
0
        internal static Settings Load(SettingsReader reader)
        {
            var settings = new Settings
            {
                TransportType             = reader.Read <string>("Monitoring/TransportType"),
                LogLevel                  = MonitorLogs.InitializeLevel(reader),
                LogPath                   = reader.Read("Monitoring/LogPath", DefaultLogLocation()),
                ErrorQueue                = reader.Read("Monitoring/ErrorQueue", "error"),
                HttpHostName              = reader.Read <string>("Monitoring/HttpHostname"),
                HttpPort                  = reader.Read <string>("Monitoring/HttpPort"),
                EndpointName              = reader.Read <string>("Monitoring/EndpointName"),
                EndpointUptimeGracePeriod = TimeSpan.Parse(reader.Read("Monitoring/EndpointUptimeGracePeriod", "00:00:40"))
            };

            return(settings);
        }
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.AssemblyResolve += (s, e) => ResolveAssembly(e.Name);

            try
            {
                var arguments = new HostArguments(args);

                var settings = LoadSettings(ConfigurationManager.AppSettings, arguments);

                MonitorLogs.Configure(settings);

                var runner = new CommandRunner(arguments.Commands);

                runner.Run(settings).GetAwaiter().GetResult();
            }
            catch (Exception exception)
            {
                Console.Error.WriteLine(exception);
                Environment.Exit(-1);
            }
        }