1

I have three Debian 11 servers let's call them nfs-server which is the NFS server, nfs1, and nfs2 which are the NFS clients.

I want to perform some sort of health check from the NFS server to ensure client connectivity and detect if a client is unmounted and raise an alert (The alert part is not the topic of this post).

My question is:
How to perform a health check and ensure client connectivity from the NFS server? Is there any utility for this?

  • If yes, can it be integrated with Prometheus or Alert-manager? Should I use cron and a bash script?
  • If yes, can you suggest a script?

UPDATE:

I should mention that I'm using NFSv4 which doesn't use rpcbind services:

cat /proc/fs/nfsd/versions 
-2 -3 +4 +4.1 +4.2
showmount -a
clnt_create: RPC: Program not registered

Any assistance is appreciated, thanks in advance.

Sinux
  • 75
  • 9
  • 1
    How about `netstat -tn | grep :2049` and check that expected client ID is there? – kofemann Sep 07 '22 at 15:28
  • @kofemann, I've tried it and it's actually a good idea, however, I need to take some tests, I'll let you know. – Sinux Sep 08 '22 at 17:57

1 Answers1

2

Don't know your complete environment though you can use below command to gather stats related to nfs from nfs server and client and create script accordingly.

Check that the NFS services have started on the NFS server by typing the following command (On server):

rpcinfo -s <server>|egrep 'nfs|mountd'

On the client, type the following command to test the UDP NFS connections from the server.

/usr/bin/rpcinfo -u <server> nfs

Check that the server's mountd is responding, by typing the following command.

/usr/bin/rpcinfo -u <derver> mountd

Verify that file system is shared as expected on the server.

/usr/sbin/showmount -e <server>
asktyagi
  • 2,860
  • 2
  • 8
  • 25
  • I'm sorry I should've mentioned in the question (will add right now!) that I'm using NFSv4 which doesn't use `rpcbind` therefore entering the `showmount` command will show: `clnt_create: RPC: Program not registered`. The current content of `/proc/fs/nfsd/versions` is: `-2 -3 +4 +4.1 +4.2` – Sinux Sep 07 '22 at 11:02
  • However your solution is absolutely valid so I will up-vote. – Sinux Sep 07 '22 at 11:04