StarlingX miscellaneous tools and utilities
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
1.8 KiB

#! /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