vmware_exporter icon indicating copy to clipboard operation
vmware_exporter copied to clipboard

The QueryStats collection performance indicator is -1

Open hongyefeng11 opened this issue 3 years ago • 1 comments

Hi,all:

I have a question at "https://github.com/pryorda/vmware_exporter/blob/main/vmware_exporter/vmware_exporter.py" 

line 1409,Here is the code snippet.

def _vmware_get_host_perf_manager_metrics(self, host_metrics): logging.info('START: _vmware_get_host_perf_manager_metrics')

    host_systems, counter_info = yield parallelize(self.host_system_inventory, self.counter_ids)

    # List of performance counter we want
    perf_list = [
        'cpu.costop.summation',
        'cpu.demand.average',
        'cpu.idle.summation',
        'cpu.ready.summation',
        'cpu.swapwait.summation',
        'cpu.usage.average',
        'cpu.usagemhz.average',
        'cpu.used.summation',
        'disk.read.average',
        'disk.write.average',
        'mem.active.average',
        'mem.latency.average',
        'mem.swapin.average',
        'mem.swapinRate.average',
        'mem.swapout.average',
        'mem.swapoutRate.average',
        'mem.vmmemctl.average',
        'net.bytesRx.average',
        'net.bytesTx.average',
        'net.droppedRx.summation',
        'net.droppedTx.summation',
        'net.errorsRx.summation',
        'net.errorsTx.summation',
        'net.usage.average',
    ]

    # Prepare gauges
    for p in perf_list:
        p_metric = 'vmware_host_' + p.replace('.', '_')
        host_metrics[p_metric] = GaugeMetricFamily(
            p_metric,
            p_metric,
            labels=self._labelNames['host_perf'])
        self._metricNames['host_perf'].append(p_metric)

    metrics = []
    metric_names = {}
    for perf_metric in perf_list:
        perf_metric_name = 'vmware_host_' + perf_metric.replace('.', '_')
        counter_key = counter_info[perf_metric]
        metrics.append(vim.PerformanceManager.MetricId(
            counterId=counter_key,
            instance=''
        ))
        metric_names[counter_key] = perf_metric_name

    # Insert custom attributes names as metric labels
    self.updateMetricsLabelNames(host_metrics, ['host_perf'])

    specs = []
    for host in host_systems.values():
        if host.get('runtime.powerState') != 'poweredOn':
            continue
        specs.append(vim.PerformanceManager.QuerySpec(
            maxSample=1,
            entity=host['obj'],
            metricId=metrics,
            intervalId=20
        ))

    content = yield self.content

    if len(specs) > 0:
        results, labels = yield parallelize(
            threads.deferToThread(content.perfManager.QueryStats, querySpec=specs),
            self.host_labels,
        )

        for ent in results:
            for metric in ent.value:
                host_metrics[metric_names[metric.id.counterId]].add_metric(
                    labels[ent.entity._moId],
                    float(sum(metric.value)),
                )

My question: 1、Sometimes the collection performance value is -1. What does -1 represent? Under what circumstances can negative -1 occur? 2、Check whether the physical host is abnormal when the performance indicator is -1

hongyefeng11 avatar Jan 18 '22 13:01 hongyefeng11

Which metric are you referring to exactly?

pryorda avatar Feb 14 '22 18:02 pryorda