From 1a1842f7e2f80569ff909dd20664b8a4f1244f52 Mon Sep 17 00:00:00 2001 From: Shayan Patel Date: Fri, 5 Jul 2024 12:36:46 +0000 Subject: [PATCH] Add ability to customize router exporter listen port --- snap/local/start-mysql-router-exporter.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/snap/local/start-mysql-router-exporter.sh b/snap/local/start-mysql-router-exporter.sh index d4533b7..3abd78c 100755 --- a/snap/local/start-mysql-router-exporter.sh +++ b/snap/local/start-mysql-router-exporter.sh @@ -14,6 +14,7 @@ EXPORTER_OPTS=( EXPORTER_PATH="/usr/bin/mysqlrouter_exporter" if [ -n "$SNAP" ]; then + MYSQLROUTER_EXPORTER_LISTEN_PORT="$(snapctl get mysqlrouter-exporter.listen-port)" MYSQLROUTER_EXPORTER_USER="$(snapctl get mysqlrouter-exporter.user)" MYSQLROUTER_EXPORTER_PASS="$(snapctl get mysqlrouter-exporter.password)" MYSQLROUTER_EXPORTER_URL="$(snapctl get mysqlrouter-exporter.url)" @@ -60,6 +61,11 @@ if [ -z "${MYSQLROUTER_EXPORTER_SERVICE_NAME}" ]; then exit 1 fi +# Modify the listen-port if supplied +if [ -n "${MYSQLROUTER_EXPORTER_LISTEN_PORT}" ]; then + EXPORTER_OPTS+=("--listen-port=${MYSQLROUTER_EXPORTER_LISTEN_PORT}") +fi + # Execute the mysqlrouter_exporter command if [ -n "${SNAP}" ]; then SETPRIV_OPTIONS=(