From 332eec0102ea522627b4bda82c75ef2332f7d021 Mon Sep 17 00:00:00 2001 From: Jameson Pugh Date: Wed, 28 Jun 2023 11:35:35 -0400 Subject: [PATCH 1/4] datasource types +mssql --- plugins/modules/grafana_datasource.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/plugins/modules/grafana_datasource.py b/plugins/modules/grafana_datasource.py index 154dc451..faad34be 100644 --- a/plugins/modules/grafana_datasource.py +++ b/plugins/modules/grafana_datasource.py @@ -45,6 +45,7 @@ - sni-thruk-datasource - camptocamp-prometheus-alertmanager-datasource - loki + - mssqlx - redis-datasource type: str ds_url: @@ -460,6 +461,23 @@ additional_secure_json_data: httpHeaderValue1: "Bearer ihavenogroot" enforce_secure_data: true + +- name: Create Grafana data source + community.grafana.grafana_datasource: + name: "datasource-mssql" + grafana_url: "https://grafana.company.com" + grafana_user: "admin" + grafana_password: "xxxxxx" + org_id: "1" + ds_type: "mssql" + ds_url: "mssql.company.com" + database: "SQLWATCH" + user: sqlwatch + additional_json_data: + timeInterval: 5s + additional_secure_json_data: + password: "xxxxxx" + delegate_to: localhost ''' RETURN = ''' @@ -738,7 +756,8 @@ def setup_module_object(): 'camptocamp-prometheus-alertmanager-datasource', 'sni-thruk-datasource', 'redis-datasource', - 'loki']), + 'loki', + 'mssql']), ds_url=dict(type='str'), access=dict(default='proxy', choices=['proxy', 'direct']), database=dict(type='str', default=""), From b9f16bbef063a712f0c29c167ba1e16d0bccf284 Mon Sep 17 00:00:00 2001 From: Jameson Pugh Date: Wed, 28 Jun 2023 12:47:12 -0400 Subject: [PATCH 2/4] datasource time_interval: +mssql --- plugins/modules/grafana_datasource.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/modules/grafana_datasource.py b/plugins/modules/grafana_datasource.py index faad34be..85886402 100644 --- a/plugins/modules/grafana_datasource.py +++ b/plugins/modules/grafana_datasource.py @@ -167,7 +167,7 @@ default: '@timestamp' time_interval: description: - - Minimum group by interval for C(influxdb), C(elasticsearch) or C(prometheus) datasources. + - Minimum group by interval for C(influxdb), C(elasticsearch), C(prometheus), or C(mssql) datasources. - for example C(>10s). type: str interval: @@ -471,10 +471,9 @@ org_id: "1" ds_type: "mssql" ds_url: "mssql.company.com" + time_interval: 5s database: "SQLWATCH" user: sqlwatch - additional_json_data: - timeInterval: 5s additional_secure_json_data: password: "xxxxxx" delegate_to: localhost @@ -633,7 +632,7 @@ def get_datasource_payload(data): es_version = ES_VERSION_MAPPING.get(data['es_version']) json_data['esVersion'] = es_version - if data['ds_type'] in ['elasticsearch', 'influxdb', 'prometheus']: + if data['ds_type'] in ['elasticsearch', 'influxdb', 'prometheus', 'mssql']: if data.get('time_interval'): json_data['timeInterval'] = data['time_interval'] From 17b0c6e218f33d4af7af51cf0ac3abff827bf2aa Mon Sep 17 00:00:00 2001 From: Jameson Pugh Date: Wed, 28 Jun 2023 14:06:53 -0400 Subject: [PATCH 3/4] typeo in description --- plugins/modules/grafana_datasource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/grafana_datasource.py b/plugins/modules/grafana_datasource.py index 85886402..20658dd1 100644 --- a/plugins/modules/grafana_datasource.py +++ b/plugins/modules/grafana_datasource.py @@ -45,7 +45,7 @@ - sni-thruk-datasource - camptocamp-prometheus-alertmanager-datasource - loki - - mssqlx + - mssql - redis-datasource type: str ds_url: From 6f65946641fcba61b340df9167cdb745464b6c37 Mon Sep 17 00:00:00 2001 From: Jameson Pugh Date: Thu, 9 Nov 2023 17:38:17 -0500 Subject: [PATCH 4/4] +changelog fragement --- changelogs/fragments/304-mssql_datasource.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelogs/fragments/304-mssql_datasource.yml diff --git a/changelogs/fragments/304-mssql_datasource.yml b/changelogs/fragments/304-mssql_datasource.yml new file mode 100644 index 00000000..115d9722 --- /dev/null +++ b/changelogs/fragments/304-mssql_datasource.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - added mssql to datasource module