Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on:
push:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install ShellCheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck

- name: Bash syntax check
run: |
bash -n xsos
bash -n xsos-bash-completion.bash

- name: ShellCheck (errors only)
run: |
shellcheck -S error -x xsos xsos-bash-completion.bash
14 changes: 14 additions & 0 deletions CONTRIB.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ Try to keep roughly within the established bash/awk style.

## Testing

### Lint / static checks

The CI runs the following checks locally; please run them before opening a PR:

```bash
bash -n xsos
bash -n xsos-bash-completion.bash

# ShellCheck is optional locally but strongly recommended.
# CI runs ShellCheck in "errors only" mode to catch real breakage while avoiding
# a huge amount of warning-only churn.
shellcheck -S error -x xsos xsos-bash-completion.bash
```

### Targets - what xsos is run against

Where possible, test against sosreports from the in-support versions of RHEL and Ubuntu LTS.
Expand Down
55 changes: 30 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,44 +115,48 @@ OS
```


**While xsos is always being improved, here's the minimal help page from v0.5.6:**
**While xsos is always being improved, here's the current minimal help page (run `xsos -h`):**

```
Usage: xsos [DISPLAY OPTIONS] [-6abokcmdtlerngisp] [SOSREPORT ROOT]
or: xsos [DISPLAY OPTIONS] {--B|--C|--M|--D|--T|--L|--R|--N|--G|--I|--P FILE}...
Usage: xsos [DISPLAY OPTIONS] [-6abokcfmdtlerngispSFIN] [SOSREPORT ROOT]
or: xsos [DISPLAY OPTIONS] {--B|--C|--F|--M|--D|--T|--L|--R|--N|--G|--I|--P FILE}...
or: xsos [-?|-h|--help]
or: xsos [-U|--update]

Display system info from localhost or extracted sosreport

Content options:
-a, --all show everything
-b, --bios show info from dmidecode
-o, --os show hostname, distro, SELinux, kernel info, uptime, etc
-k, --kdump inspect kdump configuration
-c, --cpu show info from /proc/cpuinfo
-m, --mem show info from /proc/meminfo
-d, --disks show info from /proc/partitions + dm-multipath synopsis
-t, --mpath show info from dm-multipath
-l, --lspci show info from lspci
-e, --ethtool show info from ethtool
-r, --softirq show info from /proc/net/softnet_stat
-n, --netdev show info from /proc/net/dev
-g, --bonding show info from /proc/net/bonding
-i, --ip show info from ip addr (BASH v4+ required)
--net alias for: --lspci --ethtool --softirq --netdev --bonding --ip
-s, --sysctl show important kernel sysctls
-p, --ps inspect running processes via ps
-a, --all show everything
-b, --bios show info from dmidecode
-o, --os show hostname, distro, SELinux, kernel info, uptime, etc
-k, --kdump inspect kdump configuration
-c, --cpu show info from /proc/cpuinfo
-f, --intrupt show info from /proc/interrupts
-m, --mem show info from /proc/meminfo
-d, --disks show info from /proc/partitions, dm-multipath, lsblk, df
-t, --mpath show info from dm-multipath
-l, --lspci show info from lspci
-e, --ethtool show info from ethtool
-r, --softirq show info from /proc/net/softnet_stat
-n, --netdev show info from /proc/net/dev
-g, --bonding show bonding and teaming info
-i, --ip show info from ip addr (BASH v4+ required)
--net alias for: --lspci --ethtool --softirq --netdev --bonding --ip
-s, --sysctl show important kernel sysctls
-p, --ps inspect running processes via ps
-S, --ss inspect running processes via ss
-F, --firewall show firewall status
-I, --ifcfg show ifcfg files summary
-N, --netstat show info from /proc/net/netstat

Display options:
--scrub-ip remove IP addresses & hostnames from output
--scrub-mac remove HW MAC addresses from output
see XSOS_SCRUB_IP_HN & XSOS_SCRUB_MACADDR env vars
--scrub remove from output: IP/MAC addrs, hostnames, serial numbers,
proxy user & passwords
-6, --ipv6 parse ip addr output for IPv6 addresses instead of IPv4
-q, --wwid=ID restrict dm-multipath output to a particular mpath device,
where ID is a wwid, friendly name, or LUN identifier
-u, --unit=P change byte display for /proc/meminfo & /proc/net/dev,
where P is "b" for byte, or else "k", "m", "g", or "t"
--threads make ps take threads into account (via `ps auxm`)
-v, --verbose=NUM specify ps verbosity level (0-4, default: 1)
-w, --width=NUM change fold-width, in columns (positive number, e.g., 80)
"0" disables wrapping, "w" autodetects width (default)
Expand All @@ -163,6 +167,7 @@ Display options:
Special options (BASH v4+ required):
--B=FILE read from FILE containing `dmidecode` dump
--C=FILE read from FILE containing /proc/cpuinfo dump
--F=FILE read from FILE containing /proc/interrupts dump
--M=FILE read from FILE containing /proc/meminfo dump
--D=FILE read from FILE containing /proc/partitions dump
--T=FILE read from FILE containing `multipath -v4 -ll` dump
Expand All @@ -175,7 +180,7 @@ Special options (BASH v4+ required):

