Add resource CPU and memory info in collect

This adds commands to collect more data to debug
resource allocations and usage for the system
and containerization.

The following command outputs were added:
system host-cpu-list <hostname>
ctr -n k8s.io images list
kubectl describe nodes | grep -e Capacity: -B1
  -A40 | grep -e 'System Info:' -B13 | grep
  -v 'System info:'
lscpu
lscpu -e
cat /sys/devices/system/cpu/isolated

Partial-Bug: 1886868

Signed-off-by: Enzo Candotti <enzo.candotti@windriver.com>
Change-Id: Ib26b4bb22d787451cc96820b3a413b410f79d49d
This commit is contained in:
Enzo Candotti 2021-02-01 12:47:38 -03:00
parent a4365bf1b2
commit 27fce5a523
3 changed files with 18 additions and 1 deletions

View File

@ -1,6 +1,6 @@
#! /bin/bash
#
# Copyright (c) 2019 Wind River Systems, Inc.
# Copyright (c) 2019-2021 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -41,6 +41,10 @@ CMD="crictl images"
delimiter ${LOGFILE_IMG} "${CMD}"
${CMD} 2>>${COLLECT_ERROR_LOG} >>${LOGFILE_IMG}
CMD="ctr -n k8s.io images list"
delimiter ${LOGFILE_IMG} "${CMD}"
${CMD} 2>>${COLLECT_ERROR_LOG} >>${LOGFILE_IMG}
CMD="docker container ps -a"
delimiter ${LOGFILE_IMG} "${CMD}"
${CMD} 2>>${COLLECT_ERROR_LOG} >>${LOGFILE_IMG}
@ -67,6 +71,7 @@ if [ "$nodetype" = "controller" -a "${ACTIVE}" = true ] ; then
CMDS+=("kubectl get nodes --show-labels")
CMDS+=("kubectl get nodes -o json")
CMDS+=("kubectl describe nodes")
CMDS+=("kubectl describe nodes | grep -e Capacity: -B1 -A40 | grep -e 'System Info:' -B13 | grep -v 'System Info:'")
CMDS+=("kubectl services")
CMDS+=("kubectl get configmaps --all-namespaces")
CMDS+=("kubectl get daemonsets --all-namespaces")

View File

@ -212,9 +212,18 @@ function collect_extra()
delimiter ${LOGFILE} "cat /proc/version"
cat /proc/version >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "lscpu"
lscpu >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "lscpu -e"
lscpu -e >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "cat /proc/cpuinfo"
cat /proc/cpuinfo >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "cat /sys/devices/system/cpu/isolated"
cat /sys/devices/system/cpu/isolated >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "ip addr show"
ip addr show >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}

View File

@ -72,6 +72,9 @@ function collect_inventory {
delimiter ${LOGFILE} "system host-ethernet-port-list ${host}"
system host-ethernet-port-list ${host} 2>>${COLLECT_ERROR_LOG} >> ${LOGFILE}
delimiter ${LOGFILE} "system host-cpu-list ${host}"
system host-cpu-list ${host} 2>>${COLLECT_ERROR_LOG} >> ${LOGFILE}
delimiter ${LOGFILE} "system host-memory-list ${host}"
system host-memory-list ${host} 2>>${COLLECT_ERROR_LOG} >> ${LOGFILE}