Commit Graph

28 Commits

Author SHA1 Message Date
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
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
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
Paul Belanger 2c92819451 Add datasource support
We now support the ability to create a datasource using yaml files.

Change-Id: I1db38ac25bc309398924c15635ea5dee4eaf264c
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-11-03 12:36:59 -05:00
Paul Belanger bec5312d99 Fix bug when passing url and key into grafana
Sadly, our unit tests missed this. Since we didn't actually test the
contents of the values.  We have now fixed that with some unit tests.

Change-Id: Ida72768b51cb579fedb740f54d6f764e14f9d3d0
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-23 17:22:03 -04:00
Jenkins f0c47663f2 Merge "Use null backend when cache is disabled" 2015-10-23 14:46:25 +00:00
Jenkins 4f89516bf0 Merge "Create default configuration" 2015-10-23 14:42:39 +00:00
Paul Belanger af5f511cf5 Use null backend when cache is disabled
Rather then hacking up our cache object while using a file backend, we
can simply ask dogpile.cache to use a null backend. This way we keep
things simple.

Change-Id: Ibf34c4e26652629c3ee589fdcdd65188792aafef
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-22 20:12:55 -04:00
Paul Belanger 1bb25348e9 Create default configuration
Here we are creating a simple wrapper object to ConfigParser for the
purpose of simplifying our configuration. Now, we have a single
location to control our configuration defaults.

Change-Id: Ie49938b1eec183055bb8d462d70bcdfb733b360b
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-22 18:28:00 -04:00
Paul Belanger fd76590e4b Add delete command to CLI
Add the ability to delete dashboards based on the provided yaml file.
We also removed the assert_dashboard_exists function, as it didn't
really save us code.

Change-Id: I417a72fcc5252b36cadfe8881b4f5ca6acb7c753
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-16 11:33:32 -04:00
Paul Belanger 3a32d511bb Rework grafana object for future functionality
Currently we only support dashboards for Grafana, this is about to
change. For example, we also need to add the ability to create
datasources and even users. Here we are breaking out the logic into
more specific functions.

Additionaly, this helps when we eventually break out this code into
python-grafana.

Change-Id: I10a618adbf9052c8dccda38fefb7abf3a148d3b6
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-09 14:00:28 -04:00
Paul Belanger 4e643e5d06 Replace oslo_config dependency with argparse
This is for the same reasoning as oslo_log. We don't want to depending
on OpenStack libraries.

Change-Id: I34e66af578d3f4b5ac5e710554aad91524285816
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-09 10:12:57 -04:00
Paul Belanger 3a66817727 Replace oslo_log dependency with standard logging
When I first started grafyaml, I wanted to better understand how
existing OpenStack libraries worked. So, with that in mind, I choose
oslo_log as the logging class for this program.  However, now that we
have imported it under openstack-infra, we don't really want to depend
on OpenStack libraries, incase there is a breakage.  The main reason
for this, if OpenStack libraries break, we still want the
infrastructure to work so we can fix the problem.

Change-Id: Iee9b1d9d9abb4da4d285531b64a7e2505240be12
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-06 09:15:20 -04:00
Paul Belanger 073d7c6806 Add some verbose message for validate / update commands
When you run grafana-dashboards, it currently lacks some basic
information what it is actually doing.  So, start building out some
logging to help others who decide to run the command.

Change-Id: I27b0c444139c5772b29ae3bd2c9550c6567dd4d6
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-05 14:22:41 -04:00
Jenkins 82e48fdf08 Merge "Make sure dashboard exists after we create it" 2015-10-03 19:17:40 +00:00
Paul Belanger 30f7d21f3f Make sure dashboard exists after we create it
The long term goal here is to eventually create python-grafana from
our embedded grafana.py file. So, most of this code just makes the
Grafana object more user friendly.

However, we've also added some validation around create_dashboard, we
added some checks before we create and after. To ensure we actually
created our new dashboards.

Finally, add some sphinx docs since everybody loves documentation.

Change-Id: Icbba403afe5208fbef1855118d4c3f4293461e00
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-02 13:42:35 -04:00
Paul Belanger 609733c116 Add the ability to parse directories
Change-Id: I0ff6c803608d91e04b8e40750265157d3f4f7530
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-01 13:36:58 -04:00
Paul Belanger f4b18fdd74 Add validate command
Like JJB, Zuul and Nodepool, we need to have a CLI command to validate
our configuration files.

Change-Id: I4ccac21a2d77917667e1e844ab9ee1f1f281ea9f
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-01 09:59:21 -04:00
Paul Belanger 103a882cbf Add caching support
Like we do with JJB, we create a md5sum of the dashboard then cache
it.  This is a simple way to determine if a yaml file has changed.

Change-Id: If7b80b84c5bbcb0d30b0325bae6b8e726bb2f41b
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-29 11:34:31 -04:00
Paul Belanger 42ef61dde0 Add a slug to better track dashboards
Currently grafana will generate a slug based on the title name. For
now, we can use an existing python library to do this.  Ideally, we'll
need to make sure the slugs generated between both are kept in sync.

How hard can that be?

Also move our validation logic into parser.py, since they are closely
related.

Change-Id: Id43f51d3f9db9131c25a8130f957572344a7d8f1
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-28 10:15:10 -04:00
Paul Belanger 8029107fc8 The apikey is now optional
Grafana 2.1.0 added basic auth support. With that in mind, the api key
is now optional.

Change-Id: Ie186fa9ce48ca4ae222f75345e9b660f5ffa2909
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-23 14:55:34 -04:00
Paul Belanger 9030cad526 Move yaml functions into its own class
This will centeralize our overlapping yaml code paths.

Change-Id: Ib8bc0fc93b49363cb511d9891a24ea48fdee136d
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-06-17 13:34:28 -04:00
Paul Belanger 14f812543a Fix typo with grafana config object
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-05-07 12:08:00 -04:00
Paul Belanger d6063d84e4 Create grafana section for configuration
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-05-06 16:45:17 -04:00
Paul Belanger b81f524829 Add support for rows
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-05-06 15:15:29 -04:00
Paul Belanger 628d7f5b7a Add dashboard validation
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-05-06 13:45:26 -04:00
Paul Belanger 210033302d Break out grafana class into own file
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-05-06 13:29:45 -04:00
Paul Belanger e117767f9b Add grafana-dashboards cli client
This is the first attempt at the CLI client.  Right now, we just support the
update function, which will blindly create a dashboard in grafana with ZERO
validation.  Additionally, we blindly override any existing dashboard that has
been created.

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-05-06 13:02:55 -04:00