2012-10-27 04:03:44 |
Jervin R |
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,intr,rsize=32768,wsize=32768,proto=tcp,addr=95.211.156.80,clientaddr=xx.xxx.xxx.xx)
[root@util01 percona]# pt-stalk --collect --no-stalk --dest=/mnt/stor01/revin
2012_10_26_23_39_03 Starting /opt/percona/toolkit/bin/pt-stalk --function=status --variable=Threads_running --threshold=25 --match= --cycles=0 --interval=0 --iterations=1 --run-time=30 --sleep=0 --dest=/mnt/stor01/revin --prefix= --notify-by-email= --log=/var/log/pt-stalk.log --pid=/var/run/pt-stalk.pid
2012_10_26_23_39_03 Not stalking; collect triggered immediately
2012_10_26_23_39_03 Collect triggered
/opt/percona/toolkit/bin/pt-stalk: line 559: 100 - : syntax error: operand expected (error token is "- ")
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/revin/2012_10_26_23_27_25-disk-space
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}') |
[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,intr,rsize=32768,wsize=32768,proto=tcp,addr=xx.xxx.xxx.xx,clientaddr=xx.xxx.xxx.xx)
[root@util01 percona]# pt-stalk --collect --no-stalk --dest=/mnt/stor01/revin
2012_10_26_23_39_03 Starting /opt/percona/toolkit/bin/pt-stalk --function=status --variable=Threads_running --threshold=25 --match= --cycles=0 --interval=0 --iterations=1 --run-time=30 --sleep=0 --dest=/mnt/stor01/revin --prefix= --notify-by-email= --log=/var/log/pt-stalk.log --pid=/var/run/pt-stalk.pid
2012_10_26_23_39_03 Not stalking; collect triggered immediately
2012_10_26_23_39_03 Collect triggered
/opt/percona/toolkit/bin/pt-stalk: line 559: 100 - : syntax error: operand expected (error token is "- ")
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/revin/2012_10_26_23_27_25-disk-space
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}') |
|