I introduced how to setup NFSv3/v4 Server in the last session,
NFSv3/v4 setup & monitoring. Then, I'd like to show you how to monitor NFSv3/v4 servers with nagios plugins.
NFSv3 NFS Server
- verify the status with nagios plugins, check_rpc while nfs and portmap are running
# /etc/init.d/nfs status
rpc.mountd (pid 21781) を実行中...
nfsd (pid 21778 21777 21776 21775 21774 21773 21772 21771) を実行中...
# /etc/init.d/portmap status
portmap (pid 10609) を実行中...
# ps awuxc | egrep '(nfs|portmap|idmapd)'
rpc 29800 0.0 0.0 8072 676 ? Ss 20:42 0:00 portmap
root 29915 0.0 0.0 0 0 ? S< 20:42 0:00 nfsd4
root 29917 0.0 0.0 0 0 ? S 20:42 0:00 nfsd
root 29918 0.0 0.0 0 0 ? S 20:42 0:00 nfsd
root 29919 0.0 0.0 0 0 ? S 20:42 0:00 nfsd
root 29920 0.0 0.0 0 0 ? S 20:42 0:00 nfsd
root 29921 0.0 0.0 0 0 ? S 20:42 0:00 nfsd
root 29922 0.0 0.0 0 0 ? S 20:42 0:00 nfsd
root 29923 0.0 0.0 0 0 ? S 20:42 0:00 nfsd
root 29924 0.0 0.0 0 0 ? S 20:42 0:00 nfsd
# rpcinfo -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 773 status
100024 1 tcp 776 status
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100021 1 udp 53048 nlockmgr
100021 3 udp 53048 nlockmgr
100021 4 udp 53048 nlockmgr
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 tcp 37837 nlockmgr
100021 3 tcp 37837 nlockmgr
100021 4 tcp 37837 nlockmgr
100005 3 udp 892 mountd
100005 3 tcp 892 mountd
# check_rpc -H localhost -t -C nfs
OK: RPC program nfs version 2 version 3 version 4 tcp running
- verify the status while nfs is stopping
# /etc/init.d/nfs stop
NFS mountd を終了中: [ OK ]
NFS デーモンを終了中: [ OK ]
NFS サービスを終了中: [ OK ]
# check_rpc -H localhost -t -C nfs
CRIICAL: RPC program nfs tcp is not running
- verify the status while nfs and portmap are stopping
# /etc/init.d/portmap stop
portmap を停止中: [ OK ]
# check_rpc -H localhost -t -C nfs
CRITICAL: RPC program nfs tcp is not running
NFSv4 NFS Server
We are going to use the nagios plugins, check_nfs4.0.2.pl to verify the status of nfs v4 server.
- verify the status with nagios plugins, check_nfsv4.0.2.pl while nfs, portmap, and rpcidmapd are running
# /etc/init.d/nfs status
rpc.mountd (pid 21781) を実行中...
nfsd (pid 21778 21777 21776 21775 21774 21773 21772 21771) を実行中...
# /etc/init.d/portmap status
portmap (pid 10609) を実行中...
# /etc/init.d/rpcidmapd status
rpc.idmapd (pid 18346) を実行中...
# ps awuxc | egrep '(nfs|portmap|idmapd)'
root 8102 0.0 0.0 0 0 ? S< Jan02 0:00 nfsiod
rpc 10609 0.0 0.0 8052 580 ? Ss 11:44 0:00 portmap
root 18346 0.0 0.0 55180 1008 ? Ss 12:20 0:00 rpc.idmapd
root 21770 0.0 0.0 0 0 ? S< 12:35 0:00 nfsd4
root 21771 0.0 0.0 0 0 ? S 12:35 0:00 nfsd
root 21772 0.0 0.0 0 0 ? S 12:35 0:00 nfsd
root 21773 0.0 0.0 0 0 ? S 12:35 0:00 nfsd
root 21774 0.0 0.0 0 0 ? S 12:35 0:00 nfsd
root 21775 0.0 0.0 0 0 ? S 12:35 0:00 nfsd
root 21776 0.0 0.0 0 0 ? S 12:35 0:00 nfsd
root 21777 0.0 0.0 0 0 ? S 12:35 0:00 nfsd
root 21778 0.0 0.0 0 0 ? S 12:35 0:00 nfsd
# rpcinfo -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100011 1 udp 870 rquotad
100011 2 udp 870 rquotad
100011 1 tcp 873 rquotad
100011 2 tcp 873 rquotad
100003 4 tcp 2049 nfs
100021 1 udp 32769 nlockmgr
100021 3 udp 32769 nlockmgr
100021 4 udp 32769 nlockmgr
100021 1 tcp 32803 nlockmgr
100021 3 tcp 32803 nlockmgr
100021 4 tcp 32803 nlockmgr
100005 3 udp 757 mountd
100005 3 tcp 760 mountd
# ./check_nfs4.0.2.pl -v
OK: nfsd cpu = 0% ; nfsd threads = 8 ; nfsd used threads <= 10% ; Server badcalls = 19 ; Server badauth = 19 |nfsd_cpu=0% nfsd_used_threads=10% io_read=0% io_write=0%
- verify the status while rpcidmapd is stopping
# /etc/init.d/rpcidmapd stop
Stopping RPC idmapd: [ OK ]
# ./check_nfs4.0.2.pl -v
CRITICAL: nfsd cpu = 0% ; nfsd threads = 8 ; nfsd used threads <= 10% ; daemon idmapd is not running ; Server badcalls = 19 ; Server badauth = 19 |nfsd_cpu=0% nfsd_used_threads=10% io_read=0% io_write=0%
- verify the status while rpcidmapd and nfs are stopping
# /etc/init.d/nfs stop
NFS mountd を終了中: [ OK ]
NFS デーモンを終了中: [ OK ]
NFS サービスを終了中: [ OK ]
# ./check_nfs4.0.2.pl -v
CRITICAL: nfsd cpu = 0% ; nfsd threads = 0 ; nfsd used threads <= 10% ; daemons idmapd nfsd mountd are not running ; Server badcalls = 19 ; Server badauth = 19 |nfsd_cpu=0% nfsd_used_threads=10% io_read=0% io_write=0%
- verify the status while rpcidmapd, nfs and portmap are stopping
# /etc/init.d/portmap stop
portmap を停止中: [ OK ]
# ./check_nfs4.0.2.pl -v
OK: nfsd cpu = 0% ; nfsd threads = 8 ; nfsd used threads <= 10% ; Server badcalls = 19 ; Server badauth = 19 |nfsd_cpu=0% nfsd_used_threads=10% io_read=0% io_write=0%
NFSv4 NFS Server
check_nfsv4.0.2.pl is enable to verify the status of nfsv4 client, too.
- verify the status while portmap and rpcidmapd are running
# /etc/init.d/portmap status
portmap (pid 30107) を実行中...
# /etc/init.d/rpcidmapd status
rpc.idmapd (pid 30002) を実行中...
# ./check_nfs4.0.2.pl -i -v
OK: |
- verify the status while rpcidmapd is stopping
# /etc/init.d/rpcidmapd stop
Stopping RPC idmapd: [ OK ]
# ./check_nfs4.0.2.pl -i -v
CRITICAL: daemon idmapd is not running |
- verify the status while portmap is stopping
# /etc/init.d/portmap stop
portmap を停止中: [ OK ]
# ./check_nfs4.0.2.pl -i -v
OK: |
- verify the status while portmap and rpcidmapd are stopping
# /etc/init.d/rpcidmapd stop
Stopping RPC idmapd: [ OK ]
# /etc/init.d/portmap stop
portmap を停止中: [ OK ]
# ./check_nfs4.0.2.pl -i -v
CRITICAL: daemon idmapd is not running |
These are the examples of services.cfg in the nagios configuration file, below.
- common setting with visudo for nagios user between nfs server and client.
nagios ALL=(ALL) NOPASSWD: ALL
- commands.cfg for check_by_ssh
define command{
command_name check_by_ssh_pub
command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ -i /usr/local/nagios/.ssh/id_rsa -l nagios -p $ARG1$ -t $ARG2$ -C $ARG3$
}
define service{
use generic-service
host_name nfsv3_server
service_description NFSv3:Server
check_command check_by_ssh_pub!22!60!"/usr/local/nagios/libexec/check_rpc -H localhost -t -C nfs"
}
define service{
use generic-service
host_name nfsv4_server
service_description NFSv4:Server
check_command check_by_ssh_pub!22!60!"/usr/bin/sudo /usr/local/nagios/libexec/check_nfs4.0.2.pl -v"
}
define service{
use generic-service
host_name nfsv4_client
service_description NFSv4:Client
check_command check_by_ssh_pub!22!60!"/usr/bin/sudo /usr/local/nagios/libexec/check_nfs4.0.2.pl -v"
}
No comments:
Post a Comment