Beispiel #1
0
        static void Main(string[] args)
        {
            "Initializing Site Monitor".LogInformation();
            _monitor = new Monitor();

            _monitor.InitializeDatabase(Database.ReadDatabasePathFromConfig());
            "Database initialized".LogInformation();

            var arguments = new Arguments();

            "Parsing parameters".LogInformation();

            if (CommandLineParser.Default.ParseArguments(args, arguments))
            {
                try
                {
                    if (arguments.Monitor)
                    {
                        var interval = arguments.Interval.HasValue ? arguments.Interval.Value : 5;

                        LoadTestRunners(arguments);

                        _monitor.StartMonitoring(interval);
                    }

                    if (arguments.WebInterface)
                    {
                        "Initializing web interface".LogInformation();

                        var port = arguments.Port ?? 12345;
                        _monitor.StartAPISelfHost(port);

                        ("Web interface initialized at http://localhost:" + port.ToString()).LogInformation();
                    }

                    Console.WriteLine("Press any key to finish it");
                    Console.Read();
                }
                finally
                {
                    if (arguments.Monitor)
                    {
                        "Stoping test runners".LogInformation();
                        _monitor.StopAll();
                    }

                    if (arguments.WebInterface)
                    {
                        "Shutting web interface".LogInformation();
                        _monitor.StopAPISelfHost();
                    }
                }
            }

            "Site Monitor finished".LogInformation();

            Console.WriteLine(Environment.NewLine);
            Console.WriteLine("Press any key to quit Site Monitor");
            Console.Read();
        }
Beispiel #2
0
 public void Setup()
 {
     _monitor = new Monitor();
 }