This directory contains a sample that is fully contained. It will create a demo01 grafana system on host port 4400 that reads data from the associated database.
The purpose is to show how to create an environment from scratch and then
modify it. In the sample the modification comes from the grafana.json
file but in an interactive environment you would mostly likely make all
of the changes in grafana itself, save them in grafana and then use the
grape
tool to save them to a zip file that can later be used to load
into another system.
To run the demo:
$ ./run.sh
When the run has completed, you will be able navigate to http://localhost:4400 to see the newly created dashboard. It looks like this:
Enter username admin
and password admin
and click Log In
to log in.
You will then be directed to a page that asks you to change the password. Go ahead and skip it by clicking on the Skip
button.
At this point you will be in Grafana. Hover your mouse over the Dashboard
icon and a menu will pop up with a Manage
option.
Click on that.
The Manage
screen will down the Demo01 Folder
. Click on it to see the associated dashboards.
You will now see the dashboard Demo01 Dashboard
. Click on it.
At this point you are in the newly created dashboard:
Although it looks really simple, this demo shows an automatically generated dashboard that connects to the automatically generated database and displays its contents.
From here you can play around. You can add additional tables and data to the database. You can create new panels, folders and dashboards.
Here is how you can access the database in the docker container using psql
.
$ docker exec -it demo01pg psql -U postgres -d postgres
psql (12.3 (Debian 12.3-1.pgdg100+1))
Type "help" for help.
postgres=# \d
List of relations
Schema | Name | Type | Owner
--------+--------+-------+----------
public | demo01 | table | postgres
(1 row)
postgres=# \dS+ demo01
Table "public.demo01"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+------+-----------+----------+---------+----------+--------------+--------------------
name | text | | not null | | extended | | A unique key name.
value | text | | not null | | extended | | A key value.
Indexes:
"demo01_name_key" UNIQUE CONSTRAINT, btree (name)
Access method: heap
postgres=# select * from demo01;
name | value
-------+-----------
title | Demo01
color | darkgreen
(2 rows)
postgres=# \q
Note that the grafana.json
file was originally created by manually developing
the dashboard and saving it in grafana and then running the grape
save command to create a local zip file where it was extracted from
the gr.json
file and copied to grafana.json
.