Skip to content

Commit

Permalink
Show a total count of found anomalies
Browse files Browse the repository at this point in the history
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
  • Loading branch information
widhalmt committed Feb 22, 2019
1 parent ea9fc67 commit e61b4fb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion icinga-diagnostics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"

0 comments on commit e61b4fb

Please sign in to comment.