README ¶
Monitoring QNG with InfluxDB and Grafana
This tutorial will help you set up monitoring methods for QNG nodes to better understand their performance and identify potential issues.
Set INFLUXDB
- Firstly, download and install InfluxDB. Influxdata download page Multiple download options available.(note:Must be InfluxDB 1.x Open Source)
- After successfully installing InfluxDB, ensure that it runs in the background. By default, it can be accessed through localhost:8086. Before using the Linux client, you must create a new user with administrator privileges. This user will perform advanced management, creating databases and users.
influxdb
curl -XPOST "http://localhost:8086/query" --data-urlencode "q=CREATE USER yourname WITH PASSWORD 'yourpassword' WITH ALL PRIVILEGES"
- Now, you can use this user's identity to enter the InfluxDB command line through the Linux client。
influx -username 'yourname' -password 'yourpassword'
- You can directly communicate with InfluxDB through its command line to create databases and users for the QNG indicator
create database qng
create user test with password 'test'
- Verify the created entries as follows:
show databases
show users
- Exit the InfluxDB command line.
exit
- InfluxDB is operating and configured to store metrics from QNG.
Prepare for QNG
After setting up the database, we need to enable indicator collection in QNG. In this example, we want QNG to push the data to InfluxDB. The basic settings specify the endpoint through which to access InfluxDB and perform database authentication.
./qng --metrics --evmenv="--metrics.influxdb"
This tag can be attached to the command to start the client or saved to a configuration file. You can verify whether QNG successfully pushed the data by listing metrics in the database. On the InfluxDB command line:
use qng
show measurements
Set GRAFANA
The next step is to install Grafana, which interprets the data through graphics. Follow the installation process in the Grafana documentation for your installation environment. If you do not want to install other versions, make sure to install the OSS version Download Grafana OSS. The following are sample installation steps for installing a distribution version through the resource library:
brew update
brew install grafana
brew services restart grafana
After Grafana starts running, it should be able to access it at localhost:3000. Use your preferred browser to access this path, and then log in with default credentials (user: admin and password: admin). When prompted, change the default password and save it.
You will be redirected to the Grafana homepage. First, set up your source data. Click on the configuration icon in the left column and select 'Data sources'.
No data source has been created yet. Click on 'Add data source' to define a data source
In this setup, please select 'InfluxDB' and continue with the operation
If you run the tool on the same machine, the data source configuration is quite simple. You need to set the InfluxDB address and detailed information to access the database. Please refer to the following figure.
If all operations have been completed and InfluxDB can be accessed, please click on "Save and test" and wait for the confirmation message to pop up.
Now Grafana is set to read data from InfluxDB. At this point, you need to create a dashboard that interprets and displays data. Dashboard attributes are encoded in JSON files, allowing anyone to create and easily import them. On the left column, click on "Import".
- Please use
QNG_Dashboard_grafana.json
in the same directory