From 5820a802db88db7ac3e9a5dacfccba349b92773a Mon Sep 17 00:00:00 2001 From: ckamm Date: Tue, 4 Oct 2022 12:39:47 -0700 Subject: [PATCH 1/2] Adding new log_req_limit value to venafi_cert.yaml and python file. This allows users to separate the two and specify different values for each based on their needs instead of have one value for everything. Adding a default variable LOG_LIMIT set to 10000. Adding if statement for passed log_req_limit value from yaml. Changing params for POST request in get_log_events method to LOG_LIMIT variable. Adding log_req_limit to yaml example. Adding log_req_limit to README. --- README.md | 1 + checks.d/venafi_cert.py | 8 ++++++-- conf.d/venafi_cert.yaml | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f92854b..6f10c91 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ To install the project's dependencies, clone this repo to the host machine and r | client_id | `OAuth` client id. Required if `auth_method` is `oauth`. | No | scope | `OAuth` scope. Required if `auth_method` is `oauth`. | No | req_limit | Default is `10000`. Limits number of records returned from the API. | No +| log_req_limit | Default is `10000`. Limits number of log records returned from the API. | No | key_sizes | Default is a list of `[512, 1024, 2048]` | No | key_algorithms | Default is a list of `["RSA", "ECC"]` | No | min_collection_interval | Default is `60`. Sets the minimum interval of metrics collections when the DataDog agent is running.| No diff --git a/checks.d/venafi_cert.py b/checks.d/venafi_cert.py index 2727b9d..b8a512b 100644 --- a/checks.d/venafi_cert.py +++ b/checks.d/venafi_cert.py @@ -11,6 +11,7 @@ class VenafiCheck(AgentCheck): UTCNOW = datetime.utcnow() LIMIT = 5000 + LOG_LIMIT = 10000 KEY_SIZES = [256, 512, 1024, 2048] KEY_ALGOS = ["RSA", "ECC"] @@ -76,6 +77,9 @@ def configure(self, instance): if "req_limit" in instance: self.LIMIT = instance["req_limit"] + if "log_req_limit" in instance: + self.LOG_LIMIT = instance["log_req_limit"] + if "key_sizes" in instance: self.KEY_SIZES = instance["key_sizes"] @@ -305,7 +309,7 @@ def count_algo_certs(self): tags=[ "key_algorithm:%s" % algo.lower(), "metric_submission_type:count", - ], + ], ) def count_keysize_certs(self): @@ -532,7 +536,7 @@ def get_log_events(self): url = self.BASE_URL + "/vedsdk/Log/" params = { - "limit": self.LIMIT, + "limit": self.LOG_LIMIT, } headers = { diff --git a/conf.d/venafi_cert.yaml b/conf.d/venafi_cert.yaml index 3c79498..8751aab 100644 --- a/conf.d/venafi_cert.yaml +++ b/conf.d/venafi_cert.yaml @@ -8,6 +8,7 @@ instances: # client_id: "clientid" # scope: "scope:scope" # req_limit: 10000 + # log_req_limit: 10000 # key_sizes: # - 512 # - 1024 From faf7a003602a0a6df2939218d05736c80b8f37bf Mon Sep 17 00:00:00 2001 From: ckamm Date: Tue, 4 Oct 2022 12:42:24 -0700 Subject: [PATCH 2/2] Adding new log_req_limit value to venafi_cert.yaml and python file. This allows users to separate the two and specify different values for each based on their needs instead of have one value for everything. Adding a default variable LOG_LIMIT set to 10000. Adding if statement for passed log_req_limit value from yaml. Changing params for POST request in get_log_events method to LOG_LIMIT variable. Adding log_req_limit to yaml example. Adding log_req_limit to README. --- checks.d/venafi_cert.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checks.d/venafi_cert.py b/checks.d/venafi_cert.py index b8a512b..b024004 100644 --- a/checks.d/venafi_cert.py +++ b/checks.d/venafi_cert.py @@ -309,7 +309,7 @@ def count_algo_certs(self): tags=[ "key_algorithm:%s" % algo.lower(), "metric_submission_type:count", - ], + ], ) def count_keysize_certs(self):