Skip to content

Commit

Permalink
Include system information in the inspect.sh script
Browse files Browse the repository at this point in the history
When investigating the state of a Kubernetes node, it may be useful to
check a few host resources and their availability, to root cause
potential memory / disk pressure issues.
  • Loading branch information
claudiubelu committed Dec 19, 2024
1 parent 0cdeb87 commit 165b123
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions k8s/scripts/inspect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@ function collect_sbom {
cp --no-preserve=mode,ownership /snap/k8s/current/bom.json "$INSPECT_DUMP"/sbom.json
}

function collect_system_info {
mkdir -p $INSPECT_DUMP/sys
log_info "Copy processes list to the final report tarball"
ps -ef > $INSPECT_DUMP/sys/ps

log_info "Copy disk usage information to the final report tarball"
df -h | grep "^/" &> $INSPECT_DUMP/sys/disk_usage

log_info "Copy memory usage information to the final report tarball"
free -m > $INSPECT_DUMP/sys/memory_usage

log_info "Copy node uptime to the final report tarball"
uptime > $INSPECT_DUMP/sys/uptime

log_info "Copy /etc/os-release to the final report tarball"
cp /etc/os-release $INSPECT_DUMP/sys/etc-os-release
}

function collect_k8s_diagnostics {
log_info "Copy uname to the final report tarball"
uname -a &>"$INSPECT_DUMP/uname.log"
Expand Down Expand Up @@ -207,6 +225,9 @@ printf -- 'Collecting SBOM\n'
collect_sbom

printf -- 'Collecting system information\n'
collect_system_info

printf -- 'Collecting snap and related information\n'
collect_k8s_diagnostics

printf -- 'Collecting networking information\n'
Expand Down

0 comments on commit 165b123

Please sign in to comment.