grafcli icon indicating copy to clipboard operation
grafcli copied to clipboard

Grafana 5.0 support

Open tunasalat opened this issue 6 years ago • 14 comments

Since grafana 5 release, rows have become deprecated: https://github.com/grafana/grafana/blob/master/CHANGELOG.md#new-dashboard-grid So, grafcli crashes:

[/remote/host.example.com]> cd dashboard/
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/climb/core.py", line 56, in run
    result = self.execute(*shlex.split(command))
  File "/usr/local/lib/python3.5/dist-packages/climb/core.py", line 79, in execute
    return self._commands.execute(command, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/climb/commands.py", line 26, in execute
    return method(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/grafcli/commands.py", line 40, in cd
    self._resources.list(path)
  File "/usr/local/lib/python3.5/dist-packages/grafcli/resources/resources.py", line 38, in list
    return manager.list(*parts)
  File "/usr/local/lib/python3.5/dist-packages/grafcli/resources/common.py", line 13, in list
    dashboard = self.get(dashboard_name)
  File "/usr/local/lib/python3.5/dist-packages/grafcli/resources/common.py", line 33, in get
    dashboard = self._storage.get(dashboard_name)
  File "/usr/local/lib/python3.5/dist-packages/grafcli/storage/sql.py", line 68, in get
    return Dashboard(source, dashboard_id)
  File "/usr/local/lib/python3.5/dist-packages/grafcli/documents.py", line 95, in __init__
    self._load(source)
  File "/usr/local/lib/python3.5/dist-packages/grafcli/documents.py", line 101, in _load
    for row in source['rows']:
KeyError: 'rows'

Any plans to implement 5.0 support?

tunasalat avatar Mar 13 '18 15:03 tunasalat

So I've started playing with this and due to some decisions in the grafcli design it turned out into kinda hackish solution.

I've added basic support for rowless dashboard on a new branch: experimental-v5 This will need some testing.

I'm also thinking about re-designing the core code soon with new API in mind.

m110 avatar Apr 19 '18 18:04 m110

@m110 First test, just to edit a dashboard with the vim command, was successful here.

towolf avatar Jun 01 '18 17:06 towolf

It has been almost a year. Still not working with 5.x although Grafana 6.x has already been released. Should this project be declared dead then?

akamensky avatar Mar 05 '19 01:03 akamensky

Tried to use this tool to backup all dashboards, but ran into this issue

sdiepend avatar Mar 12 '19 09:03 sdiepend

I'm currently working on a new release with support for 5.0/6.0. This will come with some major changes, as Grafana evolved since the first version of grafcli.

I will be dropping support for database backends, using only the REST API. There are no "rows" now (well, row is just a type of a panel) and folders were added, so the CLI commands will look a bit different. I'd also like to add support for managing datasources.

m110 avatar Mar 20 '19 22:03 m110

Would be really cool to get an update :+1:

mfuhrmann avatar May 06 '19 14:05 mfuhrmann

Any updates?

jorandirkzwager avatar May 17 '19 10:05 jorandirkzwager

I should be able to update the branch with a working version next week. Sorry it takes so long.

m110 avatar May 17 '19 10:05 m110

Take your time, it's probably all doen in you spare time so...

sdiepend avatar May 17 '19 11:05 sdiepend

I got this error too. So, I was switched to another tool (php based). Its much more primitive, but it works with Grafana 6 :) https://github.com/wnasich/grafana_dd

zhil avatar Jul 16 '19 18:07 zhil

@m110 was this problem resolved? I met a similar problem, thanks.

zhangxingdeppon avatar Nov 22 '19 06:11 zhangxingdeppon

Trying to use the backup command and hit the same issue

aronneagu avatar Nov 29 '19 16:11 aronneagu

Thank you for your work on this. Is this project still active? I was hoping to get backup support for later versions of Grafana.

hanej avatar Mar 15 '21 17:03 hanej

I found this project that seems to work well. I really like grafcli but the immediate need is to get this backed up on a daily basis.

https://github.com/ysde/grafana-backup-tool

hanej avatar Mar 15 '21 17:03 hanej