コード例 #1
0
        /// <summary>
        /// List Checks In State
        /// </summary>
        private static void ListChecksInState()
        {
            var healthGovern = new HealthGovern();
            var result       = healthGovern.ListChecksInState(new ListChecksInStateParmeter {
                DC = "dc1", State = "critical"
            }).GetAwaiter().GetResult();

            Console.WriteLine($"back content={EntityToString(result)}");
        }
コード例 #2
0
        /// <summary>
        /// List Nodes For Service
        /// </summary>
        private static void HealthListNodesForService()
        {
            var healthGovern = new HealthGovern();
            var result       = healthGovern.ListNodeForService(new ListNodeForServiceParmeter {
                Service = "lisapi", DC = "dc1"
            }).GetAwaiter().GetResult();

            Console.WriteLine($"back content={EntityToString(result)}");
        }
コード例 #3
0
        /// <summary>
        /// 按名称查询健康的服务
        /// </summary>
        private static void QueryHealthServicesByName()
        {
            Console.WriteLine("请输入服务名称:");
            var serviceName   = Console.ReadLine();
            var serviceGovern = new HealthGovern();

            foreach (var healthService in serviceGovern.HealthServiceByName(serviceName: serviceName).GetAwaiter().GetResult())
            {
                Console.WriteLine($"服务名称:{healthService.Service.Service} {healthService.Service.Address}:{healthService.Service.Port}");

                foreach (var check in healthService.Checks)
                {
                    Console.WriteLine($"   CheckID:{check.CheckID}  状态:{check.Status} {check.Output}");
                }
            }
        }
コード例 #4
0
 private void gridService_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex > -1)
         {
             var service      = gridService.Rows[e.RowIndex].Cells["service"].Value.ToString();
             var healthGovern = new HealthGovern();
             gridCheck.DataSource = healthGovern.ListChecksForService(new CheckServiceParmeter {
                 DC = "dc1", Service = service
             });
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
 }