From e61b4fbf031783c8fb83bc9e9495765a5e64e23a Mon Sep 17 00:00:00 2001 From: Thomas Widhalm Date: Fri, 22 Feb 2019 14:29:30 +0100 Subject: [PATCH] Show a total count of found anomalies The main purpose of this output is the show if there are anomalies at all. The old output was confusiung because it read "anomalies found" and then the output ended. So, from now on if there are no anomalies found, you'll se a count of 0. fixes #49 --- icinga-diagnostics.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/icinga-diagnostics.sh b/icinga-diagnostics.sh index 1e106fa..4ed06f8 100755 --- a/icinga-diagnostics.sh +++ b/icinga-diagnostics.sh @@ -23,6 +23,8 @@ UNAME_S=$(uname -s) # The GnuPG key used for signing packages in the Icinga repository ICINGAKEY="c6e319c334410682" +ANOMALIESFOUND=0 + ## Computed variables ## if [ "$(id -u)" != "0" ]; then @@ -553,40 +555,51 @@ echo "" if [ ${DIRECTOR_NO_RELEASE} ] then echo "* Director is installed but no release archive was used for installation. (Please note that it still could the code of a release)" + ANOMALIESFOUND=$((${ANOMALIESFOUND}+1)) fi if [ ! -z "${NON_ICINGA_PACKAGES}" ] then echo "* The following packages were not signed with the Icinga GnuPG key: ${NON_ICINGA_PACKAGES}" + ANOMALIESFOUND=$((${ANOMALIESFOUND}+1)) fi if [ ! -z "${ZOMBIES}" ] then echo "* Zombie processes found. See output for details" + ANOMALIESFOUND=$((${ANOMALIESFOUND}+1)) fi if [ ${BIGZONES} -gt 0 ] then echo "* ${BIGZONES} non-global zones have more than 2 endpoints configured" + ANOMALIESFOUND=$((${ANOMALIESFOUND}+1)) fi if [ ${ENDPOINTISNODENAME} = "false" ] then echo "* Name of Endpoint object differs from hostname" + ANOMALIESFOUND=$((${ANOMALIESFOUND}+1)) fi if [ ${PHPINICOUNT} -gt 1 ] then echo "* More than one php.ini file found" + ANOMALIESFOUND=$((${ANOMALIESFOUND}+1)) fi if [ ${PHPINITIMEZONEMISSING} ] then echo "* At least one php.ini file has no valid timezone setting" + ANOMALIESFOUND=$((${ANOMALIESFOUND}+1)) fi if [ $(which ntpstat 2>/dev/null) ] then - ntpstat >/dev/null 2&>1 || echo "* NTP is not synchronized" + ntpstat >/dev/null 2&>1 || ( echo "* NTP is not synchronized" ; ANOMALIESFOUND=$((${ANOMALIESFOUND}+1)) ) else echo "* ntpstat is not installed - NTP status uncheckable" + ANOMALIESFOUND=$((${ANOMALIESFOUND}+1)) fi + +echo "" +echo "Total count of detected anomalies: ${ANOMALIESFOUND}"