Skip to content

Commit ed820b8

Browse files
committed
Add docker compose metrics setup
1 parent 947cb19 commit ed820b8

File tree

7 files changed

+106
-0
lines changed

7 files changed

+106
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ user_fee_token_deployer: 0x2AC5278D230f88B481bBE4A94751d7188ef48Ca2
124124

125125
While not a named account, 0x3f1eae7d46d88f08fc2f8ed27fcb2ab183eb2d0e is funded on all test chains.
126126

127+
## Metrics
128+
129+
To run the metrics stack (Prometheus + Grafana) read the instructions in the [metrics/README.md](metrics/README.md) file.
130+
127131
## Contact
128132

129133
Discord - [Arbitrum](https://discord.com/invite/5KE54JwyTs)

metrics/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Arbitrum Nitro Metrics
2+
3+
You can run this docker compose file it will run
4+
5+
- prometheus
6+
- grafana
7+
- setup the default dashboard
8+
9+
The default username/password is `admin`/`admin`.
10+
11+
## Run the metrics services
12+
13+
Simply start docker compose in this `metrics/` folder:
14+
15+
```sh
16+
docker compose up
17+
```
18+
19+
## Enable metrics on Nitro node
20+
21+
Don't forget to run the Nitro node with metrics exporting on, to do so add the following flags to your Nitro node startup command:
22+
23+
```sh
24+
--metrics --metrics-server.addr=0.0.0.0
25+
```
26+
27+
> ⚠️ Warning: Using 0.0.0.0 is recommended for cross-platform compatibility,
28+
especially when accessing metrics from Docker, Linux, WSL, or remote containers.
29+
30+
## View the Dashboard
31+
32+
View the dashboard at http://localhost:3000
33+
34+
## How to add more grafana dashboards
35+
36+
To add more grafana dashboards you can drop json files into the `grafana/dashboards/` folder.

metrics/compose.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
services:
2+
prometheus:
3+
image: prom/prometheus
4+
container_name: prometheus
5+
command:
6+
- '--config.file=/etc/prometheus/prometheus.yaml'
7+
restart: unless-stopped
8+
volumes:
9+
- ./prometheus:/etc/prometheus
10+
- prometheus_data:/prometheus
11+
ports:
12+
- 9090:9090
13+
extra_hosts:
14+
- "host.docker.internal:host-gateway"
15+
grafana:
16+
image: grafana/grafana
17+
container_name: grafana
18+
restart: unless-stopped
19+
volumes:
20+
- ./grafana/datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
21+
- ./grafana/dashboard.yaml:/etc/grafana/provisioning/dashboards/main.yaml
22+
- ./grafana/dashboards:/var/lib/grafana/dashboards
23+
ports:
24+
- 3000:3000
25+
extra_hosts:
26+
- "host.docker.internal:host-gateway"
27+
28+
volumes:
29+
prometheus_data:
30+
31+
networks: {}

metrics/grafana/dashboard.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: 1
2+
3+
providers:
4+
- name: "Offchain Labs"
5+
orgId: 1
6+
type: file
7+
disableDeletion: false
8+
updateIntervalSeconds: 10
9+
allowUiUpdates: false
10+
options:
11+
path: /var/lib/grafana/dashboards
12+
foldersFromFilesStructure: true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"annotations":{"list":[{"builtIn":1,"datasource":{"type":"grafana","uid":"-- Grafana --"},"enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations & Alerts","type":"dashboard"}]},"editable":true,"fiscalYearStartMonth":0,"graphTooltip":0,"id":0,"links":[],"panels":[{"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisBorderShow":false,"axisCenteredZero":false,"axisColorMode":"text","axisLabel":"","axisPlacement":"auto","barAlignment":0,"barWidthFactor":0.6,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"insertNulls":false,"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"type":"linear"},"showPoints":"auto","showValues":false,"spanNulls":false,"stacking":{"group":"A","mode":"none"},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"green","value":0},{"color":"red","value":80}]}},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"id":1,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom","showLegend":true},"tooltip":{"hideZeros":false,"mode":"single","sort":"none"}},"pluginVersion":"12.2.0","targets":[{"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},"editorMode":"builder","expr":"arb_block_transactions_count","legendFormat":"__auto","range":true,"refId":"A"}],"title":"Arb Block Transactions Count","type":"timeseries"}],"preload":false,"refresh":"5s","schemaVersion":42,"tags":[],"templating":{"list":[]},"time":{"from":"now-30m","to":"now"},"timepicker":{},"timezone":"browser","title":"Example dashboard","uid":"adq7lsl","version":2}

metrics/grafana/datasource.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: Prometheus
5+
type: prometheus
6+
url: http://host.docker.internal:9090
7+
isDefault: true
8+
access: proxy
9+
editable: true

metrics/prometheus/prometheus.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
global:
2+
scrape_interval: 4s
3+
scrape_timeout: 4s
4+
evaluation_interval: 10s
5+
6+
scrape_configs:
7+
- job_name: "nitro"
8+
metrics_path: /debug/metrics/prometheus
9+
static_configs:
10+
- targets:
11+
- host.docker.internal:6070
12+
labels:
13+
instance: local_node

0 commit comments

Comments
 (0)