When external monitoring is enabled for an NFS service using
service_check_cmd then $ctdb_check_rpc_out is empty because the
internal RPC checking isn't used. This results in empty log messages
like:
60.nfs: ERROR:
or:
60.nfs: WARNING:
Improve this so it at least says:
60.nfs: ERROR: monitoring service "statd" failed
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
# Using eval means variables can contain semicolon separated commands
if eval "$service_check_cmd" ; then
_ok=true
+ else
+ _err="monitoring service \"${_progname}\" failed"
fi
else
if nfs_check_rpcinfo \
"$_progname" "$version" "$family" >/dev/null ; then
_ok=true
+ else
+ _err="$ctdb_check_rpc_out"
fi
fi
if [ $unhealthy_after -gt 0 ] ; then
if [ $_failcount -ge $unhealthy_after ] ; then
_unhealthy=true
- echo "ERROR: $ctdb_check_rpc_out"
+ echo "ERROR: $_err"
fi
fi
if [ $restart_every -gt 0 ] ; then
if [ $(($_failcount % $restart_every)) -eq 0 ] ; then
if ! $_unhealthy ; then
- echo "WARNING: $ctdb_check_rpc_out"
+ echo "WARNING: $_err"
fi
nfs_restart_service
fi