Commit Graph

101 Commits

Author SHA1 Message Date
Ian Wienand 72080f7136 Strip id/uid from .json input
As noted inline, a default export from Grafana includes the uid/id
which breaks when you re-import it into a different site.  Strip them.

Change-Id: I318614b33aed2ece93d44e832bad7907724cb1bc
2022-03-11 13:38:45 +11:00
Ian Wienand 2c3823432d Generate and use UID for acessing dashboards
We are relying on the "slug" field being the same as our "url
friendly" title that we create.  For whatever reason the slug field
was deprecated in Grafana v5.0, and now with v8.3.4 it has stopped
working.

We can turn the name/slug into a UID by hashing, and then use this in
the various API calls.

Change-Id: I13d3162c917e094684756e51836d12000621fefa
2022-01-25 10:59:28 +11:00
Ian Wienand 5f785f7782 Add import of json files
This simply takes any json files present and loads them into Grafana
directly.  The idea is that you can edit the dashboards using the
inbuilt editor, then copy the dashboard JSON and keep it externally
version controlled.  No parsing or validation is done on the JSON
files; we are assuming they have not been hand-modified from what
Grafana generates.

Change-Id: I38695aed2404f8b7fc350d949b7a9212498c35cb
2020-06-25 15:04:14 +10:00
Zuul 5b98241e36 Merge "Remove query variable refresh deprecation" 2020-06-25 04:00:47 +00:00
Ian Wienand 92ef419c01 Remove query variable refresh deprecation
Added with dd6582e9cc, we have found
that setting a bool here means the query variable no longer refreshes
at all.  Thus it's dangerous to accept it, force it to be an int.

For reference, the values seem to be

 0 = never refresh
 1 = on load
 2 = on timeseries change

Change-Id: Ia96f0166a80ece0b307acdca20eeca045a2e4a75
2020-06-24 20:36:09 +00:00
Ian Wienand 878b20898d Drop Python 2 support
This has bit-rotted as libraries have updated to Python 3 only.

Switch to hacking; some minor changes to regex-strings is all that is
required.

Drop py27 markers and move to Python 3 only.  Update requirements.

Depends-On: https://review.opendev.org/737666
Change-Id: Iabf201965129b3284166e1aedcb9f1c9d6109077
2020-06-24 11:52:23 +10:00
Andy Ladjadj 67f55d53d6 Add capability to use grafana folderid parameter
- retro-compatibility with default folder 'General' == 0
 - add to config file with folderid key in grafana section
 - add to cmd with --grafana-folderid

Change-Id: Iebfc5613f4c622d3d49d2f34df77ad3695f6b046
2019-02-26 21:25:37 +00:00
Ian Wienand e6c7095c6b Add valueMaps and rangeMaps support
These allow you to specify custom text instead of displayed values

Change-Id: I7e5c6067c0b0d26edc18120283bad30887df0663
2019-02-21 10:06:35 +11:00
William Huang 60a4c15c9b Add prometheus data source
Change-Id: Ia56aa4e8015eacf8e21f78d3aba7f9822515b364
2019-02-12 16:45:23 +08:00
Ian Wienand 5463ff095e Add tooltip sort
You can sort the tooltips in descending (1) or ascending (2) order.

Change-Id: I931419f832b6fd4a537431e34c099e5f2884d4c2
2018-09-14 16:21:25 +10:00
Quique Llorente 2ffded73e9 Add panel type 'row'
Change-Id: I47ea73eab779fa311d22a930acdc33ac2a9230f8
2018-07-11 08:53:04 +02:00
Zuul 2ff186cae7 Merge "Add 'database' to the datasource schema" 2018-07-10 17:04:21 +00:00
Quique Llorente e36f4ef99e Add adhoc template variables
Change-Id: I884d9d54dedaaab586fa3c2e8228f40a2bd39d79
2018-07-10 16:19:58 +02:00
Zuul 0969e906f3 Merge "Add transparent" 2018-07-03 00:15:42 +00:00
Ian Wienand c82c2b8ef7 Add alerts to graphs
Graphs can setup alerts.  Add a basic framework for them.

Change-Id: I6a80041eaaa03a3b3ff3e3de76401bbc77f42e96
2018-06-12 13:04:25 +10:00
Ian Wienand a5d14a2faf Add transparent
Graphs can have a "transparent" attribute to make them
... transparent.

