aboutsummaryrefslogtreecommitdiff
path: root/modules/profile/files/monitoring/check_md_raid
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-07-01 15:35:43 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-07-08 13:29:25 +0200
commitd8f933bd00a5cc416da00cd26c9d13f7a1c02486 (patch)
tree6f8773b69418463485d1196389a6c264f3cf3a6e /modules/profile/files/monitoring/check_md_raid
parent25c99a635507abfe6af4a1f0a9fc5a103d1880c0 (diff)
downloadPuppet-d8f933bd00a5cc416da00cd26c9d13f7a1c02486.tar.gz
Puppet-d8f933bd00a5cc416da00cd26c9d13f7a1c02486.tar.zst
Puppet-d8f933bd00a5cc416da00cd26c9d13f7a1c02486.zip
Add monitoring
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