Module: check_mk
Branch: master
Commit: f619ed43d0b754a39a9a08e324cdbe8f1e4fcfc8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f619ed43d0b754…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Mon Apr 23 15:27:47 2018 +0200
5915 nfsexports: Added support for NFS exporting via ZFS
With this patch in the plugin nfsexports.solaris the support for ZFS is
added. If ZFS is available and there are no other exports in /etc/dfs/dfstab.
You need to replace you plugin with the new version to benefit from this
change.
Change-Id: Id0146b2dc15d0c80fc45396e6b131025dc181bba
---
.werks/5915 | 14 ++++++++++++++
agents/plugins/nfsexports.solaris | 29 +++++++++++++++++------------
2 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/.werks/5915 b/.werks/5915
new file mode 100644
index 0000000..a6a133d
--- /dev/null
+++ b/.werks/5915
@@ -0,0 +1,14 @@
+Title: nfsexports: Added support for NFS exporting via ZFS
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1524489614
+Class: feature
+
+With this patch in the plugin nfsexports.solaris the support for ZFS is
+added. If ZFS is available and there are no other exports in /etc/dfs/dfstab.
+
+You need to replace you plugin with the new version to benefit from this
+change.
diff --git a/agents/plugins/nfsexports.solaris b/agents/plugins/nfsexports.solaris
index ba571a0..858682f 100755
--- a/agents/plugins/nfsexports.solaris
+++ b/agents/plugins/nfsexports.solaris
@@ -27,31 +27,36 @@
# has been tested with solaris 10 in a standalone and cluster setting.
clusterconfigdir="/etc/cluster/ccr/global/directory"
-if [ -r $clusterconfigdir ]; then
+if [ -r "$clusterconfigdir" ]; then
# is a clustered nfs server
- nfsconfig=/etc/cluster/ccr/global/`grep rgm $clusterconfigdir | grep nfs | grep rg_`
- if [ -r $nsconfig ]; then
- Pathprefix=`grep Pathprefix $nfsconfig | awk {'print $2'}`/SUNW.nfs
- dfstabfile=$Pathprefix/dfstab.`grep -v FilesystemMountPoints $nfsconfig | grep
SUNW.nfs | \
- awk {'print $1'} | sed -e 's/RS_//'`
- if [ -r $dfstabfile ]; then
- EXPORTS=`grep -v ^# $dfstabfile | grep -v ^$`
- ps -aef | grep nfsd | grep $Pathprefix >/dev/null &&
DAEMONS="ok"
+ nfsconfig=/etc/cluster/ccr/global/$(grep rgm $clusterconfigdir | grep nfs | grep
rg_)
+ if [ -r "$nfsconfig" ]; then
+ Pathprefix=$(grep Pathprefix "$nfsconfig" | awk {'print
$2'})/SUNW.nfs
+ dfstabfile=$Pathprefix/dfstab.$(grep -v FilesystemMountPoints
"$nfsconfig" | grep SUNW.nfs | \
+ awk {'print $1'} | sed -e 's/RS_//')
+ if [ -r "$dfstabfile" ]; then
+ EXPORTS=$(grep -v ^\# "$dfstabfile" | grep -v ^$)
+ ps -aef | grep nfsd | grep "$Pathprefix" >/dev/null &&
DAEMONS="ok"
fi
fi
else
# is a standalone nfs server
dfstabfile="/etc/dfs/dfstab"
if [ -r $dfstabfile ]; then
- EXPORTS=`grep -v ^# $dfstabfile | grep -v ^$`
+ EXPORTS=$(grep -v ^\# $dfstabfile | grep -v ^$)
+ elif [ -x /usr/sbin/zfs ]; then
+ EXPORTS=$(zfs get sharenfs)
+ fi
+
+ if [ -n "$EXPORTS" ]; then
svcs -a | grep nfs/server | grep ^online >/dev/null &&
DAEMONS="ok"
fi
fi
# any exports or have running daemons? then look for registered exports
-if [ "$EXPORTS" ]; then
+if [ -n "$EXPORTS" ]; then
echo "<<<nfsexports>>>"
- if [ "$DAEMONS" ]; then
+ if [ -n "$DAEMONS" ]; then
showmount -e | grep ^/
fi
fi