-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support alertmanager Grafana datasource
- Loading branch information
Showing
3 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
minor_changes: | ||
- ``community.grafana.grafana_datasource`` supports alertmanager. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
tests/integration/targets/grafana_datasource/tasks/alertmanager.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
- name: Create alertmanager datasource | ||
register: result | ||
grafana_datasource: | ||
name: datasource-alertmanager | ||
grafana_url: "{{ grafana_url }}" | ||
grafana_user: "{{ grafana_username }}" | ||
grafana_password: "{{ grafana_password }}" | ||
org_id: '1' | ||
ds_type: alertmanager | ||
ds_url: alertmanager.company.com:9093 | ||
alertmanager_implementation: prometheus | ||
alertmanager_handle_grafana_alerts: false | ||
|
||
- debug: | ||
var: result | ||
|
||
- assert: | ||
that: | ||
- result.changed | ||
- "result.msg == 'Datasource datasource-alertmanager created'" | ||
|
||
- name: Check alertmanager datasource creation idempotency | ||
register: result | ||
grafana_datasource: | ||
name: datasource-alertmanager | ||
grafana_url: "{{ grafana_url }}" | ||
grafana_user: "{{ grafana_username }}" | ||
grafana_password: "{{ grafana_password }}" | ||
org_id: '1' | ||
ds_type: alertmanager | ||
ds_url: alertmanager.company.com:9093 | ||
alertmanager_implementation: prometheus | ||
alertmanager_handle_grafana_alerts: false | ||
|
||
- debug: | ||
var: result | ||
|
||
- assert: | ||
that: | ||
- not result.changed | ||
- result.datasource.basicAuth == false | ||
- result.datasource.isDefault == false | ||
- result.datasource.jsonData.sslmode == 'verify-full' | ||
- result.datasource.jsonData.tlsAuth == false | ||
- result.datasource.jsonData.tlsAuthWithCACert == false | ||
- result.datasource.jsonData.implementation == 'prometheus' | ||
- result.datasource.jsonData.handleGrafanaManagedAlerts == false | ||
- result.datasource.name == 'datasource-alertmanager' | ||
- result.datasource.orgId == 1 | ||
- result.datasource.type == 'alertmanager' | ||
- result.datasource.url == 'alertmanager.company.com:9093' | ||
- result.datasource.withCredentials == false | ||
|
||
- name: Delete alertmanager datasource | ||
register: result | ||
grafana_datasource: | ||
name: datasource-alertmanager | ||
grafana_url: "{{ grafana_url }}" | ||
grafana_user: "{{ grafana_username }}" | ||
grafana_password: "{{ grafana_password }}" | ||
state: absent | ||
|
||
- debug: | ||
var: result | ||
|
||
- assert: | ||
that: | ||
- result.changed | ||
|
||
- name: Delete alertmanager datasource | ||
register: result | ||
grafana_datasource: | ||
name: datasource-alertmanager | ||
grafana_url: "{{ grafana_url }}" | ||
grafana_user: "{{ grafana_username }}" | ||
grafana_password: "{{ grafana_password }}" | ||
state: absent | ||
|
||
- debug: | ||
var: result | ||
|
||
- assert: | ||
that: | ||
- not result.changed |