summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/check_nfs.pl
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts/check_nfs.pl')
-rwxr-xr-xplugins-scripts/check_nfs.pl48
1 files changed, 48 insertions, 0 deletions
diff --git a/plugins-scripts/check_nfs.pl b/plugins-scripts/check_nfs.pl
new file mode 100755
index 00000000..040466d3
--- /dev/null
+++ b/plugins-scripts/check_nfs.pl
@@ -0,0 +1,48 @@
1#!/usr/local/bin/perl
2#
3# check_nfs plugin for nagios
4#
5# usage:
6# check_nfs.pl server
7#
8# Check if a nfs server is registered and running
9# using rpcinfo -T udp <arg1> 100003.
10# 100003 is the rpc programmnumber for nfs.
11# <arg1> is the server queried.
12#
13#
14# Use these hosts.cfg entries as examples
15#
16#service[fs0]=NFS;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_nfs
17#command[check_nfs]=/some/path/libexec/check_nfs.pl $HOSTADDRESS$
18#
19# initial version: 9-13-99 Ernst-Dieter Martin edmt@infineon.com
20# current status: looks like working
21#
22#
23# Copyright Notice: Do as you please, credit me, but don't blame me
24#
25
26
27$server = shift;
28
29
30open CMD,"/bin/rpcinfo -T udp $server 100003 |";
31
32$response = "nfs version ";
33
34while ( <CMD> ) {
35 if ( /program 100003 version ([0-9]*) ready and waiting/ ) {
36 $response = $ response . "$1,";
37 }
38}
39
40if ( $response eq "nfs version " ) {
41 print "rpcinfo: RPC: Program not registered\n";
42 exit 2;
43}
44
45$response =~ s/,$//;
46print "$response\n";
47
48exit 0;