Browse Source

Make clear that it is a Nagios plugin and cleaner code

master
Laurent Poujoulat 1 year ago
committed by root
parent
commit
f60c0c1dc3
  1. 17
      monitoring/check_valisechaprilorg_update

17
monitoring/check_valisechaprilorg_update

@ -22,11 +22,22 @@
# This checks for updates of nextcloud components.
# If any update is present, they are listed in human readable form on stdout, and 1 is returned,
# and if everything is OK, tell it on stdout "OK", and returns 0.
#
# This is a Nagios plugin and thus follows its return code standards
# ================================================
# Configuration data
NEXTCLOUD_ROOT="/var/www/valise.chapril.org"
# Constants for return codes
readonly NS_OK=0
readonly NS_WARNING=1
readonly NS_CRITICAL=1
readonly NS_UNKNOWN=1
# Returns script usage
function usage()
{
@ -36,7 +47,7 @@ function usage()
# Main entry point
# By default, we assume to fail
EXIT_RESULT=1
EXIT_RESULT=${NS_UNKNOWN}
# Usage check
if [ "$#" -ne 0 ]
@ -51,6 +62,7 @@ else
if [ $? != 0 ]
then
EXIT_RESULT=${NS_CRITICAL}
echo "Failed to check Nextcloud update"
else
@ -59,9 +71,10 @@ else
if [ $? == 0 ]
then
EXIT_RESULT=${NS_OK}
echo "OK"
EXIT_RESULT=0
else
EXIT_RESULT=${NS_WARNING}
echo ${UPDATE_LIST}
fi

Loading…
Cancel
Save