Run with "--help" to see full help page

Version info: xsos v0.5.6 last mod 2015/01/01
Version info: xsos v0.7.40 last mod 2025-12-01
See <github.com/ryran/xsos> to report bugs or suggestions
```

Expand Down
20 changes: 10 additions & 10 deletions xsos
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ Content options:"
-p, --ps❚inspect running processes via ps
-S, --ss❚inspect running processes via ss
-F, --firewall❚show firewall status
-I, --ifcfg❚|show ifcfg files summary
-N, --netstat❚|show ifcfg files summary" | column -ts❚
-I, --ifcfg❚show ifcfg files summary
-N, --netstat❚show info from /proc/net/netstat" | column -ts❚
}

HELP_OPTS_DISPLAY() {
Expand Down Expand Up @@ -486,7 +486,7 @@ PARSE() {
done
shift #(to get rid of the '--')
# Set sosroot
sosroot=$@
sosroot="$@"
}

# Call the parser
Expand Down Expand Up @@ -1075,7 +1075,7 @@ OSINFO() {
runlevel=$(runlevel)
initdefault=$(basename $(readlink -q /etc/systemd/system/default.target) 2>/dev/null) &&
initdefault=${initdefault%.target} ||
initdefault=$(gawk -F: '/^id.*initdefault/ {print $2}' </etc/inittab)
[[ -r /etc/inittab ]] && initdefault=$(gawk -F: '/^id.*initdefault/ {print $2}' </etc/inittab)

# Otherwise, running on sosreport
else
Expand Down Expand Up @@ -2174,7 +2174,7 @@ TEAMING() {
# If an sosreport, look for sos_commands/teamd/ output...
else
files=("$1"/sos_commands/teamd/teamdctl_*_state_dump)
if [[ ! -r ${files[0]} ]]; then
if [[ ! -r "${files[0]}" ]]; then
echo -e "${c[Warn2]}Warning:${c[Warn1]} '/sos_commands/teamd/teamdctl_*_state_dump' files unreadable; skipping teaming check${c[0]}" >&2
echo -en $XSOS_HEADING_SEPARATOR >&2
return
Expand All @@ -2196,7 +2196,7 @@ TEAMING() {
echo " Device❚Runner (mode) ❚ifcfg-File TEAM_CONFIG❚Partner MAC Addr❚Ports (*=active; [n]=AggID)"
echo " ========❚=================❚========================❚==================❚==============================="

f=0; for team_input in ${files[@]}; do
f=0; for team_input in "${files[@]}"; do

team_name=$(gawk -F '"' '/team_device/,/^$/ {if ($2 == "ifname") {print $4}}' $team_input)
echo -n " $team_name❚"
Expand Down Expand Up @@ -2296,7 +2296,7 @@ BONDING() {
# If localhost or sosreport, use that
else
files=("$1"/proc/net/bonding/*)
if [[ ! -r ${files[0]} ]]; then
if [[ ! -r "${files[0]}" ]]; then
echo -e "${c[Warn2]}Warning:${c[Warn1]} '/proc/net/bonding/' files unreadable; skipping bonding check${c[0]}" >&2
echo -en $XSOS_HEADING_SEPARATOR >&2
return
Expand Down Expand Up @@ -2346,7 +2346,7 @@ BONDING() {
echo " Device❚Mode❚ifcfg-File BONDING_OPTS❚Partner MAC Addr❚Slaves (*=active; [n]=AggID)"
echo " ========❚=================❚========================❚==================❚==============================="

f=0; for bond_input in ${files[@]}; do
f=0; for bond_input in "${files[@]}"; do

echo -n " ${bond_input##*/}❚"

Expand Down Expand Up @@ -3382,7 +3382,7 @@ PSCHECK() {
fi

# Calculate top cpu-using & mem-using users
if [[ $XSOS_PS_LEVEL < 3 ]]; then # If verbosity level 0-2, restrict number of users shown
if [[ $XSOS_PS_LEVEL -lt 3 ]]; then # If verbosity level 0-2, restrict number of users shown
# Process ps input to generate summary user-list of top-users
top_users=$(
gawk -vu=$(tr '[:lower:]' '[:upper:]' <<<"$XSOS_PS_UNIT") '
Expand Down Expand Up @@ -3882,7 +3882,7 @@ NETSTAT(){
}
_print_proc_net_array(){
declare -A __array="$*"
for hdr in ${!__array[@]}; do
for hdr in "${!__array[@]}"; do
val="${__array[$hdr]}"
[ "${XSOS_NETSTAT_IGNORE_ZERO}" == "y" ] && [ "$val" -eq "0" ] && continue
[ "${XSOS_NETSTAT_FILTER_REGEX}" != "" ] && [[ ! ${hdr,,} =~ ${XSOS_NETSTAT_FILTER_REGEX,,} ]] && continue
Expand Down