pt-stak error parsing df with NFS
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
High
|
Daniel Nichter |
Bug Description
[root@util01 percona]# pt-stalk --version
pt-stalk 2.1.5
[root@util01 percona]# mount | grep stor
xx.xxx.xxx.xx:/ on /mnt/stor01 type nfs4 (rw,soft,
[root@util01 percona]# pt-stalk --collect --no-stalk --dest=
2012_10_26_23_39_03 Starting /opt/percona/
2012_10_26_23_39_03 Not stalking; collect triggered immediately
2012_10_26_23_39_03 Collect triggered
/opt/percona/
This is because the current perl based pattern matching will not match the results on the *-disk-space file based on the leading hostname.
On pt-stalk:
556 local used_bytes=$(perl -ane 'm!^/! && print $F[2] * 1024' "$file")
557 local free_bytes=$(perl -ane 'm!^/! && print $F[3] * 1024' "$file")
558 local pct_used=$(perl -ane 'm!^/! && print ($F[4] =~ m/(\d+)/)' "$file")
559 local pct_free=$((100 - $pct_used))
Sample disk-space:
[root@util01 percona]# cat /mnt/stor01/
Filesystem 1024-blocks Used Available Capacity Mounted on
xx.xxx.xxx.xxx:/ 1918433376 1052659424 768323200 58% /mnt/stor01
Maybe something like this could work since the contents of disk-space is deterministic, though Im not sure if this will work in all cases.
555,558c555,557
<
< local used_bytes=$(perl -ane 'm!^/! && print $F[2] * 1024' "$file")
< local free_bytes=$(perl -ane 'm!^/! && print $F[3] * 1024' "$file")
< local pct_used=$(perl -ane 'm!^/! && print ($F[4] =~ m/(\d+)/)' "$file")
---
> local used_bytes=$(cat "$file"|tail -n1|awk '{print $2}')
> local free_bytes=$(cat "$file"|tail -n1|awk '{print $3}')
> local pct_used=$(cat "$file"|tail -n1|awk '{print $4}')
Related branches
- Daniel Nichter: Approve
-
Diff: 61 lines (+16/-8)4 files modifiedbin/pt-stalk (+3/-4)
lib/bash/safeguards.sh (+3/-4)
t/lib/bash/safeguards.sh (+8/-0)
t/lib/samples/bash/diskspace002.txt (+2/-0)
description: | updated |
tags: | added: crash nfs pt-stalk |
Changed in percona-toolkit: | |
status: | New → Triaged |
summary: |
- pt-stak bails out when checking disk space free for NFS based - destination + pt-stak error parsing df with NFS |
Changed in percona-toolkit: | |
milestone: | none → 2.2.6 |
assignee: | nobody → Daniel Nichter (daniel-nichter) |
importance: | Undecided → High |
status: | Triaged → In Progress |
tags: | added: percona-36390 |
Changed in percona-toolkit: | |
status: | In Progress → Fix Committed |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
Iirc, we can't use awk to print potentially very large numbers because on 32-bit systems such numbers don't fit in a single 4-byte integer; that's why we use Perl. I could be mistaken (maybe the problem was elsewhere), but in any case, I have made a similar patch.