From: Martin Schwenke Date: Wed, 20 Apr 2016 05:19:45 +0000 (+1000) Subject: ctdb-scripts: Improve error messages when using NFS service_check_cmd X-Git-Tag: talloc-2.1.7~195 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=84fdc2a562bf26ecc9b3709cf47175e323bac15c;p=thirdparty%2Fsamba.git ctdb-scripts: Improve error messages when using NFS service_check_cmd 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 Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/config/events.d/60.nfs b/ctdb/config/events.d/60.nfs index d6b978fbf9a..c25b73e0cd3 100755 --- a/ctdb/config/events.d/60.nfs +++ b/ctdb/config/events.d/60.nfs @@ -168,11 +168,15 @@ nfs_check_service () # 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 @@ -190,14 +194,14 @@ nfs_check_service () 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