aboutsummaryrefslogtreecommitdiff
path: root/modules/profile/files/monitoring/check_md_raid
diff options
context:
space:
mode:
Diffstat (limited to 'modules/profile/files/monitoring/check_md_raid')
-rw-r--r--modules/profile/files/monitoring/check_md_raid32
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/profile/files/monitoring/check_md_raid b/modules/profile/files/monitoring/check_md_raid
new file mode 100644
index 0000000..9c79a7a
--- /dev/null
+++ b/modules/profile/files/monitoring/check_md_raid
@@ -0,0 +1,32 @@
1#!/bin/bash
2#
3# Created by Sebastian Grewe, Jammicron Technology
4#
5
6# Get count of raid arrays
7RAID_DEVICES=`grep ^md -c /proc/mdstat`
8
9# Get count of degraded arrays
10RAID_STATUS=`grep "\[.*_.*\]" /proc/mdstat -c`
11
12# Is an array currently recovering, get percentage of recovery
13RAID_RECOVER=`grep recovery /proc/mdstat | awk '{print $4}'`
14
15# Check raid status
16# RAID recovers --> Warning
17if [[ $RAID_RECOVER ]]; then
18 STATUS="WARNING - Checked $RAID_DEVICES arrays, recovering : $RAID_RECOVER"
19 EXIT=1
20# RAID ok
21elif [[ $RAID_STATUS == "0" ]]; then
22 STATUS="OK - Checked $RAID_DEVICES arrays."
23 EXIT=0
24# All else critical, better save than sorry
25else
26 STATUS="CRITICAL - Checked $RAID_DEVICES arrays, $RAID_STATUS have FAILED"
27 EXIT=2
28fi
29
30# Status and quit
31echo $STATUS
32exit $EXIT