From 60a4c15c9ba3a240ad5d43a27450577aa2a644bf Mon Sep 17 00:00:00 2001 From: William Huang Date: Tue, 12 Feb 2019 16:41:30 +0800 Subject: [PATCH] Add prometheus data source Change-Id: Ia56aa4e8015eacf8e21f78d3aba7f9822515b364 --- grafana_dashboards/schema/datasource.py | 3 ++- tests/schema/fixtures/datasource-0003.json | 11 +++++++++++ tests/schema/fixtures/datasource-0003.yaml | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/schema/fixtures/datasource-0003.json create mode 100644 tests/schema/fixtures/datasource-0003.yaml diff --git a/grafana_dashboards/schema/datasource.py b/grafana_dashboards/schema/datasource.py index 0368d68..c7f6a91 100644 --- a/grafana_dashboards/schema/datasource.py +++ b/grafana_dashboards/schema/datasource.py @@ -23,7 +23,8 @@ class Datasource(object): v.Required('isDefault', default=False): v.All(bool), v.Required('name'): v.All(str, v.Length(min=1)), v.Required('type', default='graphite'): v.Any('graphite', - 'influxdb'), + 'influxdb', + 'prometheus'), v.Required('url'): v.All(str, v.Length(min=1)), v.Optional('orgId'): int, v.Optional('database'): v.All(str, v.Length(min=1)), diff --git a/tests/schema/fixtures/datasource-0003.json b/tests/schema/fixtures/datasource-0003.json new file mode 100644 index 0000000..67024d5 --- /dev/null +++ b/tests/schema/fixtures/datasource-0003.json @@ -0,0 +1,11 @@ +{ + "datasource": { + "new-prometheus-datasource": { + "access": "proxy", + "isDefault": false, + "name": "New prometheus datasource", + "type": "prometheus", + "url": "http://example.org:9090" + } + } +} diff --git a/tests/schema/fixtures/datasource-0003.yaml b/tests/schema/fixtures/datasource-0003.yaml new file mode 100644 index 0000000..0ac783c --- /dev/null +++ b/tests/schema/fixtures/datasource-0003.yaml @@ -0,0 +1,5 @@ +datasource: + name: New prometheus datasource + url: http://example.org:9090 + access: proxy + type: prometheus