Skip to content

Commit

Permalink
Add sap hana config spec (#7715)
Browse files Browse the repository at this point in the history
* Add config spec

* Use db template

* Remove useless attribute

* Add timeout unit
  • Loading branch information
coignetp authored Oct 23, 2020
1 parent 8f0fded commit 10cfc97
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 42 deletions.
49 changes: 49 additions & 0 deletions sap_hana/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: SAP HANA
files:
- name: sap_hana.yaml
options:
- template: init_config
options:
- template: init_config/db
- template: init_config/default
- template: instances
options:
- name: server
description: The hostname used to connect to the system.
required: true
value:
type: string
- name: port
description: The port used to connect to the system.
value:
type: integer
default: 30015
- name: username
description: The database user to authenticate as.
required: true
value:
type: string
- name: password
description: The password of `username`.
required: true
value:
type: string
- name: use_hana_hostnames
description: |
Whether or not to use the hostnames contained in HANA's monitoring
views instead of the Agent hostname.
value:
type: boolean
example: false
- name: batch_size
description: The number of rows to return with each query result.
value:
type: integer
default: 1000
- name: timeout
description: The timeout in seconds for connecting to `server`.
value:
type: integer
default: 10
- template: instances/db
- template: instances/default
110 changes: 69 additions & 41 deletions sap_hana/datadog_checks/sap_hana/data/conf.yaml.example
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
## All options defined here are available to all instances.
#
init_config:
## @param global_custom_queries - list - optional

## @param global_custom_queries - list of mappings - optional
## See `custom_queries` defined below.
##
## Global custom queries can be applied to all instances using the
## `use_global_custom_queries` setting at the instance level.
#
# global_custom_queries:
# - metric_prefix: ibm_db2
# query: <QUERY>
# - query: <QUERY>
# columns: <COLUMNS>
# tags: <TAGS>

## @param service - string - optional
## Attach the tag `service:<SERVICE>` to every metric, event, and service check emitted by this integration.
##
## Additionally, this sets the default `service` for every log source.
#
# service: <SERVICE>

## Every instance is scheduled independent of the others.
#
instances:

## @param server - string - required
## The hostname used to connect to the system.
#
- server: <SERVER>

## @param port - integer - required - default: 39015
## @param port - integer - optional - default: 30015
## The port used to connect to the system.
#
port: 39015
# port: <PORT>

## @param username - string - required
## The database user to authenticate as.
Expand All @@ -42,61 +53,78 @@ instances:
## @param batch_size - integer - optional - default: 1000
## The number of rows to return with each query result.
#
# batch_size: 1000
# batch_size: <BATCH_SIZE>

## @param timeout - integer - optional - default: 10
## The timeout for connecting to `server`.
## The timeout in seconds for connecting to `server`.
#
# timeout: 10

## @param tags - list of key:value strings - optional
## 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:
# - <KEY_1>:<VALUE_1>
# - <KEY_2>:<VALUE_2>
# timeout: <TIMEOUT>

## @param use_global_custom_queries - string - optional - default: true
## How `global_custom_queries` should be used for this instance. There are 3 options:
##
## 1. true - `global_custom_queries` will override `custom_queries`
## 2. false - `custom_queries` will override `global_custom_queries`
## 2. extend - `global_custom_queries` will be used in addition to any `custom_queries`
## 1. true - `global_custom_queries` override `custom_queries`.
## 2. false - `custom_queries` override `global_custom_queries`.
## 3. extend - `global_custom_queries` are used in addition to any `custom_queries`.
#
# use_global_custom_queries: true
# use_global_custom_queries: 'true'

## @param custom_queries - list - optional
## Each query must have 2 fields:
## @param custom_queries - list of mappings - optional
## Each query must have 2 fields, and can have a third optional field:
##
## 1. query - This is the SQL to execute. It can be a simple statement or a multi-line script.
## 2. columns - This is a list representing each column, ordered sequentially from left to right.
## 1. query - The SQL to execute. It can be a simple statement or a multi-line script.
## Use the pipe `|` if you require a multi-line script.
## 2. columns - The list representing each column, ordered sequentially from left to right.
## The number of columns must equal the number of columns returned in the query.
## There are 2 required pieces of data:
## a. name - This is the suffix to append to `sap_hana.` in order to form
## the full metric name. If `type` is `tag`, this column will
## instead be considered a tag and will be applied to every
## a. name - The suffix to append to `<INTEGRATION>.` to form
## the full metric name. If `type` is `tag`, this column is
## considered a tag and applied to every
## metric collected by this particular query.
## b. type - This is the submission method (gauge, monotonic_count, etc.).
## b. type - The submission method (gauge, monotonic_count, etc.).
## This can also be set to `tag` to tag each metric in the row
## with the name and value of the item in this column. You can
## use the `count` type to perform aggregation for queries that
## return multiple rows with the same or no tags.
## Columns without a name are ignored. To skip a column, enter:
## - {}
## 3. tags (optional) - A list of tags to apply to each metric.
#
# custom_queries:
# - query: | # Use the pipe if you require a multi-line script.
# SELECT DATABASE_NAME,
# COUNT(*)
# FROM SYS_DATABASES.M_DATA_VOLUMES
# GROUP BY DATABASE_NAME
# - query: SELECT foo, COUNT(*) FROM table.events GROUP BY foo
# columns:
# # Columns without a name are ignored, put this for any column you wish to skip:
# # - {}
# - name: db
# type: tag
# - name: data_volume.total
# type: gauge
# - name: foo
# type: tag
# - name: event.total
# type: gauge
# tags:
# - test:sap_hana
# - test:<INTEGRATION>

## @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:
# - <KEY_1>:<VALUE_1>
# - <KEY_2>:<VALUE_2>

## @param service - string - optional
## Attach the tag `service:<SERVICE>` to every metric, event, and service check emitted by this integration.
##
## Overrides any `service` defined in the `init_config` section.
#
# service: <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
3 changes: 3 additions & 0 deletions sap_hana/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"is_public": true,
"integration_id": "sap-hana",
"assets": {
"configuration": {
"spec": "assets/configuration/spec.yaml"
},
"dashboards": {
"SAP HANA Overview": "assets/dashboards/overview.json"
},
Expand Down
2 changes: 1 addition & 1 deletion sap_hana/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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(
Expand Down

0 comments on commit 10cfc97

Please sign in to comment.