跳到主要内容
版本:v0.21

Grafana

When first visiting Grafana, you will be provided with a sample dashboard with some basic charts setup from the database.

Contents

SectionLink
Logging InView Section
Viewing All DashboardsView Section
Customizing a DashboardView Section
Dashboard SettingsView Section
Provisioning a DashboardView Section
Troubleshooting DB ConnectionView Section

Logging In

Once the app is up and running, visit http://localhost:3002 to view the Grafana dashboard.

Default login credentials are:

  • Username: admin
  • Password: admin

Viewing All Dashboards

To see all dashboards created in Grafana visit /dashboards

Or, use the sidebar and click on Manage:

Screen Shot 2021-08-06 at 11 27 08 AM

Importing a Dashboard

If you want to import a dashboard to Grafana which you have backed up earlier, please follow the steps below:

  1. Click the Import icon
  2. Click the Upload JSON file button
  3. If the dashboard conflicts with an existing one, please change the Name and uid
  4. Click Import

grafana-sections

Customizing a Dashboard

When viewing a dashboard, click the top bar of a panel, and go to edit

Screen Shot 2021-08-06 at 11 35 36 AM

Edit Dashboard Panel Page:

grafana-sections

1. Preview Area

  • Top Left is the variable select area (custom dashboard variables, used for switching projects, or grouping data)
  • Top Right we have a toolbar with some buttons related to the display of the data:
    • View data results in a table
    • Time range selector
    • Refresh data button
  • The Main Area will display the chart and should update in real time

Note: Data should refresh automatically, but may require a refresh using the button in some cases

2. Query Builder

Here we form the SQL query to pull data into our chart, from our database

  • Ensure the Data Source is the correct database

    Screen Shot 2021-08-06 at 10 14 22 AM

  • Select Format as Table, and Edit SQL buttons to write/edit queries as SQL

    Screen Shot 2021-08-06 at 10 17 52 AM

  • The Main Area is where the queries are written, and in the top right is the Query Inspector button (to inspect returned data)

    Screen Shot 2021-08-06 at 10 18 23 AM

3. Main Panel Toolbar

In the top right of the window are buttons for:

  • Dashboard settings (regarding entire dashboard)
  • Save/apply changes (to specific panel)

4. Grafana Parameter Sidebar

  • Change chart style (bar/line/pie chart etc)
  • Edit legends, chart parameters
  • Modify chart styling
  • Other Grafana specific settings

Dashboard Settings

When viewing a dashboard click on the settings icon to view dashboard settings. Here are 2 important sections to use:

Screen Shot 2021-08-06 at 1 51 14 PM

  • Variables

    • Create variables to use throughout the dashboard panels, that are also built on SQL queries

    Screen Shot 2021-08-06 at 2 02 40 PM

  • JSON Model

    • Copy json code here and save it to a new file in /grafana/dashboards/ with a unique name in the lake repo. This will allow us to persist dashboards when we load the app

    Screen Shot 2021-08-06 at 2 02 52 PM

Provisioning a Dashboard

To save a dashboard in the lake repo and load it:

  1. Create a dashboard in browser (visit /dashboard/new, or use sidebar)
  2. Save dashboard (in top right of screen)
  3. Go to dashboard settings (in top right of screen)
  4. Click on JSON Model in sidebar
  5. Copy code into a new .json file in /grafana/dashboards

Troubleshooting DB Connection

To ensure we have properly connected our database to the data source in Grafana, check database settings in ./grafana/datasources/datasource.yml, specifically:

  • database
  • user
  • secureJsonData/password

Troubleshooting

If you run into any problem, please check the Troubleshooting or create an issue