From a38df50a527563c863bd5a28402e96ce2f27ae1e Mon Sep 17 00:00:00 2001 From: imranalisyed506 <105209301+imranalisyed506@users.noreply.github.com> Date: Mon, 30 Dec 2024 15:21:19 +0530 Subject: [PATCH] [Cisco Meraki] Add warning message productType is not applicable to this network and skip collecting logs in cisco meraki collector (#383) --- collectors/ciscomeraki/collector.js | 13 +++++++++---- collectors/ciscomeraki/package.json | 2 +- ps_spec.yml | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/collectors/ciscomeraki/collector.js b/collectors/ciscomeraki/collector.js index e89bfe48..866d8601 100644 --- a/collectors/ciscomeraki/collector.js +++ b/collectors/ciscomeraki/collector.js @@ -20,7 +20,7 @@ const MAX_POLL_INTERVAL = 900; const API_THROTTLING_ERROR = 429; const API_NOT_FOUND_ERROR = 404; const NOT_FOUND_ERROR_MAX_RETRIES = 3; - +const PRODUCT_TYPE_NOTAPPLICABLE_MESSAGE = "productType is not applicable to this network"; const typeIdPaths = [{ path: ["type"] }]; const tsPaths = [{ path: ["occurredAt"] }]; @@ -187,9 +187,14 @@ class CiscomerakiCollector extends PawsCollector { return callback(error); } } else if (error && error.response && error.response.data) { - AlLogger.debug(`CMRI0000022 error ${error.response.data.errors} - status: ${error.response.status}`); - error.response.data.errorCode = error.response.status; - return callback(error.response.data); + if (error.response.data.errors == PRODUCT_TYPE_NOTAPPLICABLE_MESSAGE) { + AlLogger.warn(`CMRI0000023 ${error.response.data.errors} : ${state.networkId}`); + return callback(null, [], state, state.poll_interval_sec); + } else { + AlLogger.debug(`CMRI0000022 error ${error.response.data.errors} - status: ${error.response.status}`); + error.response.data.errorCode = error.response.status; + return callback(error.response.data); + } } else { return callback(error); } diff --git a/collectors/ciscomeraki/package.json b/collectors/ciscomeraki/package.json index fd35f571..e7b194bb 100644 --- a/collectors/ciscomeraki/package.json +++ b/collectors/ciscomeraki/package.json @@ -1,6 +1,6 @@ { "name": "ciscomeraki-collector", - "version": "1.0.5", + "version": "1.0.6", "description": "Alert Logic AWS based Cisco Meraki Log Collector", "repository": {}, "private": true, diff --git a/ps_spec.yml b/ps_spec.yml index 46346428..c65636f3 100644 --- a/ps_spec.yml +++ b/ps_spec.yml @@ -139,7 +139,7 @@ stages: - ./build_collector.sh ciscomeraki env: ALPS_SERVICE_NAME: "paws-ciscomeraki-collector" - ALPS_SERVICE_VERSION: "1.0.5" #set the value from collector package json + ALPS_SERVICE_VERSION: "1.0.6" #set the value from collector package json outputs: file: ./ciscomeraki-collector* packagers: