]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Implement NFS statistics retrieval for NFS-Ganesha
authorMartin Schwenke <mschwenke@ddn.com>
Mon, 4 Mar 2024 02:52:10 +0000 (13:52 +1100)
committerMartin Schwenke <martins@samba.org>
Tue, 25 Jun 2024 03:16:37 +0000 (03:16 +0000)
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 <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/doc/examples/nfs-ganesha-callout

index 8b7df88456e16e8b101dd0d8fd95765623b5a17b..d57a659da11f7f3f376a6e5bc3896c3ef8495f10 100755 (executable)
@@ -73,7 +73,7 @@ usage()
        _c=$(basename "$0")
        cat <<EOF
 usage: $_c { shutdown | startup }
-       $_c { stop | start | check } nfs
+       $_c { stop | start | check | stats } nfs
        $_c { releaseip | takeip } <iface> <ip> <maskbits>
        $_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 "$@" ;;