Setting up a Grafana Dashboard for your Layer Node
The goal of this guide is to help other node operators set up a grafana dashboard that monitors things in Layer such as average gas price for submitting a report, block times, total bonded tokens, and
Navigate to your node’s home config folder and use your text editor of choice to edit config.toml
Adjust the "Instrumentation Configuration Options" by setting
prometheus = true
. If port 26660 is unavailable, modify theprometheus_listen_addr
field as
Open up app.toml and find the “Telemetry Configuration” section
Set enabled to true, Set the prometheus_retention_time field to 60, and define a global label for the chain id.
Restart your node so that these changes can be applied
Install and set up a Prometheus server on the same machine or a different one
I used these docs to set mine up, but there is tons of documentation for setting up a prometheus server.
Configure prometheus.yml to scrape your node for metrics
Set Global Labels at the top of the file with the following
values: scrape_interval: 5s
,evaluation_interval: 10s
, andscrape_timeout: 4s
When setting up the scrape_config section set the scrape_interval to 5s, set your node IP address pointing to the port you set in step 1, and then add a params section where you will need to add
format: [‘prometheus’]
in order for grafana to be able to use the data.
Start your prometheus server
We are now ready to start setting up the grafana dashboard so you will need to either use grafana cloud or you can do what I did and host it yourself (here are some good docs for hosting your own grafana server)
Once you have your grafana server set up navigate to its front end and add your prometheus server as a data source.
Click “Add new connection” in the “Connections” section of the side bar
Use the search bar to find the “prometheus” data source
Set the prometheus server URL to your prometheus server (Ex: http://{IP_ADDRESS}:9090)
Adjust the internal behavior section to set the
scrape_interval
field to 15s and thequery_timeout
field to 60sClick “Save and test” at the bottom to verify it is working and save it for you to be able to use in your dashboard.
Go to the Dashboards page and click the new button and then select to import a dashboard and then use this json file.
After the dashboard loads you will notice a lot of errors and that is expected. You will need to set up the panels to use the datasource that you just created.
To set the data source of a panel click on the 3 vertical dots in the upper right hand corner of the panel and then select edit. Once you do that just select your data source from the drop down and click “Run queries” to verify that it works and then save the dashboard.
You will most likely need to do this for each panel or once you figure out one you may be able to edit the dashboard json directly to add the right data source uid to each panel.
Once you have the data sources set up for everything you are good to go and are free to change anything and use any tool that grafana offers. And if you set up anything cool on your dashboard and want to share feel free to come to our discord to share it with other validators.
Last updated