Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ devnet/l1-geth/execution/geth/genesis.json
devnet/l1-geth/execution/geth
devnet/tmp
devnet/data
devnet/logs
devnet/saved-cannon-data
devnet/init.log
devnet/l1-geth/
Expand Down
7 changes: 5 additions & 2 deletions devnet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ services:
- "11113:1111" # outbound flashblocks ws port
- "30304:30303"
- "30304:30303/udp"
- "9002:9001" # metrics port

op-seq:
image: "${OP_STACK_IMAGE_TAG}"
Expand Down Expand Up @@ -485,6 +486,7 @@ services:
- "8128:8545"
- "30309:30303"
- "30309:30303/udp"
- "9003:9001" # metrics port

op-conductor:
image: "${OP_STACK_IMAGE_TAG}"
Expand Down Expand Up @@ -670,6 +672,7 @@ services:
- "30305:30303"
- "30305:30303/udp"
- "11112:1111" # outbound flashblocks ws port
- "9004:9001" # metrics port
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8545" ]
interval: 3s
Expand Down Expand Up @@ -987,7 +990,7 @@ services:
- --data-dir=/data

prometheus:
image: prom/prometheus:v2.47.0
image: prom/prometheus:main
container_name: prometheus
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
Expand All @@ -1000,7 +1003,7 @@ services:
- "9090:9090"

grafana:
image: grafana/grafana:10.1.0
image: grafana/grafana:main
container_name: grafana
volumes:
- ./data/grafana:/var/lib/grafana
Expand Down
3 changes: 2 additions & 1 deletion devnet/entrypoint/reth-rpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ CMD="op-reth node \
--txpool.basefee-max-count=100000 \
--txpool.max-pending-txns=100000 \
--txpool.max-new-txns=100000 \
--rpc.eth-proof-window=10000"
--rpc.eth-proof-window=10000 \
--metrics=0.0.0.0:9001"

# For flashblocks architecture. Enable flashblocks RPC
if [ "$FLASHBLOCK_ENABLED" = "true" ] && [ "$FLASHBLOCKS_RPC" = "true" ]; then
Expand Down
24 changes: 24 additions & 0 deletions devnet/monitoring/example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Prometheus Monitoring Configuration
# Copy this file to .env and update with the actual IP addresses

# =============================================================================
# GLOBAL SETTINGS
# =============================================================================
SCRAPE_INTERVAL=15s
EVALUATION_INTERVAL=15s

# =============================================================================
# SEQUENCER NODES
# Format: host:port (comma-separated for multiple nodes)
# =============================================================================

# Sequencer nodes - Add sequencer IPs here
SEQUENCER_NODES=op-reth-seq:9001,op-reth-seq2:9001

# =============================================================================
# RPC NODES
# Format: host:port (comma-separated for multiple nodes)
# =============================================================================

# RPC nodes - Add RPC IPs here
RPC_NODES=op-reth-rpc:9001,op-reth-rpc2:9001
85 changes: 85 additions & 0 deletions devnet/monitoring/generate_prometheus_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/bin/bash

# Script to generate prometheus.yml from .env configuration
# Usage: ./generate_prometheus_config.sh

set -e

ENV_FILE=".env"
OUTPUT_FILE="prometheus.yml"

# Check if .env file exists
if [ ! -f "$ENV_FILE" ]; then
echo "Error: .env file not found!"
echo "Please copy 'example.env' to '.env' and configure it:"
echo " cp example.env .env"
exit 1
fi

# Source the .env file
set -a
source "$ENV_FILE"
set +a

# Set defaults if not specified in .env
SCRAPE_INTERVAL=${SCRAPE_INTERVAL:-15s}
EVALUATION_INTERVAL=${EVALUATION_INTERVAL:-15s}

# Function to convert comma-separated list to YAML array
format_targets() {
local nodes="$1"
local output=""

# Split by comma and format each target
IFS=',' read -ra ADDR <<< "$nodes"
for addr in "${ADDR[@]}"; do
# Trim whitespace
addr=$(echo "$addr" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
if [ -n "$addr" ]; then
output+=" - '$addr'\n"
fi
done

echo -e "$output"
}

# Generate prometheus.yml content
cat > "$OUTPUT_FILE" << EOF
global:
scrape_interval: ${SCRAPE_INTERVAL}
evaluation_interval: ${EVALUATION_INTERVAL}

scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']

EOF

# Add sequencer nodes if defined
if [ -n "$SEQUENCER_NODES" ]; then
cat >> "$OUTPUT_FILE" << EOF
- job_name: 'sequencer-nodes'
static_configs:
- targets:
$(format_targets "$SEQUENCER_NODES")
labels:
node_type: 'sequencer'

EOF
fi

# Add RPC nodes if defined
if [ -n "$RPC_NODES" ]; then
cat >> "$OUTPUT_FILE" << EOF
- job_name: 'rpc-nodes'
static_configs:
- targets:
$(format_targets "$RPC_NODES")
labels:
node_type: 'rpc'

EOF
fi

echo "Generated prometheus.yml"
Loading