From 168df166590c264c05a7385776d80c30591a6ba6 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 26 Apr 2018 20:00:34 +0000
Subject: xymon: closes #1012

---
 abs/core/xymon/PKGBUILD         | 6 +++---
 abs/core/xymon/xymon-hddtemp.sh | 8 ++++++--
 abs/core/xymon/xymon-smart.sh   | 8 ++++++--
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/abs/core/xymon/PKGBUILD b/abs/core/xymon/PKGBUILD
index b06cc43..76bf18d 100755
--- a/abs/core/xymon/PKGBUILD
+++ b/abs/core/xymon/PKGBUILD
@@ -1,7 +1,7 @@
 pkgbase=xymon
 pkgname=('xymonserver' 'xymonclient')
 pkgver=4.3.28
-pkgrel=6
+pkgrel=7
 pkgdesc="Xymon is a system for monitoring of hosts and networks"
 license=('GPL')
 arch=('i686' 'x86_64')
@@ -204,8 +204,8 @@ md5sums=('14501ab2cfce9a332c1590543dfcbd0f'
          'a19c8c546dcd95049476bb19f9d4e3ae'
          'c60b0d59bb39505ee3d62c6dd65429c5'
          'd4710f9aaa5aef0c9d0a26fa7d94450f'
-         'b49e7de696c1a0678ad198bab926266c'
-         'e071c387deac6b896b20db19903b7794'
+         'c4e1575db32c633a531df9514d83aa82'
+         '281a5031824c8d98b4e541fed6da09ed'
          '1a00c0b9b9b1a37f1513fa8489ce9d31'
          '3d1f311f0142f41d763276302a7ce396'
          'c75c434ba9c39a914e7693004b580554'
diff --git a/abs/core/xymon/xymon-hddtemp.sh b/abs/core/xymon/xymon-hddtemp.sh
index 7084abc..0369b4a 100755
--- a/abs/core/xymon/xymon-hddtemp.sh
+++ b/abs/core/xymon/xymon-hddtemp.sh
@@ -2,7 +2,7 @@
 
 # NOTE: Must be run as root, so you probably need to setup sudo for this.
 
-ls /dev/disk/by-id/* | grep -ve '-part' -ve '/wwn-' |
+ls /dev/disk/by-id/* | grep -ve '-part' -ve '/wwn-' -ve '/md' |
 while read DISK
 do
     DISKDEV=`ls -l $DISK | awk -F/ '{print $NF}'`
@@ -17,7 +17,11 @@ do
     #check if device is mounted
     if ! mount | grep -q /dev/$DISKDEV
     then
-        continue
+        # check if device is used by mdadm
+        if ! cat /proc/mdstat | grep -q $DISKDEV
+        then
+            continue
+        fi
     fi
 
     #check if SMART is disabled and enable
diff --git a/abs/core/xymon/xymon-smart.sh b/abs/core/xymon/xymon-smart.sh
index 7c10db5..8998778 100755
--- a/abs/core/xymon/xymon-smart.sh
+++ b/abs/core/xymon/xymon-smart.sh
@@ -4,7 +4,7 @@
 
 if test -f /tmp/dres; then rm -f /tmp/dres; fi
 
-ls /dev/disk/by-id/* | grep -ve '-part' -ve '/wwn-' |
+ls /dev/disk/by-id/* | grep -ve '-part' -ve '/wwn-' -ve '/md-' |
 while read DISK
 do
     DISKDEV=`ls -l $DISK | awk -F/ '{print $NF}'`
@@ -18,7 +18,11 @@ do
     #check if device is mounted
     if ! mount | grep -q /dev/$DISKDEV
     then
-        continue
+        # check if device is used by mdadm
+        if ! cat /proc/mdstat | grep -q $DISKDEV
+        then
+            continue
+        fi
     fi
 
     DRES=`sudo /usr/bin/smartctl -H -n standby $DISK`
-- 
cgit v0.12

