ddanielr commented on code in PR #5502:
URL: https://github.com/apache/accumulo/pull/5502#discussion_r2223675053


##########
assemble/bin/accumulo-service:
##########
@@ -215,9 +225,20 @@ function kill_service() {
 function list_processes() {
   local service_type=$1
   find_processes "$service_type"
-  echo "Currently running ${service_type} processes:"
+  echo "Currently running ${service_type} processes (fields: process pid 
port):"
   for process in "${RUNNING_PROCESSES[@]}"; do
-    echo "$process"
+    local pid_file
+    local pid
+    local port
+    pid_file="${ACCUMULO_PID_DIR}/accumulo-${process}.pid"
+    pid=$(<"$pid_file")
+    port=$(netstat -tnlp 2>/dev/null | grep "$pid" | awk '{print $4}' | awk -F 
':' '{print $NF}' | paste -sd "," -)
+    # check that only a single port was seen
+    if (($(echo "$port" | grep -c -E '^[0-9]+(,[0-9]+)*$') != 1)); then
+      echo "ERROR unexpected ports $(hostname) process:$process pid:$pid 
ports:$port" >&2
+    else
+      echo "$process $pid $port"
+    fi

Review Comment:
   Multiple ports are a valid state due to metric exporters like prometheus 
binding to a second port. 
   Removed the comment but updated the check logic so it was cleaner.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to