diff --git a/checks/chronyc b/checks/chronyc index 88cee09..338ea4e 100755 --- a/checks/chronyc +++ b/checks/chronyc @@ -8,7 +8,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 738661e..5b2afc9 100755 --- a/checks/entropy +++ b/checks/entropy @@ -8,7 +8,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 5918571..0683681 100755 --- a/checks/iptables-22623-22624 +++ b/checks/iptables-22623-22624 @@ -18,7 +18,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 6053d45..66249a4 100755 --- a/checks/mellanox-firmware-version +++ b/checks/mellanox-firmware-version @@ -15,7 +15,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=0 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 @@ -31,20 +31,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} (${fw}) 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 -eq 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 a059f4c..4cdc13b 100755 --- a/checks/zombies +++ b/checks/zombies @@ -8,7 +8,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 5d01838..419ff00 100755 --- a/info/biosversion +++ b/info/biosversion @@ -5,7 +5,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 bf491b3..46ff0cc 100755 --- a/info/container-images-stored +++ b/info/container-images-stored @@ -4,7 +4,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 28952d0..d449061 100755 --- a/info/ethtool-firmware-version +++ b/info/ethtool-firmware-version @@ -4,7 +4,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/locks b/info/locks index 9b89889..c4ea4d9 100755 --- a/info/locks +++ b/info/locks @@ -8,7 +8,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/mtu b/info/mtu index 549d878..a7d2d91 100755 --- a/info/mtu +++ b/info/mtu @@ -26,7 +26,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