From 42cf8e8d7ae66846681e19717edef98b72070001 Mon Sep 17 00:00:00 2001 From: Paul Coignet Date: Thu, 26 Nov 2020 18:09:26 +0100 Subject: [PATCH 1/3] Add config specs --- openldap/assets/configuration/spec.yaml | 82 ++++++++++++++++ .../openldap/data/conf.yaml.example | 94 +++++++++++++------ openldap/manifest.json | 3 + openldap/setup.py | 2 +- 4 files changed, 149 insertions(+), 32 deletions(-) create mode 100644 openldap/assets/configuration/spec.yaml diff --git a/openldap/assets/configuration/spec.yaml b/openldap/assets/configuration/spec.yaml new file mode 100644 index 0000000000000..17628f1e0c2bb --- /dev/null +++ b/openldap/assets/configuration/spec.yaml @@ -0,0 +1,82 @@ +name: OpenLDAP +files: +- name: openldap.yaml + options: + - template: init_config + options: + - template: init_config/default + - template: instances + options: + - name: url + description: | + Full URL of your ldap server. Use `ldaps` or `ldap` as the scheme to + use TLS or not, or `ldapi` to connect to a UNIX socket. + required: True + value: + example: ldaps://localhost:636 + type: string + - name: username + description: The Distinguished Name of the user that can read the monitor database. + value: + type: string + example: + - name: password + description: Password associated with `username` + value: + type: string + - name: ssl_verify + description: Whether or not to perform server certificate validation. + value: + type: boolean + example: true + - name: ssl_key + description: Path to the client private key file, in PEM format. + value: + type: string + example: + - name: ssl_cert + description: | + Path to the client certificate file in PEM format. + If you don't specify a key, it's taken from the certificate file. + value: + type: string + example: + - name: ssl_ca_certs + description: | + Path to a directory containing CA certificates, + or a file containing a bundle of certificates, in PEM format. + value: + type: string + example: + - name: custom_queries + description: | + Specifies custom search queries that are run by the check, which then sends the duration of + the query, and the number of results to Datadog. + Each custom queries have the following parameters: + * `name` - string - required: A name to identify your query. It's used to tag the metrics for this query. + * `search_base` - string - required: The search base for the query. + * `search_filter` - string - required: The search filter for your query. + * `search_scope` - string - optional - default: subtree : One of `base`, `level`, `subtree`. + * `attributes` - list of strings - optional: List of attributes to query. + * `username` - string - optional: The user you want to bind to perform the query. + Don't specify the option if you want to use the same user as + for the monitor backend. Set to empty string `""` for an anonymous bind. + * `password` - string - optional: The password associated with `username`. + value: + type: array + items: + type: object + example: + - name: + search_base: + search_filter: (objectClass=*) + search_scope: subtree + attributes: [] + username: + password: + - template: instances/default + - template: logs + example: + - type: file + path: /var/log/slapd.log + source: openldap diff --git a/openldap/datadog_checks/openldap/data/conf.yaml.example b/openldap/datadog_checks/openldap/data/conf.yaml.example index 46f18f6ee5260..1d16f57c75cf5 100644 --- a/openldap/datadog_checks/openldap/data/conf.yaml.example +++ b/openldap/datadog_checks/openldap/data/conf.yaml.example @@ -1,7 +1,16 @@ +## All options defined here are available to all instances. +# init_config: -## List of instances describing your OpenLDAP servers to monitor. + ## @param service - string - optional + ## Attach the tag `service:` to every metric, event, and service check emitted by this integration. + ## + ## Additionally, this sets the default `service` for every log source. + # + # service: +## Every instance is scheduled independent of the others. +# instances: ## @param url - string - required @@ -11,7 +20,7 @@ instances: - url: ldaps://localhost:636 ## @param username - string - optional - ## The DN of the user that can read the monitor database. + ## The Distinguished Name of the user that can read the monitor database. # # username: @@ -32,7 +41,7 @@ instances: ## @param ssl_cert - string - optional ## Path to the client certificate file in PEM format. - ## If you don't specify key, it's taken from the certificate file. + ## If you don't specify a key, it's taken from the certificate file. # # ssl_cert: @@ -42,46 +51,70 @@ instances: # # ssl_ca_certs: - ## @param tags - list of key:value elements - optional - ## List of tags to attach to every metric, event, and service check emitted by this Integration. - ## - ## Learn more about tagging: https://docs.datadoghq.com/tagging/ - # - # tags: - # - : - # - : - - ## @param custom_queries - object - optional + ## @param custom_queries - list of mappings - optional ## Specifies custom search queries that are run by the check, which then sends the duration of ## the query, and the number of results to Datadog. ## Each custom queries have the following parameters: - ## * `name` - string - required: A name to identify your query. It's used to tag the metrics for this query. - ## * `search_base` - string - required: The search base for the query. - ## * `search_filter` - string - required: The search filter for your query. - ## * `search_scope` - string - optional - default: subtree : One of `base`, `level`, `subtree`. - ## * `attributes` - list of strings - optional: List of attributes to query. - ## * `username` - string - optional: The user you want to bind to perform the query. - ## Don't specify the option if you want to use the same user as - ## for the monitor backend. Set to empty string `""` for an anonymous bind. - ## * `password` - string - optional: The password associated with `username`. + ## * `name` - string - required: A name to identify your query. It's used to tag the metrics for this query. + ## * `search_base` - string - required: The search base for the query. + ## * `search_filter` - string - required: The search filter for your query. + ## * `search_scope` - string - optional - default: subtree : One of `base`, `level`, `subtree`. + ## * `attributes` - list of strings - optional: List of attributes to query. + ## * `username` - string - optional: The user you want to bind to perform the query. + ## Don't specify the option if you want to use the same user as + ## for the monitor backend. Set to empty string `""` for an anonymous bind. + ## * `password` - string - optional: The password associated with `username`. # # custom_queries: # - name: # search_base: # search_filter: (objectClass=*) # search_scope: subtree - # attributes: - # - * + # attributes: [] # username: # password: -## Log Section (Available for Agent >=6.0) + ## @param tags - list of strings - optional + ## A list of tags to attach to every metric and service check emitted by this instance. + ## + ## Learn more about tagging at https://docs.datadoghq.com/tagging + # + # tags: + # - : + # - : + + ## @param service - string - optional + ## Attach the tag `service:` to every metric, event, and service check emitted by this integration. + ## + ## Overrides any `service` defined in the `init_config` section. + # + # service: + + ## @param min_collection_interval - number - optional - default: 15 + ## This changes the collection interval of the check. For more information, see: + ## https://docs.datadoghq.com/developers/write_agent_check/#collection-interval + # + # min_collection_interval: 15 + + ## @param empty_default_hostname - boolean - optional - default: false + ## This forces the check to send metrics with no hostname. + ## + ## This is useful for cluster-level checks. + # + # empty_default_hostname: false + +## Log Section ## -## type - mandatory - Type of log input source (tcp / udp / file / windows_event) -## port / path / channel_path - mandatory - Set port if type is tcp or udp. Set path if type is file. Set channel_path if type is windows_event -## service - mandatory - Name of the service that generated the log -## source - mandatory - Attribute that defines which Integration sent the logs -## tags: - optional - Add tags to the collected logs +## type - required - Type of log input source (tcp / udp / file / windows_event) +## port / path / channel_path - required - Set port if type is tcp or udp. +## Set path if type is file. +## Set channel_path if type is windows_event. +## source - required - Attribute that defines which Integration sent the logs. +## encoding - optional - For file specifies the file encoding, default is utf-8, other +## possible values are utf-16-le and utf-16-be. +## service - optional - The name of the service that generates the log. +## Overrides any `service` defined in the `init_config` section. +## tags - optional - Add tags to the collected logs. ## ## Discover Datadog log collection: https://docs.datadoghq.com/logs/log_collection/ # @@ -89,4 +122,3 @@ instances: # - type: file # path: /var/log/slapd.log # source: openldap -# service: diff --git a/openldap/manifest.json b/openldap/manifest.json index b2f14300faf6c..d4e11269afe8c 100644 --- a/openldap/manifest.json +++ b/openldap/manifest.json @@ -25,6 +25,9 @@ "type": "check", "integration_id": "openldap", "assets": { + "configuration": { + "spec": "assets/configuration/spec.yaml" + }, "monitors": {}, "dashboards": {}, "service_checks": "assets/service_checks.json", diff --git a/openldap/setup.py b/openldap/setup.py index 3550189c929b9..165268211f7b4 100644 --- a/openldap/setup.py +++ b/openldap/setup.py @@ -28,7 +28,7 @@ def get_dependencies(): return f.readlines() -CHECKS_BASE_REQ = 'datadog-checks-base>=4.2.0' +CHECKS_BASE_REQ = 'datadog-checks-base>=11.0.0' setup( name='datadog-openldap', From f860b339f2a2f59700a15ae352b6df31bae9dac4 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 27 Nov 2020 09:23:19 +0100 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Kari Halsted <12926135+kayayarai@users.noreply.github.com> --- openldap/assets/configuration/spec.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openldap/assets/configuration/spec.yaml b/openldap/assets/configuration/spec.yaml index 17628f1e0c2bb..32c349e10bf0a 100644 --- a/openldap/assets/configuration/spec.yaml +++ b/openldap/assets/configuration/spec.yaml @@ -9,7 +9,7 @@ files: options: - name: url description: | - Full URL of your ldap server. Use `ldaps` or `ldap` as the scheme to + Full URL of your LDAP server. Use `ldaps` or `ldap` to indicate whether to use TLS or not, or `ldapi` to connect to a UNIX socket. required: True value: @@ -37,7 +37,7 @@ files: - name: ssl_cert description: | Path to the client certificate file in PEM format. - If you don't specify a key, it's taken from the certificate file. + If you don't specify a key, the path is taken from the certificate file. value: type: string example: @@ -52,14 +52,14 @@ files: description: | Specifies custom search queries that are run by the check, which then sends the duration of the query, and the number of results to Datadog. - Each custom queries have the following parameters: - * `name` - string - required: A name to identify your query. It's used to tag the metrics for this query. + Each custom query has the following parameters: + * `name` - string - required: A name to identify your query. Used to tag the metrics for this query. * `search_base` - string - required: The search base for the query. * `search_filter` - string - required: The search filter for your query. - * `search_scope` - string - optional - default: subtree : One of `base`, `level`, `subtree`. + * `search_scope` - string - optional - default: `subtree` : One of `base`, `level`, or `subtree`. * `attributes` - list of strings - optional: List of attributes to query. * `username` - string - optional: The user you want to bind to perform the query. - Don't specify the option if you want to use the same user as + Don't specify this option if you want to use the same user as for the monitor backend. Set to empty string `""` for an anonymous bind. * `password` - string - optional: The password associated with `username`. value: From 4605f37e77bee744a4b7bbf4c9998f986b48381b Mon Sep 17 00:00:00 2001 From: Paul Coignet Date: Fri, 27 Nov 2020 09:25:03 +0100 Subject: [PATCH 3/3] Sync configuration --- .../datadog_checks/openldap/data/conf.yaml.example | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openldap/datadog_checks/openldap/data/conf.yaml.example b/openldap/datadog_checks/openldap/data/conf.yaml.example index 1d16f57c75cf5..347a895cabafc 100644 --- a/openldap/datadog_checks/openldap/data/conf.yaml.example +++ b/openldap/datadog_checks/openldap/data/conf.yaml.example @@ -14,7 +14,7 @@ init_config: instances: ## @param url - string - required - ## Full URL of your ldap server. Use `ldaps` or `ldap` as the scheme to + ## Full URL of your LDAP server. Use `ldaps` or `ldap` to indicate whether to ## use TLS or not, or `ldapi` to connect to a UNIX socket. # - url: ldaps://localhost:636 @@ -41,7 +41,7 @@ instances: ## @param ssl_cert - string - optional ## Path to the client certificate file in PEM format. - ## If you don't specify a key, it's taken from the certificate file. + ## If you don't specify a key, the path is taken from the certificate file. # # ssl_cert: @@ -54,14 +54,14 @@ instances: ## @param custom_queries - list of mappings - optional ## Specifies custom search queries that are run by the check, which then sends the duration of ## the query, and the number of results to Datadog. - ## Each custom queries have the following parameters: - ## * `name` - string - required: A name to identify your query. It's used to tag the metrics for this query. + ## Each custom query has the following parameters: + ## * `name` - string - required: A name to identify your query. Used to tag the metrics for this query. ## * `search_base` - string - required: The search base for the query. ## * `search_filter` - string - required: The search filter for your query. - ## * `search_scope` - string - optional - default: subtree : One of `base`, `level`, `subtree`. + ## * `search_scope` - string - optional - default: `subtree` : One of `base`, `level`, or `subtree`. ## * `attributes` - list of strings - optional: List of attributes to query. ## * `username` - string - optional: The user you want to bind to perform the query. - ## Don't specify the option if you want to use the same user as + ## Don't specify this option if you want to use the same user as ## for the monitor backend. Set to empty string `""` for an anonymous bind. ## * `password` - string - optional: The password associated with `username`. #