Found solution i tried another script. Posting steps might be helpful !!
Adding Nrpe plugin for Nagios Server to monitor Nfs Server
Steps :
Note : Nrpe should be installed on both Nagios & Nfs server
sudo apt-get install nagios-nrpe-server
sudo apt-get install nagios-plugins-basic nagios-plugins nagios-plugins-extra
On Nagios Server :
1) Download https://exchange.nagios.org/directory/Plugins/System-Metrics/File-System/NFS/check_nfs-2Esh/details
in /usr/local/nagios/libexec/ & rename it to check_nfs
2) root@Bastion-01:/usr/local/nagios/libexec# chmod 755 check_nfs
3) root@Bastion-01# vim /etc/nagios/nrpe.cfg ------> Add to near about line number 220 where you will find already existing hardcoded commands
The following examples use hardcoded command arguments...
command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
Ashish command for nfs plugin
command[check_nfs4]=/usr/local/nagios/libexec/check_nfs
Also Add to line 81 (Becareful here space after comma will give error ;) )
allowed_hosts=127.0.0.1,your-NFS-Server-ip
4) root@Bastion-01:/usr/local/nagios/etc/objects# vim commands.cfg ------> Add
define command{
command_name check_nfs
command_line $USER1$/check_nfs
}
5) root@Bastion-01:/usr/local/nagios/libexec# vim /usr/local/nagios/etc/objects/nagios_Nfs.cfg -----> Add
define service{
use generic-service
host_name Inksedge-NFS-01
service_description NFS
check_command check_nfs
}
6) root@Bastion-01:/usr/local/nagios/libexec# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
7) root@Bastion-01:/usr/local/nagios/libexec# service nagios reload
8) Check Whether nrpe is Communicating with nfs server
root@Bastion-01:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.15 -----> output
root@Bastion-01:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_nrpe -H your-nfs-server-ip
NRPE v2.15 -----> output
On Nfs Server :
1) Check Whether nrpe is Communicating with Nagios server
root@root@NFS-01:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.15 -----> output
root@root@NFS-01:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_nrpe -H your-nagios-server-ip
NRPE v2.15 -----> output
2) Copy same plugin which we used on Nagios server to /usr/lib/nagios/plugins
Note : this path may vary ie it might be /usr/local/nagios/libexec/ depends on your implementation
3) root@NFS-01:/usr/lib/nagios/plugins#
chmod 755 check_nfs
4) root@NFS-01:/usr/lib/nagios/plugins# vim /etc/nagios/nrpe.cfg ------> Add to near about line number 220 where you will find already existing hardcoded commands
The following examples use hardcoded command arguments...
command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
Ashish command for nfs plugin
command[check_nfs4]=/usr/lib/nagios/plugins/check_nfs
Also Add to line 81 (Becareful here space after comma will give error ;) )
allowed_hosts=127.0.0.1,your-Nagios-Server-ip
5) root@NFS-01:/usr/lib/nagios/plugins# /etc/init.d/nagios-nrpe-server restart
Output :
NFS-01
Current Load
OK
06-03-2015 07:40:42
182d 22h 8m 29s
1/3
OK - load average: 0.00, 0.01, 0.05
Current Users
OK
06-03-2015 07:38:20
182d 22h 10m 49s
1/3
USERS OK - 3 users currently logged in
NFS
OK
06-03-2015 07:36:20
0d 19h 36m 27s
1/3
OK - NFS mounts are functioning within normal operating parameters