@stordata/vsphere-soapify
Advanced tools
Comparing version
'use strict'; | ||
const ManagedEntity = require('./ManagedEntity'), | ||
const _ = require('lodash'), | ||
ManagedEntity = require('./ManagedEntity'), | ||
PerformanceDescription = require('../data/PerformanceDescription'), | ||
@@ -20,12 +21,18 @@ PerfProviderSummary = require('../data/PerfProviderSummary'), | ||
preparePerfCounters(counters) { | ||
function findCounter({ groupInfo, nameInfo, rollupType, unitInfo }, counter) { | ||
const [group, name, rollup, unit] = counter.split('.'); | ||
return groupInfo.key === group && nameInfo.key === name && rollupType === rollup && (!unit || unitInfo.key === unit); | ||
} | ||
return this.withProperties() | ||
.then(properties => properties.perfCounter.reduce((accumulator, data) => { | ||
const counter = `${data.groupInfo.key}.${data.nameInfo.key}.${data.rollupType}`; | ||
.then(({ perfCounter }) => _.reduce(counters, (accumulator, instance, counter) => { | ||
const found = _.find(perfCounter, item => findCounter(item, counter)); | ||
if (counter in counters) { | ||
if (found) { | ||
accumulator.counterToId[counter] = { | ||
counterId: data.key, | ||
instance: counters[counter] | ||
counterId: found.key, | ||
instance | ||
}; | ||
accumulator.idToCounter[data.key] = counter; | ||
accumulator.idToCounter[found.key] = counter; | ||
} | ||
@@ -32,0 +39,0 @@ |
{ | ||
"name": "@stordata/vsphere-soapify", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "A NodeJS abstraction layer for the vSphere SOAP API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,4 +6,4 @@ 'use strict'; | ||
require('..')(client => client.getPerfCounters(HostSystem, { | ||
'cpu.usage.average': '', | ||
'cpu.usage.average.percent': '', | ||
'storageAdapter.read.average': '*' | ||
})); |
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2739935
0.02%7716
0.06%1
Infinity%