Extend Service Output for NFS Mounts (AIX + Linux)

Hello,

By default, the NFS Mount service only displays the mount name in the service Name:

From my point of view, it would be useful to have the NFS host and the name of the NFS share in the service output in addition to the Size Information. As far as I can see, you would have the necessary information already, because it is in the file “/proc/mounts” (Linux) and in the output of the “mount” command (AIX).
This would have the advantage that the notification would also tell you where the missing mount should come from.

regards
Christian

yes definitely helpful and would shorten the investigation time

@foobar
could you please vote then? :slight_smile:
Thank you!

Does something like mount | awk '$4 == "nfs" {printf "%s:%s:%s\n",$1,$2,$3}' broadly give you the information you’re after?

Hi @rawiriblundell
yes, but on our Redhat 7 System, the command should look a little bit different:

This is an example nfs-share:
nfs-hostname.foo.bar:/images on /images type nfs4 (rw,relatime,vers=4.1,rsize=1048576,wsize=1048576,namlen=255,soft,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=100.100.100.100,local_lock=none,addr=100.100.100.100)

and the command:

$ mount | awk '$5 ~ "nfs" {printf "%s on %s\n",$1,$3}'
nfs-hostname.foo.bar:/images on /images

I’ve replaced $4 with $5 and used a ~ for regular expression matching.

I’ve already checked the command on an AIX System. Example nfs-share:
nfs-hostname /samba/service /nfsmnt nfs3 Sep 01 07:03 bg,soft,rw,intr,sec=sys

command:

# mount | awk '$4 ~ "nfs" {printf "%s:%s on %s\n",$1,$2,$3}'
nfs-hostname:/samba/service on /nfsmnt

It would be great, if this additional information would always be contained in the NFS Service Summary, but at least when the Service has a Problem.

Regards
Christian

1 Like

@CFriedrich if you manually set the environment var MK_OSSTR for now, how does the following work out for you:

# Function to list NFS mounts for use by section_nfs

get_nfs_mounts() {
    if [ -r /proc/mounts ]; then
        awk '$3 ~ "nfs" {printf "%s on %s\n",$1,$2}' /proc/mounts
    else
        case "${MK_OSSTR}" in
            (aix)   mount | awk '$4 ~ "nfs" {printf "%s:%s on %s\n",$1,$2,$3}' ;;
            (linux) mount | awk '$5 ~ "nfs" {printf "%s on %s\n",$1,$3}' ;;
        esac
    fi
}

Migrated to the new feature portal