Change-Id: I7772943b92a0c46bc8d7cd5ae7255f4de774bdcf
2018-06-08 15:31:22 +10:00
Enrique Llorente abbef4e6b5 Add 'database' to the datasource schema
The database option is supported by influxdb type
but missing in the schema

Change-Id: Id993a8e31e6df4d6374ecccd16dfb6c70ea54c45
2018-06-04 07:55:58 +02:00
Ian Wienand f02241f8de Test case for multiple targets with hidden
I was trying to figure out how to do multiple target calculations with
hidden targets.  I didn't see this explicitly tested for, so add it.

Change-Id: Ibbbb2810dd531e792f11c07946c21829fcdbe0a1
2018-06-04 15:53:39 +10:00
Eldad Marciano 2da2da1a9a Add datasource to template schema.
the following patch will allow us to use datasource type in template schema.

Change-Id: I15cce5f8f97d1837b94eaa7067d7ebe8e449f8f4
Signed-off-by: Eldad Marciano <emarcian@redhat.com>
2018-03-26 18:02:45 +03:00
Zuul e86eb350b3 Merge "Add Custom Template Type" 2018-03-20 21:01:16 +00:00
akrzos dd6582e9cc Add Custom Template Type
Allow custom templated vars.  Custom templated vars are similiar to
interval templated vars in that they have "options" however they can be
multi-selected vs just a singular selection as with an interval var.

Change-Id: Ic89c5d192f87890da950a9d2d5f9bc4a96a3e174
2018-03-16 12:44:22 +00:00
Zuul 8f729842b3 Merge "Add gauge caps for singlestat panel." 2018-03-15 02:56:39 +00:00
Eldad Marciano 08b4520efb Add gauge caps for singlestat panel.
Change-Id: Ic87e610cff0f2389464f8d744d7853a369939dc6
2018-03-12 19:03:01 +02:00
Eldad Marciano f1c684c1c2 Support formatting.
Adding format to schema base panel, in order to use graph unit e.g
bytes, precent, deckbytes etc.

Change-Id: I754596738970177bb70c5425d38e1291c56c84a9
2018-03-12 18:07:12 +02:00
Zuul ca98fba97f Merge "Add links to GrafYaml" 2018-02-16 20:09:40 +00:00
Zuul 9cf5fb52a9 Merge "Allow hidden templated vars" 2018-02-16 20:05:28 +00:00
Zuul 07e6ff97a2 Merge "Allow decimals to be specificed to limit decimals graphs" 2018-02-16 20:05:26 +00:00
akrzos af54eb4eb1 Allow repeating panels and to set minspan
This allows dashboards that expand a templated var to multi-graphs

Change-Id: I9b78958d836bbd4f73b06d6c302124857863c3d2
2018-02-16 09:50:37 -05:00
akrzos 2c68efbb69 Allow decimals to be specificed to limit decimals graphs
This allows graphs tool tips to be limited by a decimal count.
Also fix forgotten validation on decimals setting specific to legends.

Change-Id: I5840b0081dbb17ead0c49fa7d6d6ba1a2e82bb7c
2018-02-16 09:50:00 -05:00
akrzos caad52ae85 Allow hidden templated vars
Change-Id: Id74fe2a8a7b7156e045fd0b1d3f232ac05964f53
2018-02-16 09:49:35 -05:00
akrzos 89e71ad53d Add links to GrafYaml
Allow dashboards with links to be created.

Change-Id: Ie6e27808e465d98fd6694a60b31aa78b883e7ed3
2018-02-16 09:47:44 -05:00
akrzos 4711e038ae Allow dashboards to be tagged
Change-Id: Ie1a7db10726a9de924a2a8fe262d2c9550d42fd5
2018-02-09 10:04:02 -05:00
Zuul 1f7fcdd161 Merge "Add yaxes format for newer versions of Grafana" 2018-02-09 14:11:40 +00:00
akrzos f4b52386cc Add yaxes format for newer versions of Grafana
y_formats has moved to yaxes, but still support y_formats

Change-Id: Iabd1302352c77dc82c543412596e21550e4c0579
2018-02-08 09:15:09 -05:00
akrzos a53ce0ed3b Add support to change the default time filter range
Default is 6h it seems.  This change allows adjusting the default
to/from range in the time filter.

