launch_local_testnet.sh: get the metrics out with "--grafana"
This commit is contained in:
parent
846f21a96a
commit
fa663be029
|
@ -24,7 +24,7 @@ if [ ${PIPESTATUS[0]} != 4 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OPTS="ht:n:d:"
|
OPTS="ht:n:d:"
|
||||||
LONGOPTS="help,testnet:,nodes:,data-dir:,disable-htop,log-level:"
|
LONGOPTS="help,testnet:,nodes:,data-dir:,disable-htop,log-level:,grafana"
|
||||||
|
|
||||||
# default values
|
# default values
|
||||||
TESTNET="1"
|
TESTNET="1"
|
||||||
|
@ -32,6 +32,7 @@ NUM_NODES="10"
|
||||||
DATA_DIR="local_testnet_data"
|
DATA_DIR="local_testnet_data"
|
||||||
USE_HTOP="1"
|
USE_HTOP="1"
|
||||||
LOG_LEVEL="DEBUG"
|
LOG_LEVEL="DEBUG"
|
||||||
|
ENABLE_GRAFANA="0"
|
||||||
|
|
||||||
print_help() {
|
print_help() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
@ -46,6 +47,7 @@ CI run: $(basename $0) --disable-htop -- --verify-finalization --stop-at-epoch=5
|
||||||
(default: "${DATA_DIR}")
|
(default: "${DATA_DIR}")
|
||||||
--disable-htop don't use "htop" to see the beacon_node processes
|
--disable-htop don't use "htop" to see the beacon_node processes
|
||||||
--log-level set the log level (default: ${LOG_LEVEL})
|
--log-level set the log level (default: ${LOG_LEVEL})
|
||||||
|
--grafana generate Grafana dashboards (and Prometheus config file)
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +85,10 @@ while true; do
|
||||||
LOG_LEVEL="$2"
|
LOG_LEVEL="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
--grafana)
|
||||||
|
ENABLE_GRAFANA="1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
|
@ -100,6 +106,7 @@ if [[ $# != 0 ]]; then
|
||||||
shift $#
|
shift $#
|
||||||
fi
|
fi
|
||||||
NETWORK="testnet${TESTNET}"
|
NETWORK="testnet${TESTNET}"
|
||||||
|
BASE_METRICS_PORT=8008
|
||||||
|
|
||||||
rm -rf "${DATA_DIR}"
|
rm -rf "${DATA_DIR}"
|
||||||
DEPOSITS_DIR="${DATA_DIR}/deposits_dir"
|
DEPOSITS_DIR="${DATA_DIR}/deposits_dir"
|
||||||
|
@ -140,6 +147,35 @@ BOOTSTRAP_IP="127.0.0.1"
|
||||||
--bootstrap-port=${BOOTSTRAP_PORT} \
|
--bootstrap-port=${BOOTSTRAP_PORT} \
|
||||||
--genesis-offset=5 # Delay in seconds
|
--genesis-offset=5 # Delay in seconds
|
||||||
|
|
||||||
|
if [[ "$ENABLE_GRAFANA" == "1" ]]; then
|
||||||
|
# Prometheus config
|
||||||
|
cat > "${DATA_DIR}/prometheus.yml" <<EOF
|
||||||
|
global:
|
||||||
|
scrape_interval: 1s
|
||||||
|
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: "nimbus"
|
||||||
|
static_configs:
|
||||||
|
EOF
|
||||||
|
for NUM_NODE in $(seq 0 $(( ${NUM_NODES} - 1 ))); do
|
||||||
|
cat >> "${DATA_DIR}/prometheus.yml" <<EOF
|
||||||
|
- targets: ['127.0.0.1:$(( BASE_METRICS_PORT + NUM_NODE ))']
|
||||||
|
labels:
|
||||||
|
node: '$NUM_NODE'
|
||||||
|
EOF
|
||||||
|
done
|
||||||
|
|
||||||
|
# use the exported Grafana dashboard for a single node to create one for all nodes
|
||||||
|
PROCESS_DASHBOARD_BIN="build/process_dashboard"
|
||||||
|
if [[ ! -f "$PROCESS_DASHBOARD_BIN" ]]; then
|
||||||
|
$MAKE process_dashboard
|
||||||
|
fi
|
||||||
|
"${PROCESS_DASHBOARD_BIN}" \
|
||||||
|
--nodes=${NUM_NODES} \
|
||||||
|
--in="tests/simulation/beacon-chain-sim-node0-Grafana-dashboard.json" \
|
||||||
|
--out="${DATA_DIR}/local-testnet-all-nodes-Grafana-dashboard.json"
|
||||||
|
fi
|
||||||
|
|
||||||
# Kill child processes on Ctrl-C/SIGTERM/exit, passing the PID of this shell
|
# Kill child processes on Ctrl-C/SIGTERM/exit, passing the PID of this shell
|
||||||
# instance as the parent and the target process name as a pattern to the
|
# instance as the parent and the target process name as a pattern to the
|
||||||
# "pkill" command.
|
# "pkill" command.
|
||||||
|
@ -200,6 +236,9 @@ for NUM_NODE in $(seq 0 $(( ${NUM_NODES} - 1 ))); do
|
||||||
--data-dir="${NODE_DATA_DIR}" \
|
--data-dir="${NODE_DATA_DIR}" \
|
||||||
${BOOTSTRAP_ARG} \
|
${BOOTSTRAP_ARG} \
|
||||||
--state-snapshot="${NETWORK_DIR}/genesis.ssz" \
|
--state-snapshot="${NETWORK_DIR}/genesis.ssz" \
|
||||||
|
--metrics \
|
||||||
|
--metrics-address="127.0.0.1" \
|
||||||
|
--metrics-port="$(( BASE_METRICS_PORT + NUM_NODE ))" \
|
||||||
${EXTRA_ARGS} \
|
${EXTRA_ARGS} \
|
||||||
> "${DATA_DIR}/log${NUM_NODE}.txt" 2>&1 &
|
> "${DATA_DIR}/log${NUM_NODE}.txt" 2>&1 &
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,8 @@ LAST_VALIDATOR="$VALIDATORS_DIR/v$(printf '%07d' $LAST_VALIDATOR_NUM).deposit.js
|
||||||
# Windows detection
|
# Windows detection
|
||||||
if uname | grep -qiE "mingw|msys"; then
|
if uname | grep -qiE "mingw|msys"; then
|
||||||
MAKE="mingw32-make"
|
MAKE="mingw32-make"
|
||||||
EXE_SUFFIX=".exe"
|
|
||||||
else
|
else
|
||||||
MAKE="make"
|
MAKE="make"
|
||||||
EXE_SUFFIX=""
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# to allow overriding the program names
|
# to allow overriding the program names
|
||||||
|
@ -176,7 +174,7 @@ if [ -f "${MASTER_NODE_ADDRESS_FILE}" ]; then
|
||||||
rm "${MASTER_NODE_ADDRESS_FILE}"
|
rm "${MASTER_NODE_ADDRESS_FILE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PROCESS_DASHBOARD_BIN="build/process_dashboard${EXE_SUFFIX}"
|
PROCESS_DASHBOARD_BIN="build/process_dashboard"
|
||||||
|
|
||||||
if [[ ! -f "$PROCESS_DASHBOARD_BIN" ]]; then
|
if [[ ! -f "$PROCESS_DASHBOARD_BIN" ]]; then
|
||||||
$MAKE NIMFLAGS="$CUSTOM_NIMFLAGS" process_dashboard
|
$MAKE NIMFLAGS="$CUSTOM_NIMFLAGS" process_dashboard
|
||||||
|
|
Loading…
Reference in New Issue