目录

grafana5 dashboard备份与恢复

参考资料

1
2
3
4
https://blog.dictvm.org/export-all-grafana-graphs/
https://github.com/m110/grafcli#usage
https://gist.github.com/jaimegago/11229750
https://utkarshcmu.github.io/wizzy-site/home/

安装grafcli

pip3 install grafcli

配置文件

cat /etc/grafcli/grafcli.conf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
[grafcli]
editor = vim
mergetool = vimdiff
history = ~/.grafcli_history
verbose = off
force = on
colorize = on

[resources]
data-dir = ~/.grafcli

[hosts]
localhost = on

[localhost]
type = api
url = http://127.0.0.1:3000/api
user = admin
password = passwd

进入grafcli命令窗口 

1
2
3
4
5
6
7
8
# grafcli
[/]> ls remote
localhost
[/]> backup remote/localhost ./backup20180713.tgz  #备份
[/]> restore /grafanaback/backup20180713.tgz remote/localhost  #恢复是restore 
[/]> exit 
# ll
 -rw-------. 1 root root 22190 Jul 13 16:16 backup20180713.tgz