aboutsummaryrefslogtreecommitdiff
path: root/modules/profile/files/monitoring/check_md_raid
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-07-11 09:31:24 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-07-11 09:31:24 +0200
commit2bdbb0213a0f70705f81ac2eaf8349668b2c29b4 (patch)
tree06b1e40db99815133dcc40e3e68531d45e1bd228 /modules/profile/files/monitoring/check_md_raid
parent25c99a635507abfe6af4a1f0a9fc5a103d1880c0 (diff)
parentd8bc769648c1528f5d749deee060d70e326ef431 (diff)
downloadPuppet-2bdbb0213a0f70705f81ac2eaf8349668b2c29b4.tar.gz
Puppet-2bdbb0213a0f70705f81ac2eaf8349668b2c29b4.tar.zst
Puppet-2bdbb0213a0f70705f81ac2eaf8349668b2c29b4.zip
Merge branch 'monitoring' into dev
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