A script to count the number of routers by host
This can be used during maintenance to ensure all routers have moved or when you believe the number of routers is not balanced on your nodes. It does not however count FIPs per router or factor traffic into the count, so it can only be used to get a general idea of the balance. Change-Id: I5003c578d338d34d09608a979eb469d0465c0af3
This commit is contained in:
parent
dbcd8dc1fc
commit
6b772641c7
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
#set -x
|
||||
|
||||
# count the number of routers per host
|
||||
# optional argument of ACTIVE_ONLY -- which will count routers on active L3 agents only
|
||||
|
||||
echo "Router count per host. Gathering data. Be patient."
|
||||
|
||||
if [ "$1" == "ACTIVE_ONLY" ]; then
|
||||
AGENTS=$(neutron agent-list --column id --column agent_type --column host --format csv --quote minimal --column admin_state_up --column alive | grep ':-)' | grep True | grep L3 | cut -f1 -d',')
|
||||
else
|
||||
AGENTS=$(neutron agent-list --column id --column agent_type --column host --format csv --quote minimal | grep L3 | cut -f1 -d',')
|
||||
fi
|
||||
|
||||
for agent in ${AGENTS}; do
|
||||
COUNT=$(neutron router-list-on-l3-agent --format csv --quote minimal ${agent} | grep -v "id,name,external_gateway_info" | grep "," | wc -l)
|
||||
ROUTER_HOST=$(neutron agent-list --column id --column agent_type --column host --format csv --quote minimal | grep L3 | grep ${agent} | cut -f3 -d',' | tr -d '\r')
|
||||
echo "${ROUTER_HOST} (${agent}): ${COUNT}"
|
||||
done
|
Loading…
Reference in New Issue