Grafana dashboard

From wikiluntti

Introduction


Grafana is a open source analytics application. It can produce charts, graphs, and alerts for the web when connected to supported data sources.

Running Grafana

  1. Start Grafana server (grafana-server.exe). My installation is at C:\Program Files\GrafanaLabs\grafana\bin
  2. Use web browser to go to http://localhost:3000/login
    • Default name and pwd is admin
  3. Create a data source. Connections -> Data sources. Enter Infinity
    • However, the plugin needs to be installed first: grafana-cli plugins install yesoreyeram-infinity-datasource. The permission of the folders have to be changed. Perhaps should allow all. Then restart grafana by:
      1. Open the Services app.
      2. Right-click on the Grafana service.
      3. In the context menu, click Restart.
  4. Create a dashboard
  5. Add visualization. Add the yesoreyeram-infinity-datasource data source
  6. Map is actually Geomap.

Examples

CSV Data

GIS

Geomap

JSON data

Need to have stream of JSON

The following array works, but there is the problem with brackets.

[{
  "name": "John",
  "age": 30,
  "city": "New York"
},
{
  "name": "Jussi",
  "age": 32,
  "city": "New York C"
}]

Window functions

https://community.grafana.com/t/grafana-v11-0-0-why-windows-function-mode-is-missing-in-data-transformation-menu/129571

Regression analysis

Logs from Serial port

Use PuTTY and save (stream) logs to a file. Works like a charm. The notepad++ can be set to update automatically without asking (Ctrl-R reloads the file) by using Settings -> Preferences -> MISC. -> Update silently, but it still need Ctrl-R to reload the file.

However, Grafana cannot update a local file. Instead use a web server (eg nginx) to serve the CSV files over http and then use http url (eg http://localhost/my-csv-app/my-csv-file.csv).

NGinx

See https://medium.com/@jasonrigden/how-to-host-a-static-website-with-nginx-8b2dd0c5b301

  • Download, run
    • start nginx and check with tasklist.exe. It should show two nginx instances. One of the processes is the master process and another is the worker process.
  • Goto address http://localhost/ and the file location is at nginx -> html.
  • Check config.
    • nginx.conf is important. See location which states that root is html.