Nextcloud Local Check(s)

Just a little thing i made and wanted to share.
I know there is a Special Agent for NextCloud/OpenCloud, but to minimize differences i try to stick to a/the regular agent.
So to get insight into some parts on Nextcloud ( specifically updates) i made the below localscript.

As with all local checks, this script needs to be placed in/on the NextCloud server itself in /usr/lib/check_mk_agent/local and must be made executable via chmod +x /usr/lib/check_mk_agent/local/scriptname.here

#!/bin/bash

#basepath of Nextcloud's occ executable
BASEPATH="/var/www/html"

sudo -u apache php $BASEPATH/occ status -e
if [ $? -eq 0 ]; then
    echo "0 \"NextCloud\" - NextCloud all up to date"
elif [ $? -eq 1 ]; then
    echo "1 \"NextCloud\" - NextCloud maintenance-mode is enabled"
elif [ $? -eq 2 ]; then
    echo "2 \"NextCloud\" - NextCloud Core needs updating"
fi

APPRESULT=$(sudo -u apache php $BASEPATH/occ app:update --showonly)
if [ -z "$APPRESULT" ]; then
    echo "0 \"NextCloud Apps\" - NextCloud Apps all up to date"
else
    UPDATECOUNT=$(echo "$APPRESULT" | wc -l)
    echo "1 \"NextCloud Apps\" - $UPDATECOUNT NextCloud Apps require updates"
fi

In essence this will give me (next to the regular information on the OS via the standard Agent) Nextcloud specifics.
For now this is what i was in need of, however maybe future needs might require me to extend this local check, and then i will update the above code.

Happy Monitoring !

  • Glowsome
2 Likes