Change-Id: I567b9cc5cd8c753f852066c9e6868dd0f1b30b60
2018-02-07 20:23:07 -05:00
akrzos 2cee4f2908 Add Grafana URL and API Key to GrafYaml CLI
This will allow the use of GrafYaml called from Ansible without
deploying a GrafYaml config file.  With Ansible we can use the template
module to deploy a jinja2 templated GrafYaml dashboard for more
flexibility.

Change-Id: I61a7142c3177681681dcbfe5c889f4c3d59f8ec4
2018-01-15 09:17:05 -05:00
Zuul f56133eafc Merge "Add support for influxdb datasource" 2018-01-12 20:45:31 +00:00
akrzos 96cf8f97d4 Add legend for graphs
Simple support for a legend on graphs.

Change-Id: I3dc96a1463a8e765b9c97fa2fd1550872d7a285f
2018-01-09 11:33:48 -05:00
Tristan Cacqueray 1af7a4e010 Add support for influxdb datasource
Change-Id: I8d4b073cdc3fec4e55d10fac014874003d3739b6
2017-12-08 01:55:46 +00:00
Jenkins fccc26d53b Merge "Add datasource option to more elements" 2017-04-02 20:02:11 +00:00
Iswarya_Vakati 91180e0476 Removes unnecessary utf-8 encoding
This patches removes unnecessary utf-8 encoding in
doc/source/conf.py
grafana_dashboards/__init__.py
tests/base.py
tests/schema/base.py
tests/schema/fixtures/dashboard-0010.yaml
tests/schema/fixtures/dashboard-0011.yaml
tests/schema/fixtures/dashboard-0012.yaml

Change-Id: I75b80ee943b4da7381e124743386c3ea6eb4db42
2017-01-11 05:27:12 +00:00
Ye Na Rhee f89102bbf9 Add datasource option to more elements
This change adds support for datasource option to:
* graph panel
* singlestat panel
* templating

This enables the user to use other datasource than the default datasource
for graph/singlestat panels and templating. It is useful when more
than one datasource are available in Grafana.

Change-Id: I2e81a2dc4658c530bf82c4b349e2991dad348b01
2016-08-11 20:19:12 -04:00
Mathieu Gagné 0941f4e3b0 Add support for multiple config paths
Help messages mention support for multiple config paths separated by colons.
Yet this feature is not implemented. This change implements it.

Change-Id: Ieb99cba98c9cf775765eacd4ebadfbccfa815a65
2016-06-07 16:44:32 -04:00
Ye Na Rhee 3b01b4df7d Add support for time range
This commit adds the ability to configure the options in Time Range panel: time override, time shift and hide time override info.

Change-Id: I1d8c527ef1a377de6e34b94621f3060706356008
2016-04-20 21:18:54 +02:00
Ye Na Rhee a38798a292 Enable no fill in seriesOverrides
This allows fill to take the minimum value of 0.

Change-Id: I4c3a37fcfd6de24332ee05ca0d897e6d4973c525
2016-04-17 22:04:45 +02:00
James E. Blair ffa9e89794 Add support for interval template type
This performs some significant coercion because without it, the
interval template type, which should be very easy to use, would
require a substantial amount of yaml boilerplate.

Change-Id: I66ffe944af1b6794089dc536bfd99a1adf5d268e
2016-01-09 10:27:26 -08:00
Paul Belanger f95956b3e2 Add support for template query
A cool feature grafana has is the ability to template dashboards with
variables. This code now provides that ability to the user.

Change-Id: Ib2f565e3d39523105b2c07d29d5257494a8bae67
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2016-01-09 10:27:18 -08:00
James E. Blair 187caf92d7 Add support for seriesOverrides
Reference: https://github.com/grafana/grafana/blob/master/public/app/plugins/panels/graph/seriesOverridesCtrl.js#L94

Change-Id: I22743f566b32aaa5527237dd023551a8f3a3dbc4
2016-01-08 14:46:21 -08:00
James E. Blair cdc1df0e27 Add tooltip customization support
This is important for stacked graphs so that the tooltip can show
individual, rather than cumulative values (which makes the most
sense for our node graphs).

Also, sort the elements in the schema.  I think keeping them all
in order makes more sense than required/optional sections.

Change-Id: Ie542dc4d0e151a00e84cc970c2cfa8c02377d7bf
2016-01-07 14:15:47 -08:00
James E. Blair 36682378fc Add support for nullPointMode
Change-Id: Iedc5eec1ad06498a191b342cc70ce4424741e16f
2016-01-07 14:07:26 -08:00