diff --git a/checks/chronyc b/checks/chronyc index 27df886..23f58fd 100755 --- a/checks/chronyc +++ b/checks/chronyc @@ -7,7 +7,7 @@ trap "rm ${errorfile}" EXIT echo 0 >$tmperrorfile if oc auth can-i debug node >/dev/null 2>&1; then - msg "Collecting NTP data... (${BLUE}using oc debug, it can take a while${NOCOLOR})" + # shellcheck disable=SC2016 for node in $(oc get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if eq .type "Ready"}}{{if eq .status "True"}}node/{{$node.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'); do # See https://medium.com/@robert.i.sandor/getting-started-with-parallelization-in-bash-e114f4353691 diff --git a/checks/entropy b/checks/entropy index f9afcdd..453e6f0 100755 --- a/checks/entropy +++ b/checks/entropy @@ -7,7 +7,7 @@ trap "rm ${errorfile}" EXIT echo 0 >$tmperrorfile if oc auth can-i debug node >/dev/null 2>&1; then - msg "Collecting entropy data... (${BLUE}using oc debug, it can take a while${NOCOLOR})" + # shellcheck disable=SC2016 for node in $(oc get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if eq .type "Ready"}}{{if eq .status "True"}}node/{{$node.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'); do # See https://medium.com/@robert.i.sandor/getting-started-with-parallelization-in-bash-e114f4353691 diff --git a/checks/iptables-22623-22624 b/checks/iptables-22623-22624 index 5e1651e..4845c19 100755 --- a/checks/iptables-22623-22624 +++ b/checks/iptables-22623-22624 @@ -16,7 +16,7 @@ trap "rm ${errorfile}" EXIT echo 0 >$tmperrorfile if oc auth can-i debug node >/dev/null 2>&1; then - msg "Checking if ports 22623/tcp and 22624/tcp are blocked (${BLUE}using oc debug, it can take a while${NOCOLOR})" + # shellcheck disable=SC2016 for node in $(oc get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if eq .type "Ready"}}{{if eq .status "True"}}node/{{$node.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'); do # See https://medium.com/@robert.i.sandor/getting-started-with-parallelization-in-bash-e114f4353691 diff --git a/checks/mellanox-firmware-version b/checks/mellanox-firmware-version index a2a9f3b..8a36349 100755 --- a/checks/mellanox-firmware-version +++ b/checks/mellanox-firmware-version @@ -14,7 +14,7 @@ MIN_VERS=16.28 [ -z ${UTILSFILE} ] && source $(echo "$(dirname ${0})/../utils") if oc auth can-i debug node >/dev/null 2>&1; then - msg "Checking Mellanox firmware version (${BLUE}using oc debug, it can take a while${NOCOLOR})" + output=1 fw_errors=0 # shellcheck disable=SC2016 for node in $(oc get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if eq .type "Ready"}}{{if eq .status "True"}}node/{{$node.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'); do @@ -30,20 +30,23 @@ if oc auth can-i debug node >/dev/null 2>&1; then if [[ $(expr ${fw} \< ${MIN_VERS}) -eq 1 ]]; then msg "Firmware for Mellanox card ${RED}${dev}${NOCOLOR} on ${RED}${node}${NOCOLOR} is below the minimum recommended version. Please upgrade to at least ${GREEN}${MIN_VERS}${NOCOLOR}." errors=$(("${errors}" + 1)) + output=$(("${output}" + 1)) fw_errors=$(("${fw_errors}" + 1)) if [ ! -z "${ERRORFILE}" ]; then echo $errors >${ERRORFILE} fi fi done - else - msg "Couldn't find Mellanox firmware version in ${node}" fi fi done if [[ $fw_errors -gt 0 ]]; then exit ${OCERROR} fi + if [[ $output -gt 0 ]]; then + echo "No Mellanox cards found" + exit ${OCSKIP} + fi exit ${OCINFO} else msg "Couldn't debug nodes, check permissions" diff --git a/checks/zombies b/checks/zombies index eedbfc8..0a1ba7e 100755 --- a/checks/zombies +++ b/checks/zombies @@ -7,7 +7,7 @@ trap "rm ${errorfile}" EXIT echo 0 >$tmperrorfile if oc auth can-i debug node >/dev/null 2>&1; then - msg "Collecting zombie processes... (${BLUE}using oc debug, it can take a while${NOCOLOR})" + # shellcheck disable=SC2016 for node in $(oc get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if eq .type "Ready"}}{{if eq .status "True"}}node/{{$node.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'); do # See https://medium.com/@robert.i.sandor/getting-started-with-parallelization-in-bash-e114f4353691 diff --git a/info/biosversion b/info/biosversion index 896ac77..1ec9fc2 100755 --- a/info/biosversion +++ b/info/biosversion @@ -4,7 +4,7 @@ # Check BIOS version to begin with if oc auth can-i debug node >/dev/null 2>&1; then - msg "Checking bios versions (${BLUE}using oc debug, it can take a while${NOCOLOR})" + # shellcheck disable=SC2016 for node in $(oc get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if eq .type "Ready"}}{{if eq .status "True"}}node/{{$node.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'); do # See https://medium.com/@robert.i.sandor/getting-started-with-parallelization-in-bash-e114f4353691 diff --git a/info/container-images-stored b/info/container-images-stored index 0f8dbee..5877d65 100755 --- a/info/container-images-stored +++ b/info/container-images-stored @@ -3,7 +3,7 @@ [ -z ${UTILSFILE} ] && source $(echo "$(dirname ${0})/../utils") if oc auth can-i debug node >/dev/null 2>&1; then - msg "Checking container images stored in the cluster (${BLUE}using oc debug, it can take a while${NOCOLOR})" + # shellcheck disable=SC2016 for node in $(oc get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if eq .type "Ready"}}{{if eq .status "True"}}node/{{$node.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'); do # See https://medium.com/@robert.i.sandor/getting-started-with-parallelization-in-bash-e114f4353691 diff --git a/info/ethtool-firmware-version b/info/ethtool-firmware-version index 1845563..99145b7 100755 --- a/info/ethtool-firmware-version +++ b/info/ethtool-firmware-version @@ -3,7 +3,7 @@ [ -z ${UTILSFILE} ] && source $(echo "$(dirname ${0})/../utils") if oc auth can-i debug node >/dev/null 2>&1; then - msg "Checking NIC firmware version using ethtool (${BLUE}using oc debug, it can take a while${NOCOLOR})" + # shellcheck disable=SC2016 for node in $(oc get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if eq .type "Ready"}}{{if eq .status "True"}}node/{{$node.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'); do # See https://medium.com/@robert.i.sandor/getting-started-with-parallelization-in-bash-e114f4353691 diff --git a/info/intel-firmware-version b/info/intel-firmware-version index 814c5f8..8d52833 100755 --- a/info/intel-firmware-version +++ b/info/intel-firmware-version @@ -7,8 +7,9 @@ INTEL_IDS="${INTEL_IDS:=8086:158b}" [ -z ${UTILSFILE} ] && source $(echo "$(dirname ${0})/../utils") if oc auth can-i debug node >/dev/null 2>&1; then - msg "Checking Intel firmware version (${BLUE}using oc debug, it can take a while${NOCOLOR})" + # shellcheck disable=SC2016 + output=0 for node in $(oc get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if eq .type "Ready"}}{{if eq .status "True"}}node/{{$node.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'); do # See https://medium.com/@robert.i.sandor/getting-started-with-parallelization-in-bash-e114f4353691 ((i = i % PARALLELJOBS)) @@ -20,13 +21,16 @@ if oc auth can-i debug node >/dev/null 2>&1; then else if [ -n "${FIRMWAREVERS}" ]; then msg "${node}:\n${FIRMWAREVERS}" - else - msg "Couldn't find Intel firmware version in ${node}" + output=$(("${output}" + 1)) fi fi ) & done wait + if [[ $output -gt 0 ]]; then + echo "No Intel cards found" + exit ${OCSKIP} + fi exit ${OCINFO} else msg "Couldn't debug nodes, check permissions" diff --git a/info/locks b/info/locks index 45c3c25..fca7b63 100755 --- a/info/locks +++ b/info/locks @@ -7,7 +7,7 @@ SCRIPT64=$(cat ./scripts/locks.sh | base64 -w 0) [ -z ${UTILSFILE} ] && source $(echo "$(dirname ${0})/../utils") if oc auth can-i debug node >/dev/null 2>&1; then - msg "Checking for locks by pod, per node (${BLUE}using oc debug, it can take a while${NOCOLOR})" + fw_errors=0 # shellcheck disable=SC2016 for node in $(oc get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if eq .type "Ready"}}{{if eq .status "True"}}node/{{$node.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'); do diff --git a/info/mellanox-firmware-version b/info/mellanox-firmware-version index dec6237..4ad968f 100755 --- a/info/mellanox-firmware-version +++ b/info/mellanox-firmware-version @@ -14,7 +14,7 @@ IDS="15b3:1015 15b3:1017 15b3:1013 15b3:101b" [ -z ${UTILSFILE} ] && source $(echo "$(dirname ${0})/../utils") if oc auth can-i debug node >/dev/null 2>&1; then - msg "Checking Mellanox firmware version (${BLUE}using oc debug, it can take a while${NOCOLOR})" + # shellcheck disable=SC2016 for node in $(oc get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if eq .type "Ready"}}{{if eq .status "True"}}node/{{$node.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'); do # See https://medium.com/@robert.i.sandor/getting-started-with-parallelization-in-bash-e114f4353691 diff --git a/info/mtu b/info/mtu index 28f9ad1..8301877 100755 --- a/info/mtu +++ b/info/mtu @@ -25,7 +25,7 @@ if oc auth can-i get network/cluster >/dev/null 2>&1; then IFS=${OLDIFS} else if oc auth can-i debug node -A >/dev/null 2>&1 && oc auth can-i get nodes >/dev/null 2>&1; then - msg "Collecting MTUs... (${BLUE}using oc debug, it can take a while${NOCOLOR}))" + # shellcheck disable=SC2016 for node in $(oc get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if eq .type "Ready"}}{{if eq .status "True"}}node/{{$node.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'); do # See https://medium.com/@robert.i.sandor/getting-started-with-parallelization-in-bash-e114f4353691