wiki:jazz/17-08-16

Version 6 (modified by jazz, 7 years ago) (diff)

--

2017-08-16

Grafana

  • Grafana 雖然有提供很多 Dashboard Template 可以匯入,但能否自動化呢?
  • 測試了一下,預設 Grafana 如果用的是 SQLite,就可以試試看把 Data Source 跟 Dashboard 直接寫進 SQLite
    ~/grafana-4.4.3/data$ file grafana.db 
    grafana.db: SQLite 3.x database
    ~/grafana-4.4.3/data$ sqlite3 grafana.db 
    SQLite version 3.8.7.1 2014-10-29 13:59:56
    Enter ".help" for usage hints.
    sqlite> .tables
    alert               dashboard_tag       playlist            star              
    alert_notification  dashboard_version   playlist_item       temp_user         
    annotation          data_source         plugin_setting      test_data         
    api_key             migration_log       preferences         user              
    dashboard           org                 quota             
    dashboard_snapshot  org_user            session
    sqlite> select * from data_source;
    1|1|1|prometheus|Prometheus|direct|http://xyz.abc.com:9090||||0|||1|{}|2017-08-16 08:19:05|2017-08-16 08:19:08|0|{}
    sqlite> select * from dashboard;
    3|2|node-stats|Node Stats|{"annotations":{"list":[]},"description":"Dashboard to view multiple servers","editable":true,"gnetId":405,"gr ... 略 ...
    
  • 當然正解應該是使用 Grafana 的 REST API