From 4d44bf19a198ad2c775dd0d75a555b09deb422bd Mon Sep 17 00:00:00 2001 From: jayhelios2 <155098211+jayhelios2@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:35:56 -0400 Subject: [PATCH] Update eks-log-collector.sh * Added fallback for `ss` from netstat[1]. * Added fallback for `ip addr show` from ifconfig[1]. * Added `nstat` to track network stats such as Reverse Path filters. [1] ifconfig, netstat being deprecated: https://www.redhat.com/sysadmin/deprecated-linux-command-replacements --- log-collector-script/linux/eks-log-collector.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/log-collector-script/linux/eks-log-collector.sh b/log-collector-script/linux/eks-log-collector.sh index 4b74232f2..3fb8e3175 100755 --- a/log-collector-script/linux/eks-log-collector.sh +++ b/log-collector-script/linux/eks-log-collector.sh @@ -567,7 +567,7 @@ get_networking_info() { timeout 75 conntrack -L -f ipv6 >> "${COLLECT_DIR}"/networking/conntrack6.txt # ifconfig - timeout 75 ifconfig > "${COLLECT_DIR}"/networking/ifconfig.txt + command -v ifconfig && timeout 75 ifconfig || timeout 75 ip addr show > "${COLLECT_DIR}"/networking/ifconfig.txt # ip rule show timeout 75 ip rule show > "${COLLECT_DIR}"/networking/iprule.txt @@ -692,10 +692,10 @@ get_system_services() { timeout 75 top -b -n 1 > "${COLLECT_DIR}"/system/top.txt 2>&1 timeout 75 ps fauxwww --headers > "${COLLECT_DIR}"/system/ps.txt 2>&1 timeout 75 ps -eTF --headers > "${COLLECT_DIR}"/system/ps-threads.txt 2>&1 - timeout 75 netstat -plant > "${COLLECT_DIR}"/system/netstat.txt 2>&1 + command -v netstat && timeout 75 netstat -plant || timeout 75 ss -plant > "${COLLECT_DIR}"/system/netstat.txt 2>&1 timeout 75 cat /proc/stat > "${COLLECT_DIR}"/system/procstat.txt 2>&1 timeout 75 cat /proc/[0-9]*/stat > "${COLLECT_DIR}"/system/allprocstat.txt 2>&1 - + timeout 75 nstat -rsz > "${COLLECT_DIR}"/system/nstat.txt 2>&1 # collect pids which have large environments echo -e "PID\tCount" > "${COLLECT_DIR}/system/large_environments.txt" for i in /proc/*/environ; do