Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to deal with lvs regional formatting #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pmp-check-lvm-snapshots
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ check_lvm_snapshot_fullness() {
local FILE="$1"
local FULL="$2"
awk -v full="$FULL" '
$1 != "LV" && $1 != "File" && $6 !~ /[^0-9.]/ && $6 > full {
$1 != "LV" && $1 != "File" && $6 !~ /[^0-9.,]/ && $6 > full {
print $2 "/" $1 "[" $5 "]=" $6 "%"
}' "${FILE}"
}
Expand Down Expand Up @@ -81,11 +81,11 @@ main() {
elif grep 'WARNING: Running as a non-root user' "${TEMP}" >/dev/null 2>&1; then
NOTE="UNK You must execute lvs with root privileges"
else
local VOLS=$(check_lvm_snapshot_fullness "${TEMP}" "${OPT_CRIT}")
local VOLS="$(check_lvm_snapshot_fullness "${TEMP}" "${OPT_CRIT}")"
if [ "${VOLS}" ]; then
NOTE="CRIT LVM snapshot volumes over ${OPT_CRIT}% full: ${VOLS}"
else
VOLS=$(check_lvm_snapshot_fullness "${TEMP}" "${OPT_WARN}")
VOLS="$(check_lvm_snapshot_fullness "${TEMP}" "${OPT_WARN}")"
if [ "${VOLS}" ]; then
NOTE="WARN LVM snapshot volumes over ${OPT_WARN}% full: ${VOLS}"
fi
Expand Down