summaryrefslogtreecommitdiff
path: root/print-status
blob: f28821add6c967d8375dc260b271353d791049bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

{
  find /dev/mapper -mindepth 1 -maxdepth 1 \( -name 'leg*' -o -name 'foot*' \) -printf '%f\n' \
    | sort -u \
    | xargs -rn1 cryptsetup status \
    | grep -v '^\s\+device:'
  sed -n '
    /^Personalities/d
    /^\S/ {
      N
      s/^\(\S\+\)\s*:.*\n\s*\([0-9]\)/\1: \2/
      T
      p
    }
  ' /proc/mdstat \
    | sort -u
  find /sys/block/ -mindepth 1 -maxdepth 1 -name 'md*' -printf '%f: ' -exec cat {}/md/mismatch_cnt \; \
    | sort -u
  ssacli ctrl slot=1 ld all show \
    | grep -v '^\s*$'
} | \
  if mountpoint -q /srv/http/tmp; then
    sponge /srv/http/tmp/status
    date +%s > /srv/http/tmp/status.time
  else
    cat
  fi