Monitor NFS I/O

by Seth Miller

We use RMAN to backup to an NFS share. I was having some very lengthy RMAN backup times during certain time periods and the storage team was not able to correlate the slow downs to anything useful so I decided to monitor the NFS shares.

I looked at the OS Watcher logs for information about NFS, but they were severely lacking in useful information. The program nfsiostat had the information I was looking for but I wanted to collect information over different periods of time so cron was naturally the best way to schedule the collections.

However, like vmstat, iostat and most other programs of this nature, when executed, nfsiostat shows a summary since the last boot as its first iteration. Since I am not interested in the summary, I needed a way to exclude that first iteration. What better way to do line processing than to use the 40+ year old tool awk.

Finding what text to use as the separator between the iterations was easy since the first line of each iteration ends with the nfs mount I’m filtering on. I set the first parameter in the file as the mount point. The command will be executed twice, one second apart, the first being the throw-away summary and the second being the information I want to keep. There is a timestamp captured as well for each execution.

The output is captured in a file.


NFS_IO_OUT=~/nfsiostat_$(hostname -s).out
TIMESTAMP=$(date +%F_%R)_$(hostname -s)

echo -e "\n$TIMESTAMP\n"
$NFS_IO_STAT $NFS_IO_STAT_PARMS $NFS_IO_STAT_TARG | awk 'BEGIN { VAR="'$NFS_IO_STAT_TARG':$" } $0 ~ VAR { ccount++ }; ccount >= 2 { print }'
echo ====================================================
) >> $NFS_IO_OUT