0 Replies Latest reply on Apr 17, 2018 7:31 PM by GhostTyper

    Query Historical Data using PerformanceManager, C# and VMware.Vim.dll for vSphere 6.5

    GhostTyper Lurker

      Hello Forum,

      I try to access historical data of packetsRx (or any other Statistics). Querying other data like logs, VMs, etc. on the host is no problem. However, I just can't get any statistics out of the ESXi server.

      My approch currently is:

      1. Finding a VM from which I want to query historical data. I save the ManagedObjectReference from vm.Network[0] to a variable.
      2. Getting a PerformanceManager using client.GetView.
      3. Creating a PerfQueryObject and assigning MetricId, IntervalId, Entity and MaxSample.
      4. Calling percormanceManager.QueryPerfObject(perfQuerySpec).

      However, this results in an VimException:

      The operation is not supported on the object.

      Here is a piece of the code I'm currently using:

      PerformanceManager perf = (PerformanceManager)client.GetView(client.ServiceContent.PerfManager, null);              PerfQuerySpec spec = new PerfQuerySpec();  spec.MetricId = new PerfMetricId[] { new PerfMetricId() { Instance = "firewall", CounterId = 196612 } }; spec.IntervalId = 20; spec.Entity = netRef; spec.MaxSample = 10;  PerfCompositeMetric pcm = perf.QueryPerfComposite(spec);

      Whereby client is the VimClient used to connect to the server, "firewall" is the name of the VM, wherefrom netRef a NetworkInterface is and the CounterId of 196612 should be the packetsRx performance counter.

      However, I'm not entirely sure, if I'm doin' the right thing to get some values out of the performance counter. Maybe you could point out for me, in which direction I should look or what i'm doing wrong.