Exemplo n.º 1
0
        private void getQueryAvailable(ManagedObjectReference perfMgr,
                                       ManagedObjectReference hostmor,
                                       VimService service)
        {
            DateTime end   = DateTime.Now;
            DateTime start = end.AddHours(-12);

            PerfMetricId[] metricIds
                = service.QueryAvailablePerfMetric(perfMgr, hostmor, start, true, end, true, 20, true);
            int[] ids = new int[metricIds.Length];
            for (int i = 0; i != metricIds.Length; ++i)
            {
                ids[i] = metricIds[i].counterId;
            }
            PerfCounterInfo[] counters = service.QueryPerfCounter(perfMgr, ids);
            Console.WriteLine("Available metrics for host (" + metricIds.Length + "):");
            Console.WriteLine("--------------------------");
            for (int i = 0; i != metricIds.Length; ++i)
            {
                String label    = counters[i].nameInfo.label;
                String instance = metricIds[i].instance;
                Console.WriteLine("   " + label);
                if (instance.Length != 0)
                {
                    Console.WriteLine(" [" + instance + "]");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
Exemplo n.º 2
0
        private void getQueryAvailable(ManagedObjectReference perfMgr,
                                       ManagedObjectReference hostmor,
                                       VimService service)
        {
            DateTime end = DateTime.Now;
            DateTime start = end.AddHours(-12);

            PerfMetricId[] metricIds
               = service.QueryAvailablePerfMetric(perfMgr, hostmor, start, true, end, true, 20, true);
            int[] ids = new int[metricIds.Length];
            for (int i = 0; i != metricIds.Length; ++i)
            {
                ids[i] = metricIds[i].counterId;
            }
            PerfCounterInfo[] counters = service.QueryPerfCounter(perfMgr, ids);
            Console.WriteLine("Available metrics for host (" + metricIds.Length + "):");
            Console.WriteLine("--------------------------");
            for (int i = 0; i != metricIds.Length; ++i)
            {
                String label = counters[i].nameInfo.label;
                String instance = metricIds[i].instance;
                Console.WriteLine("   " + label);
                if (instance.Length != 0)
                {
                    Console.WriteLine(" [" + instance + "]");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }