integ/tools/collector/scripts/collect_networking.sh
Sun Austin af4879fb68 change 'compute' to 'worker' in collect utils
command 'collect' in worker node will be stuck since
node_type has been changed from 'compute' to 'worker'

Closes-bug: 1810478

Change-Id: I4547bae650b8bb56110eb145e0aca0d49496c793
Signed-off-by: Sun Austin <austin.sun@intel.com>
2019-01-05 09:35:04 +08:00

62 lines
1.8 KiB
Bash
Executable File

#! /bin/bash
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Loads Up Utilities and Commands Variables
source /usr/local/sbin/collect_parms
source /usr/local/sbin/collect_utils
SERVICE="networking"
LOGFILE="${extradir}/${SERVICE}.info"
echo "${hostname}: Networking Info ...: ${LOGFILE}"
###############################################################################
# All nodes
###############################################################################
delimiter ${LOGFILE} "ip -s link"
ip -s link >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "ip -s addr"
ip -s addr >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "ip -s neigh"
ip -s neigh >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "ip rule"
ip rule >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "ip route"
ip route >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "iptables -L -v -x -n"
iptables -L -v -x -n >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "iptables -L -v -x -n -t nat"
iptables -L -v -x -n -t nat >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "iptables -L -v -x -n -t mangle"
iptables -L -v -x -n -t mangle >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
###############################################################################
# Only Worker
###############################################################################
if [[ "$nodetype" = "worker" || "$subfunction" == *"worker"* ]] ; then
NAMESPACES=($(ip netns))
for NS in ${NAMESPACES[@]}; do
delimiter ${LOGFILE} "${NS}"
ip netns exec ${NS} ip -s link
ip netns exec ${NS} ip -s addr
ip netns exec ${NS} ip -s neigh
ip netns exec ${NS} ip route
ip netns exec ${NS} ip rule
done >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
fi
exit 0