示例#1
0
        private static void GetServersToTest(string region, string fullPath)
        {
            comp          = "";
            serversToTest = new List <LightServer>();
            Console.WriteLine("Testing:");
            using (BuildAtlasWCFClient client = new BuildAtlasWCFClient())
            {
                foreach (LightServer ls in client.GetServersByDefaultRegion(region))
                {
                    if (ls.PrometheusId != (int?)null && ls.CanConnect == 1)
                    {
                        //Console.WriteLine(ls.Name);
                        serversToTest.Add(ls);
                    }
                }
            }

            if (serversToTest != null && serversToTest.Count() > 0 && !string.IsNullOrEmpty(fullPath))
            {
                comp      = fullPath;
                threadCnt = serversToTest.Count();
                signal    = new ManualResetEvent(false);
                for (int s = 0; s < threadCnt; s++)
                {
                    ThreadPool.QueueUserWorkItem(new WaitCallback(TestConnection), (object)s);
                }

                signal.WaitOne();
            }
        }
示例#2
0
        private static void GetPromInfo()
        {
            using (BuildAtlasWCFClient client = new BuildAtlasWCFClient())
            {
                try
                {
                    string name = System.Environment.MachineName;
                    me = client.GetPrometheusIdByServerName(name);
                    int       id = client.GetServerByName(name).Id;
                    LightTool lt = client.GetToolByName(id, "ssh");
                    if (lt != null)
                    {
                        ssh = lt.Path;
                    }
                    else
                    {
                        Console.WriteLine();
                        Console.WriteLine("ssh has not been defined as a tool for " + name + ".");
                        Console.WriteLine();
                    }

                    lt = client.GetToolByName(id, "scp");
                    if (lt != null)
                    {
                        scp = lt.Path;
                    }
                    else
                    {
                        Console.WriteLine();
                        Console.WriteLine("scp has not been defined as a tool for " + name + ".");
                        Console.WriteLine();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine();
                    Console.WriteLine(ex.Message);
                    Console.WriteLine();
                }
            }
        }