Module: check_mk
Branch: master
Commit: 0a8ff5a905f64e851ebd9caa04380b6bf234d1f5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0a8ff5a905f64e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Aug 23 19:22:54 2014 +0200
#1376 dmraid: moved plugin code into normal Linux agent
The agent plugin <tt>dmraid</tt> for monitoring Linux software RAID via
device mapper has been moved into the main Linux agent. This is done
for simplification and for consitancy with the other RAID monitoring.
---
.werks/1376 | 11 +++++++++++
ChangeLog | 1 +
agents/check_mk_agent.linux | 45 +++++++++++++++++++++++++++++--------------
agents/plugins/dmraid | 43 -----------------------------------------
checks/dmraid | 11 +++++------
5 files changed, 48 insertions(+), 63 deletions(-)
diff --git a/.werks/1376 b/.werks/1376
new file mode 100644
index 0000000..31586d1
--- /dev/null
+++ b/.werks/1376
@@ -0,0 +1,11 @@
+Title: dmraid: moved plugin code into normal Linux agent
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i6
+Date: 1408814499
+Class: feature
+
+The agent plugin <tt>dmraid</tt> for monitoring Linux software RAID via
+device mapper has been moved into the main Linux agent. This is done
+for simplification and for consitancy with the other RAID monitoring.
diff --git a/ChangeLog b/ChangeLog
index 8fdba52..4aabe78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -34,6 +34,7 @@
* 1374 arc_raid_status: moved plugin into main Linux agent...
NOTE: Please refer to the migration notes!
* 1375 vxvm_enclosures, vxvm_multipath, vxvm_objstatus: joined into one agent plugin
called vxvm...
+ * 1376 dmraid: moved plugin code into normal Linux agent...
* 1051 FIX: tcp_conn_stats: fix missing performance data...
* 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
* 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 626d967..9816929 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -226,22 +226,12 @@ echo '<<<tcp_conn_stats>>>'
# New implementation: netstat is very slow for large TCP tables
cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | awk ' /:/ { c[$4]++; } END { for (x
in c) { print x, c[x]; } }'
-# Platten- und RAID-Status von LSI-Controlleren, falls vorhanden
-if type cfggen > /dev/null ; then
- echo '<<<lsi>>>'
- cfggen 0 DISPLAY | egrep '(Target ID|State|Volume ID|Status of
volume)[[:space:]]*:' | sed -e 's/ *//g' -e 's/:/ /'
-fi
-
-# Multipathgeraete
+# Linux Multipathing
if type multipath >/dev/null ; then
echo '<<<multipath>>>'
multipath -l
fi
-# Soft-RAID
-echo '<<<md>>>'
-cat /proc/mdstat
-
# Performancecounter Platten
echo '<<<diskstat>>>'
date +%s
@@ -313,9 +303,36 @@ then
) 200>>"$sdrcache"
fi
-# State of LSI MegaRAID controller via MegaCli. You can download that tool from:
-#
http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Files/8.02.16_MegaC…
+# RAID status of Linux software RAID
+echo '<<<md>>>'
+cat /proc/mdstat
+
+# RAID status of Linux RAID via device mapper
+if type dmraid >/dev/null && DMSTATUS=$(dmraid -r)
+then
+ echo '<<<dmraid>>>'
+
+ # Output name and status
+ dmraid -s | grep -e ^name -e ^status
+
+ # Output disk names of the RAID disks
+ DISKS=$(echo "$DMSTATUS" | cut -f1 -d\:)
+
+ for disk in $DISKS ; do
+ device=$(cat /sys/block/$(basename $disk)/device/model )
+ status=$(echo "$DMSTATUS" | grep ^${disk})
+ echo "$status Model: $device"
+ done
+fi
+# RAID status of LSI controllers via cfggen
+if type cfggen > /dev/null ; then
+ echo '<<<lsi>>>'
+ cfggen 0 DISPLAY | egrep '(Target ID|State|Volume ID|Status of
volume)[[:space:]]*:' | sed -e 's/ *//g' -e 's/:/ /'
+fi
+
+# RAID status of LSI MegaRAID controller via MegaCli. You can download that tool from:
+#
http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Files/8.02.16_MegaC…
if type MegaCli >/dev/null ; then
MegaCli_bin="MegaCli"
elif type MegaCli64 >/dev/null ; then
@@ -340,7 +357,7 @@ if [ "$MegaCli_bin" != "unknown" ]; then
$MegaCli_bin -AdpBbuCmd -GetBbuStatus -aALL -NoLog < /dev/null | grep -v Exit
fi
-# 3WARE disk controller (by Radoslaw Bak)
+# RAID status of 3WARE disk controller (by Radoslaw Bak)
if type tw_cli > /dev/null ; then
for C in $(tw_cli show | awk 'NR < 4 { next } { print $1 }'); do
echo '<<<3ware_info>>>'
diff --git a/agents/plugins/dmraid b/agents/plugins/dmraid
deleted file mode 100755
index e3c0b12..0000000
--- a/agents/plugins/dmraid
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh
-# +------------------------------------------------------------------+
-# | ____ _ _ __ __ _ __ |
-# | / ___| |__ ___ ___| | __ | \/ | |/ / |
-# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
-# | | |___| | | | __/ (__| < | | | | . \ |
-# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
-# | |
-# | Copyright Mathias Kettner 2013 mk(a)mathias-kettner.de |
-# +------------------------------------------------------------------+
-#
-# This file is part of Check_MK.
-# The official homepage is at
http://mathias-kettner.de/check_mk.
-#
-# check_mk is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation in version 2. check_mk is distributed
-# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
-# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE. See the GNU General Public License for more de-
-# ails. You should have received a copy of the GNU General Public
-# License along with GNU Make; see the file COPYING. If not, write
-# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-# Boston, MA 02110-1301 USA.
-
-echo '<<<dmraid>>>'
-
-STATUS=$(dmraid -r)
-if [ $? != 0 ]; then
- exit 1
-fi
-
-# Name und Status ausgeben
-dmraid -s | grep -e ^name -e ^status
-
-# Diskname der Raidplatten ausgeben
-DISKS=$(echo "$STATUS" | cut -f1 -d\:)
-
-for disk in $DISKS ; do
- device=$(cat /sys/block/$(basename $disk)/device/model )
- status=$(echo "$STATUS" | grep ^${disk})
- echo "$status Model: $device"
-done
diff --git a/checks/dmraid b/checks/dmraid
index 93f40ad..20da853 100644
--- a/checks/dmraid
+++ b/checks/dmraid
@@ -27,14 +27,13 @@
# Author: Markus Lengler <ml(a)lengler-it.de>
-
# Example outputs from agent:
#
-#<<<dmraid>>>
-#name : isw_ebdabbedfh_system
-#status : ok
-#/dev/sda: isw, "isw_ebdabbedfh", GROUP, ok, 976773166 sectors, data@ 0 Model:
WDC WD5002ABYS-5
-#/dev/sdb: isw, "isw_ebdabbedfh", GROUP, ok, 976773166 sectors, data@ 0 Model:
WDC WD5002ABYS-5
+# <<<dmraid>>>
+# name : isw_ebdabbedfh_system
+# status : ok
+# /dev/sda: isw, "isw_ebdabbedfh", GROUP, ok, 976773166 sectors, data@ 0 Model:
WDC WD5002ABYS-5
+# /dev/sdb: isw, "isw_ebdabbedfh", GROUP, ok, 976773166 sectors, data@ 0 Model:
WDC WD5002ABYS-5
def inventory_dmraid(checkname, info):