forked from lelutin/nagios-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_nfs_local
executable file
·41 lines (36 loc) · 1.27 KB
/
check_nfs_local
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
#
# Verify that services needed for NFS to work are correctly running
# This is a debian-specific check since it uses exit codes from service init scripts.
#
# Note: this is not the panacea of all NFS checks. The real deal should be to
# actually open rpc connections from another server and verify that nfs is
# working correctly. However, because of some limitations if you can't open up
# rpc connections from your nagios servers to the NFS server the current check
# should help out monitoring at least if services are supposed to be running.
#
# Copyleft Gabriel Filion
#
# This plugin is released under the GPL v3+ license. To get a copy of the
# license text visit: https://www.gnu.org/licenses/gpl-3.0.txt
#
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4
check_service() {
service $1 status >/dev/null
if [ "$?" -ne 0 ]; then
echo "CRITICAL: service $1 not running correctly!"
exit $STATE_CRITICAL
fi
}
check_service rpcbind
# nfs-common manages multiple services, but status should be a good indicator
# of whether something is amiss. if in doubt with a critical status with
# regards to nfs-common, just run "service nfs-common restart"
check_service nfs-common
check_service nfs-kernel-server
echo "OK: all services running"
exit $STATE_OK