Setting up local monitoring¶
Trinity comes with a system that allows a wide range of metrics to be recorded at runtime to be written to an InfluxDB database. The data can be visualized in different ways but we chose Grafana to visualize the data through various charts.
Although the Trinity team maintains its own central metrics infrastructure, everyone can setup their own local InfluxDB and Grafana instances to work with the metrics system and display results.
This guide is only intended to setup a local development system. It may not follow best practices for production systems.
First, follow the official documentation to install InfluxDB.
Then point the InfluxDB service to its configuration file with
influxd -config [Path to config file], in our case that is
Once that is done, we start the service and check that it is running.
The specific commands differ for various operating systems but can be found in the official documentation
The default port for using InfluxDB is
Make the following modifications to the config file in
At the top, we uncomment
reporting-disabled = false and set it to
Under “http”, we uncomment
enabled = true,
bind-address = ":8086" and
auth-enabled = false and set it to
Save the changes and exit.
Once the InfluxDB service is running, we can open the Influx CLI using the
inside our terminal. We can leave the Influx CLI by executing
Enter the Influx CLI to create a new database using
create database trinity.
While Trinity supports any database and user name via the parameters
--metrics-influx-database, we can save us these configurations
if we choose the name
trinity for both the user and the database.
show databases to confirm the database was created successfully.
Now that we have a database, we need to add a users to it. First we have to select the database
that we want to add the user to. This can be done via the
use [db-name] command,
in our case. After we specified which database to add users to, we run
CREATE USER "trinity" WITH PASSWORD 'trinity' WITH ALL PRIVILEGES.
We can also create a regular user with
CREATE USER "user" WITH PASSWORD '12345'.
To check whether our changes have been applied correctly, we can use
show users command.
For the changes to be applied to the current running service, we need to restart it using
service influxdb restart inside the regular terminal.
Next, we follow the official documentation to install Grafana.
After the installation is done, we start the service and check that it is running.
The specific commands differ for various operating systems but can be found in the
official documentation (e.g. it is
sudo systemctl start grafana-server and
sudo systemctl start influxd on Linux).
If Grafana is running correctly, we can go to http://localhost:3000. For the first login we use “admin” as username and “admin” as password. It is recommended to change these credentials after the first login.
Add Datasource to Grafana¶
Now that Grafana is running, we still need to connect our previously installed InfluxDB to it.
We can do this by clicking on the “Create a data source” icon in the home screen at
The parameters are:
- NAME: InfluxDB Trinity
- HTTP URL: http://localhost:8086
- ACCESS: SERVER(default)
- Check: Basic Auth
- Basic Auth Details: input User name + password, in our case “trinity” and “trinity”
- Database: trinity
- User: trinity
- Password: trinity
We confirm our inputs by clicking “Save & Test” Button.
Start monitoring with Trinity¶
To start monitoring our data, we have to use several flags when starting up Trinity:
trinity --enable-metrics --metrics-host "test" --metrics-influx-server "localhost" --metrics-influx-password "trinity" --metrics-influx-protocol http --metrics-influx-port 8086
Let us go through all those flags one by one:
trinityis the basic command to start the client.
--enable-metricsenables the collection of metrics
--metrics-host boot-node-asia-1tags each metrics with a host label such as
boot-node-asia-1. This allows us to filter the dashboard in Grafana by the host machine that produced the data
--metrics-influx-server localhostthe host where the InfluxDB is running.
--metrics-influx-password trinitythe password that is used to access InfluxDB
--metrics-influx-protocolthe protocol to access the InfluxDB can either be
https. We use
httpin our development environment.
--metrics-influx-port 8086The port being used to access the InfluxDB
If everything went right so far, at this point data should get fed into the InfluxDB and we can visualize them on Grafana dashboards.
Will follow soon!