From: Martin Schwenke Date: Mon, 4 Mar 2024 02:52:10 +0000 (+1100) Subject: ctdb-scripts: Implement NFS statistics retrieval for NFS-Ganesha X-Git-Tag: tdb-1.4.11~301 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=d96078e263ebc3119d646ddf154582351052c5b0;p=thirdparty%2Fsamba.git ctdb-scripts: Implement NFS statistics retrieval for NFS-Ganesha Simplicity is preferred here over absolute correctness. If the ganesha_stats command exits with an error or times out then no output is produced so, implicitly, the statistics do not change. Also, the statistics always change at startup. However, it is likely that the statistics change when NFS makes progress and do not change when NFS does not make progress. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/doc/examples/nfs-ganesha-callout b/ctdb/doc/examples/nfs-ganesha-callout index 8b7df88456e..d57a659da11 100755 --- a/ctdb/doc/examples/nfs-ganesha-callout +++ b/ctdb/doc/examples/nfs-ganesha-callout @@ -73,7 +73,7 @@ usage() _c=$(basename "$0") cat < $_c { monitor-list-shares } EOF @@ -266,6 +266,22 @@ service_check() return 0 } +nfs_stats() +{ + _service="$1" + + case "$_service" in + nfs) + timeout -v 5 ganesha_stats | grep '^Total NFSv.* ops:' + ;; + *) + # This will never change, so is intentionally + # unhelpful for avoiding an unhealthy service + echo "Not implemented" >&2 + exit 1 + esac +} + #------------------------------------------------- grace_period() @@ -411,6 +427,7 @@ startup stop start check +stats startipreallocate releaseip takeip @@ -429,6 +446,7 @@ startup) nfs_startup ;; stop) service_stop "$1" ;; start) service_start "$1" ;; check) service_check "$1" ;; +stats) nfs_stats "$1" ;; startipreallocate) nfs_startipreallocate ;; releaseip) nfs_releaseip "$@" ;; takeip) nfs_takeip "$@" ;;