diff --git a/package-lock.json b/package-lock.json index 44f95a73..5b6059de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "mkdirp": "^3.0.1", "moment": "^2.30.1", "moment-precise-range-plugin": "^1.3.0", - "mqtt": "^5.5.0", + "mqtt": "^5.5.2", "ms-teams-wrapper": "^1.0.2", "nodemailer": "^6.9.13", "nodemailer-express-handlebars": "^6.1.2", @@ -63,7 +63,7 @@ "winston": "^3.13.0", "winston-daily-rotate-file": "^5.0.0", "ws": "^8.16.0", - "xstate": "^5.9.1" + "xstate": "^5.10.0" }, "devDependencies": { "@babel/eslint-parser": "^7.24.1", @@ -71,7 +71,7 @@ "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", "prettier": "^3.2.5", - "snyk": "^1.1287.0" + "snyk": "^1.1288.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -6372,9 +6372,9 @@ } }, "node_modules/mqtt": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-5.5.0.tgz", - "integrity": "sha512-8WGQpjEzABcCh/UwLj7XaEoLsSLHJrJK3YLu57fJoLUBdz6zPGFdxWK3i1YYdPqKDu0sU6YHt+tly/qdLsLiyg==", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-5.5.2.tgz", + "integrity": "sha512-dlKxINBrrorgMp1A5UHQVf5GAkn1m/dY12W2Sp6LAY794RxQ0OPo0Q9N2S3qrNRjjC1WETA/9oYR6yadhR3siw==", "dependencies": { "@types/readable-stream": "^4.0.5", "@types/ws": "^8.5.9", @@ -7517,9 +7517,9 @@ } }, "node_modules/snyk": { - "version": "1.1287.0", - "resolved": "https://registry.npmjs.org/snyk/-/snyk-1.1287.0.tgz", - "integrity": "sha512-ZpsMjXLy5NPoMk0HbylsSDbhA6S8wSMqWO2DupIlJ7Q1URiv4+dOiL4wUYPViMFFNi9HdoYF00cxJyM1Y5I4QQ==", + "version": "1.1288.0", + "resolved": "https://registry.npmjs.org/snyk/-/snyk-1.1288.0.tgz", + "integrity": "sha512-IsfjXWVffhuB/UIefM7iqCGVBiLnULv08ax4YBTO/SF/RzIlm8Q92+I2sSwEva8f7kHYNE85Cjn9fg+LlmKUCQ==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -8438,9 +8438,9 @@ } }, "node_modules/xstate": { - "version": "5.9.1", - "resolved": "https://registry.npmjs.org/xstate/-/xstate-5.9.1.tgz", - "integrity": "sha512-85edx7iMqRJSRlEPevDwc98EWDYUlT5zEQ54AXuRVR+G76gFbcVTAUdtAeqOVxy8zYnUr9FBB5114iK6enljjw==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/xstate/-/xstate-5.10.0.tgz", + "integrity": "sha512-rn3AbPFHngLqtfFTe9KDXJ1wQX4ACDKnQyQ2ShjuKor3iVnxDSKyDL9llFLiOpaBQu+cFMKcZYlpXo5nb/q5rw==", "funding": { "type": "opencollective", "url": "https://opencollective.com/xstate" diff --git a/package.json b/package.json index d5624302..6927655f 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "mkdirp": "^3.0.1", "moment": "^2.30.1", "moment-precise-range-plugin": "^1.3.0", - "mqtt": "^5.5.0", + "mqtt": "^5.5.2", "ms-teams-wrapper": "^1.0.2", "nodemailer": "^6.9.13", "nodemailer-express-handlebars": "^6.1.2", @@ -103,7 +103,7 @@ "winston": "^3.13.0", "winston-daily-rotate-file": "^5.0.0", "ws": "^8.16.0", - "xstate": "^5.9.1" + "xstate": "^5.10.0" }, "devDependencies": { "@babel/eslint-parser": "^7.24.1", @@ -111,7 +111,7 @@ "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", "prettier": "^3.2.5", - "snyk": "^1.1287.0" + "snyk": "^1.1288.0" }, "pkg": { "assets": [ diff --git a/src/lib/post_to_influxdb.js b/src/lib/post_to_influxdb.js index 6aa8273f..1f778796 100755 --- a/src/lib/post_to_influxdb.js +++ b/src/lib/post_to_influxdb.js @@ -99,7 +99,6 @@ export async function postQlikSenseLicenseStatusToInfluxDB(qlikSenseLicenseStatu const configTags = globals.config.get('Butler.qlikSenseLicense.licenseMonitor.destination.influxDb.tag.static'); const tags = { - license_type: 'analyzer_access', butler_instance: instanceTag, }; @@ -116,11 +115,14 @@ export async function postQlikSenseLicenseStatusToInfluxDB(qlikSenseLicenseStatu // Is there any data for "analyzerAccess" license type? if (qlikSenseLicenseStatus.analyzerAccess.enabled === true) { - tags.license_type = 'analyzer_access'; + tags.license_type = 'analyzer'; + + // Do a deep clone of the tags object + const tagsCloned = _.cloneDeep(tags); datapoint.push({ measurement: 'qlik_sense_license', - tags, + tags: tagsCloned, fields: { allocated: qlikSenseLicenseStatus.analyzerAccess.allocated, available: qlikSenseLicenseStatus.analyzerAccess.available, @@ -134,42 +136,32 @@ export async function postQlikSenseLicenseStatusToInfluxDB(qlikSenseLicenseStatu // Is there any data for "analyzerTimeAccess" license type? if (qlikSenseLicenseStatus.analyzerTimeAccess.enabled === true) { - tags.license_type = 'analyzer_time_access'; - - datapoint.push({ - measurement: 'qlik_sense_license', - tags, - fields: { - allocatedMinutes: qlikSenseLicenseStatus.analyzerTimeAccess.allocatedMinutes, - unavailableMinutes: qlikSenseLicenseStatus.analyzerTimeAccess.unavailableMinutes, - usedMinutes: qlikSenseLicenseStatus.analyzerTimeAccess.usedMinutes, - }, - }); - } + tags.license_type = 'analyzer_capacity'; - // Is there any data for "loginAccess" license type? - if (qlikSenseLicenseStatus.loginAccess.enabled === true) { - tags.license_type = 'login_access'; + // Do a deep clone of the tags object + const tagsCloned = _.cloneDeep(tags); datapoint.push({ measurement: 'qlik_sense_license', - tags, + tags: tagsCloned, fields: { - allocatedTokens: qlikSenseLicenseStatus.loginAccess.allocatedTokens, - tokenCost: qlikSenseLicenseStatus.loginAccess.tokenCost, - unavailableTokens: qlikSenseLicenseStatus.loginAccess.unavailableTokens, - usedTokens: qlikSenseLicenseStatus.loginAccess.usedTokens, + allocated_minutes: qlikSenseLicenseStatus.analyzerTimeAccess.allocatedMinutes, + unavailable_minutes: qlikSenseLicenseStatus.analyzerTimeAccess.unavailableMinutes, + used_minutes: qlikSenseLicenseStatus.analyzerTimeAccess.usedMinutes, }, }); } // Is there any data for "professionalAccess" license type? if (qlikSenseLicenseStatus.professionalAccess.enabled === true) { - tags.license_type = 'professional_access'; + tags.license_type = 'professional'; + + // Do a deep clone of the tags object + const tagsCloned = _.cloneDeep(tags); datapoint.push({ measurement: 'qlik_sense_license', - tags, + tags: tagsCloned, fields: { allocated: qlikSenseLicenseStatus.professionalAccess.allocated, available: qlikSenseLicenseStatus.professionalAccess.available, @@ -181,18 +173,40 @@ export async function postQlikSenseLicenseStatusToInfluxDB(qlikSenseLicenseStatu }); } + // Is there any data for "loginAccess" license type? + if (qlikSenseLicenseStatus.loginAccess.enabled === true) { + tags.license_type = 'token_login'; + + // Do a deep clone of the tags object + const tagsCloned = _.cloneDeep(tags); + + datapoint.push({ + measurement: 'qlik_sense_license', + tags: tagsCloned, + fields: { + allocated_tokens: qlikSenseLicenseStatus.loginAccess.allocatedTokens, + token_cost: qlikSenseLicenseStatus.loginAccess.tokenCost, + unavailable_tokens: qlikSenseLicenseStatus.loginAccess.unavailableTokens, + used_tokens: qlikSenseLicenseStatus.loginAccess.usedTokens, + }, + }); + } + // Is there any data for "userAccess" license type? if (qlikSenseLicenseStatus.userAccess.enabled === true) { - tags.license_type = 'user_access'; + tags.license_type = 'token_user'; + + // Do a deep clone of the tags object + const tagsCloned = _.cloneDeep(tags); datapoint.push({ measurement: 'qlik_sense_license', - tags, + tags: tagsCloned, fields: { - allocatedTokens: qlikSenseLicenseStatus.userAccess.allocatedTokens, - quarantinedTokens: qlikSenseLicenseStatus.userAccess.quarantinedTokens, - tokenCost: qlikSenseLicenseStatus.userAccess.tokenCost, - userTokens: qlikSenseLicenseStatus.userAccess.userTokens, + allocated_tokens: qlikSenseLicenseStatus.userAccess.allocatedTokens, + quarantined_tokens: qlikSenseLicenseStatus.userAccess.quarantinedTokens, + token_cost: qlikSenseLicenseStatus.userAccess.tokenCost, + used_tokens: qlikSenseLicenseStatus.userAccess.userTokens, }, }); } @@ -201,12 +215,15 @@ export async function postQlikSenseLicenseStatusToInfluxDB(qlikSenseLicenseStatu if (qlikSenseLicenseStatus.tokensEnabled === true) { tags.license_type = 'tokens_available'; + // Do a deep clone of the tags object + const tagsCloned = _.cloneDeep(tags); + datapoint.push({ measurement: 'qlik_sense_license', - tags, + tags: tagsCloned, fields: { - availableTokens: qlikSenseLicenseStatus.availableTokens, - totalTokens: qlikSenseLicenseStatus.totalTokens, + available_tokens: qlikSenseLicenseStatus.availableTokens, + total_tokens: qlikSenseLicenseStatus.totalTokens, }, }); }