95 lines
2.7 KiB
Bash
95 lines
2.7 KiB
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
set -o errexit
|
||
|
|
set -o nounset
|
||
|
|
set -o pipefail
|
||
|
|
|
||
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
|
|
# shellcheck source=00_env.sh
|
||
|
|
source "$SCRIPT_DIR/00_env.sh"
|
||
|
|
|
||
|
|
parse_common_args "$@"
|
||
|
|
require_inputs sg dg vol mount
|
||
|
|
|
||
|
|
missing=0
|
||
|
|
for cmd in hagrp vxdisk vxdg vxprint df findmnt; do
|
||
|
|
require_cmd "$cmd" || missing=1
|
||
|
|
done
|
||
|
|
|
||
|
|
if (( missing != 0 )); then
|
||
|
|
exit 2
|
||
|
|
fi
|
||
|
|
|
||
|
|
status=0
|
||
|
|
ok "Post-check started"
|
||
|
|
log "INFO" "log file: $LOG_FILE"
|
||
|
|
|
||
|
|
group_state="$(hagrp -state "$SERVICE_GROUP" 2>/dev/null || true)"
|
||
|
|
printf '%s\n' "$group_state" | tee -a "$LOG_FILE"
|
||
|
|
if printf '%s\n' "$group_state" | grep -qi "ONLINE"; then
|
||
|
|
ok "service group is online"
|
||
|
|
else
|
||
|
|
critical "service group is not online"
|
||
|
|
status=1
|
||
|
|
fi
|
||
|
|
|
||
|
|
freeze_display="$(hagrp -display "$SERVICE_GROUP" 2>/dev/null | grep -i "Frozen" || true)"
|
||
|
|
printf '%s\n' "$freeze_display" | tee -a "$LOG_FILE"
|
||
|
|
if printf '%s\n' "$freeze_display" | grep -Eqi "(1|true|yes|persistent)"; then
|
||
|
|
ok "service group still appears frozen before unfreeze"
|
||
|
|
else
|
||
|
|
warning "unable to confirm service group freeze state; review before unfreezing"
|
||
|
|
fi
|
||
|
|
|
||
|
|
if vxdg list "$DISKGROUP" >/dev/null 2>&1; then
|
||
|
|
ok "diskgroup imported and visible: $DISKGROUP"
|
||
|
|
else
|
||
|
|
critical "diskgroup not visible: $DISKGROUP"
|
||
|
|
status=1
|
||
|
|
fi
|
||
|
|
|
||
|
|
volume_line="$(vxprint -g "$DISKGROUP" -v "$VOLUME" 2>/dev/null || true)"
|
||
|
|
printf '%s\n' "$volume_line" | tee -a "$LOG_FILE"
|
||
|
|
if printf '%s\n' "$volume_line" | grep -Eqi "(ENABLED|ACTIVE|started|fsgen)"; then
|
||
|
|
ok "volume appears enabled or active"
|
||
|
|
else
|
||
|
|
critical "unable to confirm volume is enabled or active"
|
||
|
|
status=1
|
||
|
|
fi
|
||
|
|
|
||
|
|
if findmnt --target "$MOUNTPOINT" >/dev/null 2>&1; then
|
||
|
|
ok "mountpoint is mounted: $MOUNTPOINT"
|
||
|
|
else
|
||
|
|
critical "mountpoint is not mounted: $MOUNTPOINT"
|
||
|
|
status=1
|
||
|
|
fi
|
||
|
|
|
||
|
|
capture_cmd "Filesystem usage after expansion" df -h "$MOUNTPOINT" || status=1
|
||
|
|
capture_cmd "VxVM layout after expansion" vxprint -g "$DISKGROUP" -ht || status=1
|
||
|
|
capture_cmd "VxVM disk list after expansion" vxdisk list || status=1
|
||
|
|
|
||
|
|
if has_cmd journalctl; then
|
||
|
|
capture_cmd "Recent kernel journal messages" journalctl -k -n 50 || warning "journalctl check failed; review permissions or system logging"
|
||
|
|
else
|
||
|
|
warning "journalctl not found; skipping kernel journal check"
|
||
|
|
fi
|
||
|
|
|
||
|
|
if has_cmd dmesg; then
|
||
|
|
log "INFO" "Recent dmesg messages"
|
||
|
|
log "INFO" "command: dmesg -T | tail -50"
|
||
|
|
if dmesg -T 2>&1 | tail -50 | tee -a "$LOG_FILE"; then
|
||
|
|
ok "captured recent dmesg messages"
|
||
|
|
else
|
||
|
|
warning "dmesg check failed; review permissions or kernel logging"
|
||
|
|
fi
|
||
|
|
else
|
||
|
|
warning "dmesg not found; skipping dmesg check"
|
||
|
|
fi
|
||
|
|
|
||
|
|
if (( status == 0 )); then
|
||
|
|
ok "post-check completed successfully; compare df output with precheck baseline for expected size increase"
|
||
|
|
else
|
||
|
|
critical "post-check found one or more issues"
|
||
|
|
fi
|
||
|
|
|
||
|
|
exit "$status"
|