Exemplo n.º 1
0
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;

            ServiceCheckerConfig config = ServiceCheckerFactory.CreateConfigMaster().LoadFromYaml("../config/config.yaml");

            _historyLoader = ComponentFactory.CreateHistoryLoader(config.HistoryLoader);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            /*SCConfig config = new SCConfig();
             *
             * ServiceDef sd = new ServiceDef()
             * {
             *  ID = 1,
             *  Name = "Test Service",
             *  Host = "localhost",
             *  Port = 5000,
             *  // Host = "http://depechemode345.com",
             *  // Host = "http://localhost:5000/",
             *  PollPeriod = 10
             * };
             *
             * config.Services = new ServiceDef[1] { sd };*/


            ServiceCheckerConfig config = ServiceCheckerFactory.CreateConfigMaster().LoadFromYaml("../config/config.yaml");

            runner = ServiceCheckerFactory.CreateRunner(ComponentFactory.CreateTimeMaster(), ComponentFactory.CreateOutput(config.Output), config.Services, false);

            // Fire and forget
            Task.Run(() =>
            {
                runner.Start();
            });

            Console.CancelKeyPress += OnCancel;

            while (true)
            {
                if (stopped.WaitOne(1000))
                {
                    break;
                }
            }
        }