示例#1
0
 static int Main(string[] args)
 {
     if (!GetParameters(args))
     {
         return(-1);
     }
     Console.WriteLine("effective parameters:");
     Console.WriteLine(" TFSUrl = " + Utility.TFSUri.ToString());
     Console.WriteLine(" include = " + MonitorAgents.GetInstance().includedAgentNames.Aggregate("", (s, t) => s + (s == "" ? "" : ";") + t));
     Console.WriteLine(" exclude = " + MonitorAgents.GetInstance().excludedAgentNames.Aggregate("", (s, t) => s + (s == "" ? "" : ";") + t));
     Console.WriteLine(" includeHost = " + MonitorAgents.GetInstance().includedHostNames.Aggregate("", (s, t) => s + (s == ""? "" : ";") + t));
     Console.WriteLine(" excludeHost = " + MonitorAgents.GetInstance().excludedHostNames.Aggregate("", (s, t) => s + (s == "" ? "" : ";") + t));
     Console.WriteLine(" smtp = " + MonitorAgents.GetInstance().SmtpServer);
     Console.WriteLine(" port = " + MonitorAgents.GetInstance().Port.ToString());
     Console.WriteLine(" from = " + MonitorAgents.GetInstance().From);
     Console.WriteLine(" to = " + MonitorAgents.GetInstance().To);
     Console.WriteLine(" AgentHealthCheckInterval = " + MonitorAgents.GetInstance().AgentHealthCheckInterval + " miliseconds");
     Console.WriteLine(" TolerableOfflinePeriod = " + MonitorAgents.GetInstance().TolerableOfflinePeriod + " miliseconds");
     if (Environment.UserInteractive)
     {
         BasicHealthCheckService.GetInstance().TestStartupAndStop(args);
     }
     else
     {
         ServiceBase[] ServicesToRun;
         ServicesToRun = new ServiceBase[]
         {
             BasicHealthCheckService.GetInstance()
         };
         ServiceBase.Run(ServicesToRun);
     }
     return(0);
 }
 public static BasicHealthCheckService GetInstance()
 {
     if (instance == null)
     {
         instance = new BasicHealthCheckService();
     }
     return(instance);
 }