cisco-perfmon 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +3 -3
  2. package/main.js +12 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -51,11 +51,11 @@ var counterObj = {
51
51
  console.log("Let's get a description of our counter.");
52
52
  service
53
53
  .queryCounterDescription(counterObj)
54
- .then((results) => {
55
- console.log("queryCounterDescription", results);
54
+ .then((response) => {
55
+ console.log("queryCounterDescription", response.results);
56
56
  })
57
57
  .catch((error) => {
58
- console.log(error);
58
+ console.log(error.message);
59
59
  });
60
60
  ```
61
61
 
package/main.js CHANGED
@@ -370,7 +370,7 @@ class perfMonService {
370
370
  * @param {string} host - The host to collect data from.
371
371
  * @returns {object} returns JSON via a Promise. JSON contains Session Cookie (If availible) and Results.
372
372
  */
373
- listCounter(host) {
373
+ listCounter(host,filtered = []) {
374
374
  var XML;
375
375
  var options = this._OPTIONS;
376
376
  options.SOAPAction = `perfmonListCounter`;
@@ -403,6 +403,10 @@ class perfMonService {
403
403
  if (keyExists(output, "perfmonListCounterReturn")) {
404
404
  var returnResults = output.Body.perfmonListCounterResponse.perfmonListCounterReturn;
405
405
  promiseResults.results = clean(returnResults);
406
+ if (filtered.length > 0) {
407
+ var res = promiseResults.results.filter(item => filtered.includes(item.Name));
408
+ promiseResults.results = res;
409
+ }
406
410
  resolve(promiseResults);
407
411
  } else {
408
412
  // Return JSON with no results.
@@ -483,6 +487,13 @@ class perfMonService {
483
487
  if (keyExists(output, "perfmonListInstanceReturn")) {
484
488
  var returnResults = output.Body.perfmonListInstanceResponse.perfmonListInstanceReturn;
485
489
  promiseResults.results = clean(returnResults);
490
+ if (!Array.isArray(promiseResults.results)) {
491
+ var temp = promiseResults.results;
492
+ promiseResults = {
493
+ results: [],
494
+ };
495
+ promiseResults.results.push(temp);
496
+ }
486
497
  resolve(promiseResults);
487
498
  } else {
488
499
  // Return JSON with no results.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cisco-perfmon",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "A library to pull Perfmon data from Cisco VOS applications via SOAP",
5
5
  "main": "main.js",
6
6
  "scripts": {