aboutsummaryrefslogtreecommitdiff
path: root/modules/pkgs/check_mdstat/check_mdstat
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2018-12-11 18:10:48 +0300
committerIgor Pashev <pashev.igor@gmail.com>2018-12-11 18:10:48 +0300
commit8b0968b2054d3bb8d90b5ac056727f7c2ebeaed3 (patch)
treed03b70f693463fc836a8dbe4240424d2547530c8 /modules/pkgs/check_mdstat/check_mdstat
parentc4273035cf5876e3ba8ed2c6b492d31c2de290ee (diff)
downloadnixsap-8b0968b2054d3bb8d90b5ac056727f7c2ebeaed3.tar.gz
(* HUGE *) Use nixpkgs overlays
Diffstat (limited to 'modules/pkgs/check_mdstat/check_mdstat')
-rwxr-xr-xmodules/pkgs/check_mdstat/check_mdstat50
1 files changed, 0 insertions, 50 deletions
diff --git a/modules/pkgs/check_mdstat/check_mdstat b/modules/pkgs/check_mdstat/check_mdstat
deleted file mode 100755
index 32fc168..0000000
--- a/modules/pkgs/check_mdstat/check_mdstat
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env bash
-
-stat=/proc/mdstat
-
-if [ ! -e "$stat" ]; then
- echo "WARNING: $stat does not exist"
- exit 1
-fi
-
-if [ ! -r "$stat" ]; then
- echo "WARNING: cannot read $stat"
- exit 1
-fi
-
-count=$(grep ^md -c "$stat")
-
-if [ "$count" -eq 0 ]; then
- echo 'WARNING: no arrays found.'
- exit 1
-elif [ "$count" -eq 1 ]; then
- out="Linux Software RAID: $count array"
-else
- out="Linux Software RAID: $count arrays"
-fi
-
-degrated=$(grep -c '\[.*_.*\]' "$stat")
-recovering=$(awk '/recovery/ {print $4}' "$stat")
-resyncing=$(awk '/resync/ {print $4}' "$stat")
-
-if [ -n "$recovering" ]; then
- out="$out, recovering: $recovering"
-elif [ -n "$resyncing" ]; then
- out="$out, resyncing: $resyncing"
-elif [ "$degrated" -gt 0 ]; then
- out="$out, degrated: $degrated"
-fi
-
-if [ "$degrated" -gt 0 ]; then
- echo "CRITICAL: $out."
- exit 2
-fi
-
-if [ -n "$recovering$resyncing" ]; then
- echo "WARNING: $out."
- exit 1
-fi
-
-echo "OK: $out."
-exit 0
-