Monitoring Juno 📊
Juno uses Prometheus to monitor and collect metrics data, which you can visualise with Grafana. You can use these insights to understand what is happening when Juno is running.
Enable the metrics server​
To enable the metrics server, use the following configuration options:
metrics
: Enables the Prometheus metrics endpoint on the default port (disabled by default).metrics-host
: The interface on which the Prometheus endpoint will listen for requests. If skipped, it defaults tolocalhost
.metrics-port
: The port on which the Prometheus endpoint will listen for requests. If skipped, it defaults to9090
.
# Docker container
docker run -d \
--name juno \
-p 9090:9090 \
nethermind/juno \
--metrics \
--metrics-port 9090 \
--metrics-host 0.0.0.0
# Standalone binary
./build/juno --metrics --metrics-port 9090 --metrics-host=0.0.0.0
Configure Grafana dashboard​
1. Set up Grafana​
- Follow the Set up Grafana guide to install Grafana.
- Download and configure the Grafana dashboard file.
2. Set up Prometheus​
- Follow the First steps with Prometheus guide to install Prometheus.
- Add the Juno metrics endpoint in the
prometheus.yml
configuration file:
prometheus.yml
scrape_configs:
- job_name: "juno"
static_configs:
- targets: ["localhost:9090"]
3. Set up Grafana Loki​
- Follow the Get started with Grafana Loki guide to install Loki.
- Configure Loki to collect logs from Juno. You might need to configure log paths or use Promtail (Loki's agent) to send logs to Loki:
Sample Loki Configuration
scrape_configs:
- job_name: "juno-logs"
labels:
job: "juno"
__path__: "/path/to/juno/logs/*"
tip
To have Juno write logs to a file, use the command:
./build/juno >> /path/juno.log 2>&1
4. Configure the data sources​
- Follow the Grafana data sources guide to add data sources.
- Choose Prometheus as a data source:
- Enter the URL where Prometheus is running, e.g.,
http://localhost:9090
. - Click the "Save & Test" button.
- Choose Loki as a data source:
- Enter the URL where Loki is running, e.g.,
http://localhost:3100
. - Click the "Save & Test" button.
Change log level in runtime​
In case you want to change the log level in runtime without the need to restart the juno process, you can do it via HTTP calls.
To enable this feature, use the following configuration options:
log-host
: The interface to listen for requests. Defaults tolocalhost
.log-port
: The port to listen for requests. REQUIRED
Examples:
# Start juno specifying the log port
juno --log-port=6789 --log-level=error ...
# Get current level
curl -X GET 'localhost:6789/log/level'
error
# Set level
curl -X PUT 'localhost:6789/log/level?level=trace'
Replaced log level with 'trace' successfully
# Get new level
curl -X GET 'localhost:6789/log/level'
trace