Merge lp:~percona-toolkit-dev/percona-toolkit/bash-tool-testing into lp:percona-toolkit/1.0

Proposed by Daniel Nichter
Status: Merged
Approved by: Daniel Nichter
Approved revision: 87
Merged at revision: 80
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/bash-tool-testing
Merge into: lp:percona-toolkit/1.0
Diff against target: 8959 lines (+3873/-3740)
123 files modified
bin/pt-diskstats (+11/-15)
bin/pt-mysql-summary (+76/-66)
bin/pt-pmp (+20/-21)
bin/pt-summary (+130/-117)
t/pt-diskstats/group-by-all-01 (+0/-41)
t/pt-diskstats/group-by-disk-01 (+0/-14)
t/pt-diskstats/group-by-disk-02 (+0/-8)
t/pt-diskstats/group-by-disk-03 (+0/-13)
t/pt-diskstats/group-by-disk-04 (+0/-11)
t/pt-diskstats/group-by-disk-05 (+0/-14)
t/pt-diskstats/group-by-sample-01 (+0/-10)
t/pt-diskstats/group-by-sample-02 (+0/-34)
t/pt-diskstats/group-by-sample-03 (+0/-11)
t/pt-diskstats/group-by-sample-04 (+0/-16)
t/pt-diskstats/group_by_all.sh (+47/-0)
t/pt-diskstats/group_by_disk.sh (+74/-0)
t/pt-diskstats/group_by_sample.sh (+84/-0)
t/pt-diskstats/pt-diskstats.t (+4/-2)
t/pt-mysql-summary/find-my-cnf-file-01 (+0/-6)
t/pt-mysql-summary/find-my-cnf-file-02 (+0/-6)
t/pt-mysql-summary/find-my-cnf-file-03 (+0/-6)
t/pt-mysql-summary/find-my-cnf-file-04 (+0/-6)
t/pt-mysql-summary/find_my_cnf_file.sh (+19/-0)
t/pt-mysql-summary/format-innodb-status-01 (+0/-52)
t/pt-mysql-summary/format-innodb-status-02 (+0/-35)
t/pt-mysql-summary/format-innodb-status-03 (+0/-19)
t/pt-mysql-summary/format-innodb-status-04 (+0/-29)
t/pt-mysql-summary/format_binlog_filters.sh (+11/-0)
t/pt-mysql-summary/format_innodb_status.sh (+146/-0)
t/pt-mysql-summary/format_overall_db_stats.sh (+60/-0)
t/pt-mysql-summary/format_status_variables-01 (+0/-93)
t/pt-mysql-summary/format_status_variables.sh (+96/-0)
t/pt-mysql-summary/fuzz-01 (+0/-6)
t/pt-mysql-summary/fuzz.sh (+6/-0)
t/pt-mysql-summary/get-mysql-tz (+0/-6)
t/pt-mysql-summary/get-mysql-uptime (+0/-9)
t/pt-mysql-summary/get-mysql-version (+0/-9)
t/pt-mysql-summary/get_mysql_info.sh (+25/-0)
t/pt-mysql-summary/overall_db_stats-01 (+0/-33)
t/pt-mysql-summary/overall_db_stats-02 (+0/-27)
t/pt-mysql-summary/parse-master-status-01 (+0/-9)
t/pt-mysql-summary/parse-mysqld-instances-01 (+0/-12)
t/pt-mysql-summary/parse-mysqld-instances-02 (+0/-10)
t/pt-mysql-summary/parse-mysqld-instances-03 (+0/-10)
t/pt-mysql-summary/parse-mysqld-instances-04 (+0/-13)
t/pt-mysql-summary/parse-processlist-01 (+0/-61)
t/pt-mysql-summary/parse_mysqld_instances.sh (+46/-0)
t/pt-mysql-summary/pretty-print-my-cnf-01 (+0/-37)
t/pt-mysql-summary/pretty_print_cnf_file.sh (+39/-0)
t/pt-mysql-summary/pt-mysql-summary.t (+4/-2)
t/pt-mysql-summary/summarize-binlogs-01 (+0/-10)
t/pt-mysql-summary/summarize_binlogs.sh (+12/-0)
t/pt-mysql-summary/summarize_processlist.sh (+63/-0)
t/pt-pmp/aggregate-stacktrace-01 (+0/-27)
t/pt-pmp/aggregate-stacktrace-02 (+0/-19)
t/pt-pmp/aggregate-stacktrace-03 (+0/-18)
t/pt-pmp/aggregate-stacktrace-03-b (+0/-16)
t/pt-pmp/aggregate-stacktrace-04 (+0/-12)
t/pt-pmp/aggregate-stacktrace-05 (+0/-13)
t/pt-pmp/aggregate_stacktrace.sh (+122/-0)
t/pt-pmp/pt-pmp.t (+4/-2)
t/pt-summary/format-filesystems-01 (+0/-9)
t/pt-summary/format-filesystems-02 (+0/-10)
t/pt-summary/format-filesystems-03 (+0/-9)
t/pt-summary/format-filesystems-04 (+0/-13)
t/pt-summary/format-filesystems-05 (+0/-11)
t/pt-summary/format-filesystems-06 (+0/-13)
t/pt-summary/format_vmstat.sh (+19/-17)
t/pt-summary/fusionmpt-01 (+0/-19)
t/pt-summary/fusionmpt-02 (+0/-15)
t/pt-summary/fusionmpt-03 (+0/-15)
t/pt-summary/lsi-megaraid-bbu-status (+0/-38)
t/pt-summary/lsi-megaraid-devices-0 (+0/-100)
t/pt-summary/lsi-megaraid-devices-1 (+0/-134)
t/pt-summary/lsi-megaraid-vdevices-0 (+0/-132)
t/pt-summary/lsi-megaraid-vdevices-1 (+0/-43)
t/pt-summary/netstat-summary-01 (+0/-17)
t/pt-summary/netstat-summary-02 (+0/-30)
t/pt-summary/parse-arcconf-01 (+0/-154)
t/pt-summary/parse-arcconf-02 (+0/-20)
t/pt-summary/parse-dmesg-raid-01 (+0/-8)
t/pt-summary/parse-dmesg-raid-02 (+0/-8)
t/pt-summary/parse-dmesg-raid-03 (+0/-8)
t/pt-summary/parse-dmesg-raid-04 (+0/-8)
t/pt-summary/parse-dmidecode-mem-devices-01 (+0/-465)
t/pt-summary/parse-dmidecode-mem-devices-02 (+0/-750)
t/pt-summary/parse-dmidecode-mem-devices-03 (+0/-28)
t/pt-summary/parse-dmidecode-mem-devices-04 (+0/-21)
t/pt-summary/parse-dmidecode-mem-devices-05 (+0/-28)
t/pt-summary/parse-fdisk-01 (+0/-14)
t/pt-summary/parse-free-minus-b (+0/-63)
t/pt-summary/parse-hpacucli-01 (+0/-22)
t/pt-summary/parse-ip-s-link-01 (+0/-13)
t/pt-summary/parse-ip-s-link-02 (+0/-13)
t/pt-summary/parse-lsi-megaraid-adapter-info (+0/-237)
t/pt-summary/parse-lspci-ethernet-01 (+0/-9)
t/pt-summary/parse-lspci-raid-01 (+0/-8)
t/pt-summary/parse-lspci-raid-02 (+0/-8)
t/pt-summary/parse-lspci-raid-03 (+0/-8)
t/pt-summary/parse-lspci-raid-04 (+0/-8)
t/pt-summary/parse-lspci-raid-05 (+0/-8)
t/pt-summary/parse-proc-cpuinfo (+0/-70)
t/pt-summary/parse-virtualization-dmesg (+0/-8)
t/pt-summary/parse_arcconf.sh (+175/-0)
t/pt-summary/parse_dmidecode_mem_devices.sh (+103/-0)
t/pt-summary/parse_ethernet_controller_lspci.sh (+8/-0)
t/pt-summary/parse_fdisk.sh (+13/-0)
t/pt-summary/parse_filesystems.sh (+51/-0)
t/pt-summary/parse_free_minus_b.sh (+66/-0)
t/pt-summary/parse_fusionmpt_lsiutil.sh (+49/-0)
t/pt-summary/parse_hpacucli.sh (+23/-0)
t/pt-summary/parse_ip_s_link.sh (+27/-0)
t/pt-summary/parse_lsi_megaraid.sh (+695/-0)
t/pt-summary/parse_netstat.sh (+48/-0)
t/pt-summary/parse_proc_cpuinfo.sh (+71/-0)
t/pt-summary/parse_raid_controller_dmesg.sh (+31/-0)
t/pt-summary/parse_raid_controller_lspci.sh (+38/-0)
t/pt-summary/parse_virtualization_dmesg.sh (+7/-0)
t/pt-summary/pt-summary.t (+4/-2)
t/pt-summary/samples/dmidecode-001.txt (+452/-0)
t/pt-summary/samples/dmidecode-002.txt (+732/-0)
util/test-bash-functions (+162/-0)
util/test-bash-tool (+0/-120)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/bash-tool-testing
Reviewer Review Type Date Requested Status
Daniel Nichter Approve
Review via email: mp+72235@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Daniel Nichter (daniel-nichter) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/pt-diskstats'
--- bin/pt-diskstats 2011-08-04 20:35:38 +0000
+++ bin/pt-diskstats 2011-08-19 17:39:24 +0000
@@ -284,10 +284,10 @@
284# last sample.284# last sample.
285group_by_disk () {285group_by_disk () {
286 [ -z "${awk_print_line}" ] && design_print_formats286 [ -z "${awk_print_line}" ] && design_print_formats
287 cat > /tmp/percona-toolkit.awk <<EOF287 awk "
288 BEGIN {288 BEGIN {
289 devs = 0;289 devs = 0;
290 devname = "${OPT_d}";290 devname = \"${OPT_d}\";
291 }291 }
292 \$1 !~ /TS/ && \$3 ~ devname {292 \$1 !~ /TS/ && \$3 ~ devname {
293 ${awk_parse_line}293 ${awk_parse_line}
@@ -303,7 +303,7 @@
303 }303 }
304 ${awk_find_max_device_name_length}304 ${awk_find_max_device_name_length}
305 ${awk_print_header}305 ${awk_print_header}
306 elapsed = curr_ts - first["ts"];306 elapsed = curr_ts - first[\"ts\"];
307 for ( i = 1; i <= devs; i++ ) {307 for ( i = 1; i <= devs; i++ ) {
308 dev = devsort[i];308 dev = devsort[i];
309 ${awk_get_overall_increments}309 ${awk_get_overall_increments}
@@ -312,21 +312,19 @@
312 t_in_progress = (tot_in_progress / (iterations - 1));312 t_in_progress = (tot_in_progress / (iterations - 1));
313 devs_in_group = 1;313 devs_in_group = 1;
314 ${awk_compute_read_write_stats}314 ${awk_compute_read_write_stats}
315 line_ts="{" (iterations - 1) "}";315 line_ts=\"{\" (iterations - 1) \"}\";
316 ${awk_print_line}316 ${awk_print_line}
317 }317 }
318 }318 } " "$@"
319EOF
320 awk -f /tmp/percona-toolkit.awk "$@"
321}319}
322320
323# Prints out one line for each sample, summing up all disks together.321# Prints out one line for each sample, summing up all disks together.
324group_by_sample() {322group_by_sample() {
325 [ -z "${awk_print_line}" ] && design_print_formats323 [ -z "${awk_print_line}" ] && design_print_formats
326 cat > /tmp/percona-toolkit.awk <<EOF324 awk "
327 BEGIN {325 BEGIN {
328 devs = 0;326 devs = 0;
329 devname = "${OPT_d}";327 devname = \"${OPT_d}\";
330 }328 }
331 \$1 !~ /TS/ && \$3 ~ devname {329 \$1 !~ /TS/ && \$3 ~ devname {
332 ${awk_parse_line}330 ${awk_parse_line}
@@ -368,7 +366,7 @@
368 devs_in_group = devs;366 devs_in_group = devs;
369 ${awk_compute_read_write_stats}367 ${awk_compute_read_write_stats}
370 if ( devs > 1 ) {368 if ( devs > 1 ) {
371 dev = "{" devs "}";369 dev = \"{\" devs \"}\";
372 }370 }
373 else {371 else {
374 dev = devsort[1];372 dev = devsort[1];
@@ -377,14 +375,12 @@
377 printed_a_line = 1;375 printed_a_line = 1;
378 }376 }
379 if ( iterations == 1 || printed_a_line == 1 ) {377 if ( iterations == 1 || printed_a_line == 1 ) {
380 # We don't save "curr" as "prev" on every sample we see, because if the378 # We don't save curr as prev on every sample we see, because if the
381 # interval of printing is more than one sample, we want "prev" to be379 # interval of printing is more than one sample, we want prev to be
382 # the first sample in the interval, not the previous sample seen.380 # the first sample in the interval, not the previous sample seen.
383 ${awk_save_curr_as_prev}381 ${awk_save_curr_as_prev}
384 }382 }
385 }383 } " "$@"
386EOF
387 awk -f /tmp/percona-toolkit.awk "$@"
388}384}
389385
390# Prints out one line for each sample, for each disk that matches the pattern.386# Prints out one line for each sample, for each disk that matches the pattern.
391387
=== modified file 'bin/pt-mysql-summary'
--- bin/pt-mysql-summary 2011-08-04 20:35:38 +0000
+++ bin/pt-mysql-summary 2011-08-19 17:39:24 +0000
@@ -202,9 +202,10 @@
202# Parses the output of 'ps -e -o args | $AP_GREP mysqld' or 'ps auxww...'202# Parses the output of 'ps -e -o args | $AP_GREP mysqld' or 'ps auxww...'
203# which should be in /tmp/percona-toolkit.203# which should be in /tmp/percona-toolkit.
204parse_mysqld_instances () {204parse_mysqld_instances () {
205 local file=$1
205 echo " Port Data Directory Socket"206 echo " Port Data Directory Socket"
206 echo " ===== ========================== ======"207 echo " ===== ========================== ======"
207 $AP_GREP '/mysqld ' /tmp/percona-toolkit | while read line; do208 $AP_GREP '/mysqld ' $file | while read line; do
208 for word in ${line}; do209 for word in ${line}; do
209 # Some grep doesn't have -o, so I have to pull out the words I want by210 # Some grep doesn't have -o, so I have to pull out the words I want by
210 # looking at each word211 # looking at each word
@@ -226,12 +227,14 @@
226# /tmp/percona-toolkit. You have to specify the port for the instance you are227# /tmp/percona-toolkit. You have to specify the port for the instance you are
227# interested in, in case there are multiple instances.228# interested in, in case there are multiple instances.
228find_my_cnf_file() {229find_my_cnf_file() {
229 if test -n "$1" && $AP_GREP -- "/mysqld.*--port=$1" /tmp/percona-toolkit >/dev/null 2>&1 ; then230 local file=$1
230 $AP_GREP -- "/mysqld.*--port=$1" /tmp/percona-toolkit \231 local port=$2
232 if test -n "$port" && $AP_GREP -- "/mysqld.*--port=$port" $file >/dev/null 2>&1 ; then
233 $AP_GREP -- "/mysqld.*--port=$port" $file \
231 | $AP_AWK 'BEGIN{RS=" "; FS="=";} $1 ~ /--defaults-file/ { print $2; }' \234 | $AP_AWK 'BEGIN{RS=" "; FS="=";} $1 ~ /--defaults-file/ { print $2; }' \
232 | head -n1235 | head -n1
233 else236 else
234 $AP_GREP '/mysqld' /tmp/percona-toolkit \237 $AP_GREP '/mysqld' $file \
235 | $AP_AWK 'BEGIN{RS=" "; FS="=";} $1 ~ /--defaults-file/ { print $2; }' \238 | $AP_AWK 'BEGIN{RS=" "; FS="=";} $1 ~ /--defaults-file/ { print $2; }' \
236 | head -n1239 | head -n1
237 fi240 fi
@@ -255,7 +258,8 @@
255# Gets the system start and uptime in human readable format. Last restart date258# Gets the system start and uptime in human readable format. Last restart date
256# should be in /tmp/percona-toolkit.259# should be in /tmp/percona-toolkit.
257get_mysql_uptime () {260get_mysql_uptime () {
258 restart="$(cat /tmp/percona-toolkit)"261 local file=$1
262 restart="$(cat $file)"
259 uptime="$(get_stat Uptime)"263 uptime="$(get_stat Uptime)"
260 uptime="$(secs_to_time ${uptime})"264 uptime="$(secs_to_time ${uptime})"
261 echo "${restart} (up ${uptime})"265 echo "${restart} (up ${uptime})"
@@ -263,16 +267,18 @@
263267
264# Summarizes the output of SHOW MASTER LOGS, which is in /tmp/percona-toolkit268# Summarizes the output of SHOW MASTER LOGS, which is in /tmp/percona-toolkit
265summarize_binlogs () {269summarize_binlogs () {
266 name_val "Binlogs" $(wc -l /tmp/percona-toolkit)270 local file=$1
267 name_val "Zero-Sized" $($AP_GREP -c '\<0$' /tmp/percona-toolkit)271 name_val "Binlogs" $(wc -l $file)
268 size=$($AP_AWK '{t += $2} END{printf "%0.f\n", t}' /tmp/percona-toolkit)272 name_val "Zero-Sized" $($AP_GREP -c '\<0$' $file)
273 size=$($AP_AWK '{t += $2} END{printf "%0.f\n", t}' $file)
269 name_val "Total Size" $(shorten ${size} 1)274 name_val "Total Size" $(shorten ${size} 1)
270}275}
271276
272# Print out binlog_do_db and binlog_ignore_db277# Print out binlog_do_db and binlog_ignore_db
273format_binlog_filters () {278format_binlog_filters () {
274 name_val "binlog_do_db" $(cut -f3 /tmp/percona-toolkit)279 local file=$1
275 name_val "binlog_ignore_db" $(cut -f4 /tmp/percona-toolkit)280 name_val "binlog_do_db" $(cut -f3 $file)
281 name_val "binlog_ignore_db" $(cut -f4 $file)
276}282}
277283
278# Takes as input a file that has two samples of SHOW STATUS, columnized next to284# Takes as input a file that has two samples of SHOW STATUS, columnized next to
@@ -280,9 +286,10 @@
280# absolute, all-time per second, and per-second over the interval between the286# absolute, all-time per second, and per-second over the interval between the
281# samples. Omits any rows that are all zeroes.287# samples. Omits any rows that are all zeroes.
282format_status_variables () {288format_status_variables () {
289 local file=$1
283 # First, figure out the intervals.290 # First, figure out the intervals.
284 utime1=$($AP_AWK '/Uptime /{print $2}' /tmp/percona-toolkit);291 utime1=$($AP_AWK '/Uptime /{print $2}' $file);
285 utime2=$($AP_AWK '/Uptime /{print $3}' /tmp/percona-toolkit);292 utime2=$($AP_AWK '/Uptime /{print $3}' $file);
286 ${AP_AWK} "293 ${AP_AWK} "
287 BEGIN {294 BEGIN {
288 utime1 = ${utime1};295 utime1 = ${utime1};
@@ -319,12 +326,12 @@
319 printf(format, \$1, perday, persec, nowsec);326 printf(format, \$1, perday, persec, nowsec);
320 }327 }
321 }328 }
322 }" /tmp/percona-toolkit329 }" $file
323}330}
324331
325# Slices the processlist a bunch of different ways. Uses input from332# Slices the processlist a bunch of different ways. The processlist should be
326# /tmp/percona-toolkit-mysql-processlist. The processlist should be created with the \G333# created with the \G flag so it's vertical.
327# flag so it's vertical. The parsing is a bit awkward because different334# The parsing is a bit awkward because different
328# versions of awk have limitations like "too many fields on line xyz". So we335# versions of awk have limitations like "too many fields on line xyz". So we
329# use 'cut' to shorten the lines. We count all things into temporary variables336# use 'cut' to shorten the lines. We count all things into temporary variables
330# for each process in the processlist, and when we hit the Info: line which337# for each process in the processlist, and when we hit the Info: line which
@@ -332,13 +339,14 @@
332# variables. If we're summarizing Command, we count everything; otherwise, only339# variables. If we're summarizing Command, we count everything; otherwise, only
333# non-Sleep processes get counted towards the sum and max of Time.340# non-Sleep processes get counted towards the sum and max of Time.
334summarize_processlist () {341summarize_processlist () {
342 local file=$1
335 for param in Command User Host db State; do343 for param in Command User Host db State; do
336 echo344 echo
337 printf ' %-30s %8s %7s %9s %9s\n' \345 printf ' %-30s %8s %7s %9s %9s\n' \
338 "${param}" "COUNT(*)" Working "SUM(Time)" "MAX(Time)"346 "${param}" "COUNT(*)" Working "SUM(Time)" "MAX(Time)"
339 echo " ------------------------------" \347 echo " ------------------------------" \
340 "-------- ------- --------- ---------"348 "-------- ------- --------- ---------"
341 cut -c1-80 /tmp/percona-toolkit-mysql-processlist \349 cut -c1-80 $file \
342 | $AP_AWK "350 | $AP_AWK "
343 \$1 == \"${param}:\" {351 \$1 == \"${param}:\" {
344 p = substr(\$0, index(\$0, \":\") + 2);352 p = substr(\$0, index(\$0, \":\") + 2);
@@ -384,6 +392,7 @@
384# sets in regular expressions, like [[:space:]] (looking at you, Debian). So392# sets in regular expressions, like [[:space:]] (looking at you, Debian). So
385# the below patterns contain [<space><tab>] and must remain that way.393# the below patterns contain [<space><tab>] and must remain that way.
386pretty_print_cnf_file () {394pretty_print_cnf_file () {
395 local file=$1
387 $AP_AWK '396 $AP_AWK '
388 BEGIN {397 BEGIN {
389 FS="="398 FS="="
@@ -403,7 +412,7 @@
403 else {412 else {
404 print $1;413 print $1;
405 }414 }
406 }' /tmp/percona-toolkit415 }' $file
407}416}
408417
409find_checkpoint_age() {418find_checkpoint_age() {
@@ -525,37 +534,38 @@
525534
526# Summarizes various things about InnoDB status that are not easy to see by eye.535# Summarizes various things about InnoDB status that are not easy to see by eye.
527format_innodb_status () {536format_innodb_status () {
528 name_val "Checkpoint Age" $(shorten $(find_checkpoint_age "${1}"))537 local file=$1
529 name_val "InnoDB Queue" "$(awk '/queries inside/{print}' "${1}")"538 name_val "Checkpoint Age" $(shorten $(find_checkpoint_age "${file}"))
530 name_val "Oldest Transaction" "$(find_max_trx_time "${1}") Seconds";539 name_val "InnoDB Queue" "$(awk '/queries inside/{print}' "${file}")"
531 name_val "History List Len" $(awk '/History list length/{print $4}' "$1")540 name_val "Oldest Transaction" "$(find_max_trx_time "${file}") Seconds";
532 name_val "Read Views" $(awk '/read views open inside/{print $1}' "${1}")541 name_val "History List Len" $(awk '/History list length/{print $4}' "${file}")
533 name_val "Undo Log Entries" "$(summarize_undo_log_entries "${1}")"542 name_val "Read Views" $(awk '/read views open inside/{print $1}' "${file}")
534 name_val "Pending I/O Reads" "$(find_pending_io_reads "${1}")"543 name_val "Undo Log Entries" "$(summarize_undo_log_entries "${file}")"
535 name_val "Pending I/O Writes" "$(find_pending_io_writes "${1}")"544 name_val "Pending I/O Reads" "$(find_pending_io_reads "${file}")"
536 name_val "Pending I/O Flushes" "$(find_pending_io_flushes "${1}")"545 name_val "Pending I/O Writes" "$(find_pending_io_writes "${file}")"
537 $AP_AWK -F, '/^---TRANSACTION/{print $2}' "${1}" \546 name_val "Pending I/O Flushes" "$(find_pending_io_flushes "${file}")"
547 $AP_AWK -F, '/^---TRANSACTION/{print $2}' "${file}" \
538 | $AP_SED -e 's/ [0-9]* sec.*//' | sort | uniq -c > /tmp/percona-toolkit2548 | $AP_SED -e 's/ [0-9]* sec.*//' | sort | uniq -c > /tmp/percona-toolkit2
539 name_val "Transaction States" "$(group_concat /tmp/percona-toolkit2)"549 name_val "Transaction States" "$(group_concat /tmp/percona-toolkit2)"
540 if $AP_GREP 'TABLE LOCK table' "${1}" >/dev/null ; then550 if $AP_GREP 'TABLE LOCK table' "${file}" >/dev/null ; then
541 echo "Tables Locked"551 echo "Tables Locked"
542 $AP_AWK '/^TABLE LOCK table/{print $4}' "${1}" \552 $AP_AWK '/^TABLE LOCK table/{print $4}' "${file}" \
543 | sort | uniq -c | sort -rn553 | sort | uniq -c | sort -rn
544 fi554 fi
545 if $AP_GREP 'has waited at' "${1}" > /dev/null ; then555 if $AP_GREP 'has waited at' "${file}" > /dev/null ; then
546 echo "Semaphore Waits"556 echo "Semaphore Waits"
547 $AP_GREP 'has waited at' "${1}" | cut -d' ' -f6-8 \557 $AP_GREP 'has waited at' "${file}" | cut -d' ' -f6-8 \
548 | sort | uniq -c | sort -rn558 | sort | uniq -c | sort -rn
549 fi559 fi
550 if $AP_GREP 'reserved it in mode' "${1}" > /dev/null; then560 if $AP_GREP 'reserved it in mode' "${file}" > /dev/null; then
551 echo "Semaphore Holders"561 echo "Semaphore Holders"
552 $AP_AWK '/has reserved it in mode/{562 $AP_AWK '/has reserved it in mode/{
553 print substr($0, 1 + index($0, "("), index($0, ")") - index($0, "(") - 1);563 print substr($0, 1 + index($0, "("), index($0, ")") - index($0, "(") - 1);
554 }' "${1}" | sort | uniq -c | sort -rn564 }' "${file}" | sort | uniq -c | sort -rn
555 fi565 fi
556 if $AP_GREP -e 'Mutex at' -e 'lock on' "${1}" >/dev/null 2>&1; then566 if $AP_GREP -e 'Mutex at' -e 'lock on' "${file}" >/dev/null 2>&1; then
557 echo "Mutexes/Locks Waited For"567 echo "Mutexes/Locks Waited For"
558 $AP_GREP -e 'Mutex at' -e 'lock on' "${1}" | $AP_SED -e 's/^[XS]-//' -e 's/,.*$//' \568 $AP_GREP -e 'Mutex at' -e 'lock on' "${file}" | $AP_SED -e 's/^[XS]-//' -e 's/,.*$//' \
559 | sort | uniq -c | sort -rn569 | sort | uniq -c | sort -rn
560 fi570 fi
561}571}
@@ -564,6 +574,7 @@
564# tables, views, etc. $1 is the file name. $2 is the database name; if none,574# tables, views, etc. $1 is the file name. $2 is the database name; if none,
565# then there should be multiple databases.575# then there should be multiple databases.
566format_overall_db_stats () {576format_overall_db_stats () {
577 local file=$1
567 echo578 echo
568 # We keep counts of everything in an associative array keyed by db name, and579 # We keep counts of everything in an associative array keyed by db name, and
569 # what it is. The num_dbs counter is to ensure sort order is consistent when580 # what it is. The num_dbs counter is to ensure sort order is consistent when
@@ -622,7 +633,7 @@
622 printf fmt, db, counts[db ",tables"], counts[db ",views"], counts[db ",sps"], counts[db ",trg"], counts[db ",func"], counts[db ",fk"], counts[db ",partn"];633 printf fmt, db, counts[db ",tables"], counts[db ",views"], counts[db ",sps"], counts[db ",trg"], counts[db ",func"], counts[db ",fk"], counts[db ",partn"];
623 }634 }
624 }635 }
625 ' /tmp/percona-toolkit-mysqldump > /tmp/percona-toolkit636 ' $file > /tmp/percona-toolkit
626 head -n2 /tmp/percona-toolkit637 head -n2 /tmp/percona-toolkit
627 tail -n +3 /tmp/percona-toolkit | sort638 tail -n +3 /tmp/percona-toolkit | sort
628639
@@ -682,7 +693,7 @@
682 print "";693 print "";
683 }694 }
684 }695 }
685 ' /tmp/percona-toolkit-mysqldump > /tmp/percona-toolkit696 ' $file > /tmp/percona-toolkit
686 head -n1 /tmp/percona-toolkit697 head -n1 /tmp/percona-toolkit
687 tail -n +2 /tmp/percona-toolkit | sort698 tail -n +2 /tmp/percona-toolkit | sort
688699
@@ -755,7 +766,7 @@
755 print "";766 print "";
756 }767 }
757 }768 }
758 ' /tmp/percona-toolkit-mysqldump > /tmp/percona-toolkit769 ' $file > /tmp/percona-toolkit
759 head -n1 /tmp/percona-toolkit770 head -n1 /tmp/percona-toolkit
760 tail -n +2 /tmp/percona-toolkit | sort771 tail -n +2 /tmp/percona-toolkit | sort
761772
@@ -846,12 +857,11 @@
846 print "";857 print "";
847 }858 }
848 }859 }
849 ' /tmp/percona-toolkit-mysqldump > /tmp/percona-toolkit860 ' $file > /tmp/percona-toolkit
850 hdr=$($AP_GREP -n Database /tmp/percona-toolkit | cut -d: -f1);861 hdr=$($AP_GREP -n Database /tmp/percona-toolkit | cut -d: -f1);
851 head -n${hdr} /tmp/percona-toolkit862 head -n${hdr} /tmp/percona-toolkit
852 tail -n +$((${hdr} + 1)) /tmp/percona-toolkit | sort863 tail -n +$((${hdr} + 1)) /tmp/percona-toolkit | sort
853 echo864 echo
854
855}865}
856866
857# ##############################################################################867# ##############################################################################
@@ -878,7 +888,7 @@
878 name_val "System time" "`date -u +'%F %T UTC'` (local TZ: `date +'%Z %z'`)"888 name_val "System time" "`date -u +'%F %T UTC'` (local TZ: `date +'%Z %z'`)"
879 section Instances889 section Instances
880 ps auxww 2>/dev/null | $AP_GREP mysqld > /tmp/percona-toolkit890 ps auxww 2>/dev/null | $AP_GREP mysqld > /tmp/percona-toolkit
881 parse_mysqld_instances891 parse_mysqld_instances /tmp/percona-toolkit
882892
883 # ########################################################################893 # ########################################################################
884 # Fetch some basic info so we can start894 # Fetch some basic info so we can start
@@ -890,13 +900,13 @@
890 exit 1900 exit 1
891 fi901 fi
892 user="$(cat /tmp/percona-toolkit)";902 user="$(cat /tmp/percona-toolkit)";
893 mysql -ss -e 'SHOW /*!40100 GLOBAL*/ VARIABLES' "$@" > /tmp/percona-toolkit-mysql-variables903 mysql "$@" -ss -e 'SHOW /*!40100 GLOBAL*/ VARIABLES' > /tmp/percona-toolkit-mysql-variables
894 mysql -ss -e 'SHOW /*!50000 GLOBAL*/ STATUS' "$@" > /tmp/percona-toolkit-mysql-status904 mysql "$@" -ss -e 'SHOW /*!50000 GLOBAL*/ STATUS' > /tmp/percona-toolkit-mysql-status
895 mysql -ss -e 'SHOW DATABASES' "$@" > /tmp/percona-toolkit-mysql-databases 2>/dev/null905 mysql "$@" -ss -e 'SHOW DATABASES' > /tmp/percona-toolkit-mysql-databases 2>/dev/null
896 mysql -ssE -e 'SHOW SLAVE STATUS' "$@" > /tmp/percona-toolkit-mysql-slave 2>/dev/null906 mysql "$@" -ssE -e 'SHOW SLAVE STATUS' > /tmp/percona-toolkit-mysql-slave 2>/dev/null
897 mysql -ssE -e 'SHOW /*!50000 ENGINE*/ INNODB STATUS' "$@" > /tmp/percona-toolkit-innodb-status 2>/dev/null907 mysql "$@" -ssE -e 'SHOW /*!50000 ENGINE*/ INNODB STATUS' > /tmp/percona-toolkit-innodb-status 2>/dev/null
898 mysql -ssE -e 'SHOW FULL PROCESSLIST' "$@" > /tmp/percona-toolkit-mysql-processlist 2>/dev/null908 mysql "$@" -ssE -e 'SHOW FULL PROCESSLIST' > /tmp/percona-toolkit-mysql-processlist 2>/dev/null
899 now="$(mysql -ss -e 'SELECT NOW()' "$@")"909 now="$(mysql "$@" -ss -e 'SELECT NOW()')"
900 port="$(get_var port)"910 port="$(get_var port)"
901911
902 # ########################################################################912 # ########################################################################
@@ -909,9 +919,9 @@
909 get_mysql_version919 get_mysql_version
910920
911 uptime="$(get_stat Uptime)"921 uptime="$(get_stat Uptime)"
912 mysql -ss -e "SELECT LEFT(NOW() - INTERVAL ${uptime} SECOND, 16)" "$@" \922 mysql "$@" -ss -e "SELECT LEFT(NOW() - INTERVAL ${uptime} SECOND, 16)" \
913 > /tmp/percona-toolkit923 > /tmp/percona-toolkit
914 name_val Started "$(get_mysql_uptime)"924 name_val Started "$(get_mysql_uptime /tmp/percona-toolkit)"
915925
916 name_val Databases "$($AP_GREP -c . /tmp/percona-toolkit-mysql-databases)"926 name_val Databases "$($AP_GREP -c . /tmp/percona-toolkit-mysql-databases)"
917 name_val Datadir "$(get_var datadir)"927 name_val Datadir "$(get_var datadir)"
@@ -932,7 +942,7 @@
932 # Processlist, sliced several different ways942 # Processlist, sliced several different ways
933 # ########################################################################943 # ########################################################################
934 section Processlist944 section Processlist
935 summarize_processlist945 summarize_processlist /tmp/percona-toolkit-mysql-processlist
936946
937 # ########################################################################947 # ########################################################################
938 # Queries and query plans948 # Queries and query plans
@@ -940,7 +950,7 @@
940 section "Status_Counters_(Wait_10_Seconds)"950 section "Status_Counters_(Wait_10_Seconds)"
941 sleep 10951 sleep 10
942 # TODO: gather this data in the same format as normal: stats, TS line952 # TODO: gather this data in the same format as normal: stats, TS line
943 mysql -ss -e 'SHOW /*!50000 GLOBAL*/ STATUS' "$@" \953 mysql "$@" -ss -e 'SHOW /*!50000 GLOBAL*/ STATUS' \
944 | join /tmp/percona-toolkit-mysql-status - > /tmp/percona-toolkit 954 | join /tmp/percona-toolkit-mysql-status - > /tmp/percona-toolkit
945 # Make a file with a list of things we want to omit because they aren't955 # Make a file with a list of things we want to omit because they aren't
946 # counters, they are gauges (in RRDTool terminology). Gauges are shown956 # counters, they are gauges (in RRDTool terminology). Gauges are shown
@@ -967,7 +977,7 @@
967 do977 do
968 echo "${var}" >> /tmp/percona-toolkit-noncounters978 echo "${var}" >> /tmp/percona-toolkit-noncounters
969 done979 done
970 format_status_variables | $AP_GREP -v -f /tmp/percona-toolkit-noncounters980 format_status_variables /tmp/percona-toolkit | $AP_GREP -v -f /tmp/percona-toolkit-noncounters
971981
972 # ########################################################################982 # ########################################################################
973 # Table cache983 # Table cache
@@ -1035,7 +1045,7 @@
1035 # that option to mysqldump, because when mysqldump checks for them, it1045 # that option to mysqldump, because when mysqldump checks for them, it
1036 # can take a long time, one table at a time.1046 # can take a long time, one table at a time.
1037 triggers="--skip-triggers"1047 triggers="--skip-triggers"
1038 trg=$(mysql -ss -e "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TRIGGERS" 2>/dev/null);1048 trg=$(mysql "$@" -ss -e "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TRIGGERS" 2>/dev/null);
1039 if [ "${res}" ]; then1049 if [ "${res}" ]; then
1040 if [ "${res}" -gt 0 ]; then1050 if [ "${res}" -gt 0 ]; then
1041 triggers="--triggers"1051 triggers="--triggers"
@@ -1048,15 +1058,15 @@
1048 echo "There are ${num_dbs} databases. Would you like to dump all, or just one?"1058 echo "There are ${num_dbs} databases. Would you like to dump all, or just one?"
1049 echo -n "Type the name of the database, or press Enter to dump all of them. "1059 echo -n "Type the name of the database, or press Enter to dump all of them. "
1050 read dbtodump1060 read dbtodump
1051 mysqldump --no-data --skip-comments \1061 mysqldump "$@" --no-data --skip-comments \
1052 --skip-add-locks --skip-add-drop-table --compact \1062 --skip-add-locks --skip-add-drop-table --compact \
1053 --skip-lock-all-tables --skip-lock-tables --skip-set-charset \1063 --skip-lock-all-tables --skip-lock-tables --skip-set-charset \
1054 ${trg_arg} "$@" ${dbtodump:---all-databases} > /tmp/percona-toolkit-mysqldump1064 ${trg_arg} ${dbtodump:---all-databases} > /tmp/percona-toolkit-mysqldump
1055 # Test the result by checking the file, not by the exit status, because we1065 # Test the result by checking the file, not by the exit status, because we
1056 # might get partway through and then die, and the info is worth analyzing1066 # might get partway through and then die, and the info is worth analyzing
1057 # anyway.1067 # anyway.
1058 if $AP_GREP 'CREATE TABLE' /tmp/percona-toolkit-mysqldump >/dev/null 2>&1; then1068 if $AP_GREP 'CREATE TABLE' /tmp/percona-toolkit-mysqldump >/dev/null 2>&1; then
1059 format_overall_db_stats1069 format_overall_db_stats /tmp/percona-toolkit-mysqldump
1060 else1070 else
1061 echo "Skipping schema analysis due to apparent error in dump file"1071 echo "Skipping schema analysis due to apparent error in dump file"
1062 rm -f /tmp/percona-toolkit-mysqldump1072 rm -f /tmp/percona-toolkit-mysqldump
@@ -1189,8 +1199,8 @@
1189 # Users & Security1199 # Users & Security
1190 # ########################################################################1200 # ########################################################################
1191 section Security1201 section Security
1192 users="$(mysql -ss \1202 users="$(mysql "$@" -ss \
1193 -e 'SELECT COUNT(*), SUM(user=""), SUM(password=""), SUM(password NOT LIKE "*%") FROM mysql.user' "$@" 2>/dev/null \1203 -e 'SELECT COUNT(*), SUM(user=""), SUM(password=""), SUM(password NOT LIKE "*%") FROM mysql.user' 2>/dev/null \
1194 | $AP_AWK '{printf "%d users, %d anon, %d w/o pw, %d old pw\n", $1, $2, $3, $4}')"1204 | $AP_AWK '{printf "%d users, %d anon, %d w/o pw, %d old pw\n", $1, $2, $3, $4}')"
1195 name_val Users "${users}"1205 name_val Users "${users}"
1196 name_val "Old Passwords" $(get_var old_passwords)1206 name_val "Old Passwords" $(get_var old_passwords)
@@ -1201,15 +1211,15 @@
1201 section Binary_Logging1211 section Binary_Logging
1202 binlog=$(get_var log_bin)1212 binlog=$(get_var log_bin)
1203 if [ "${binlog}" ]; then1213 if [ "${binlog}" ]; then
1204 mysql -ss -e 'SHOW MASTER LOGS' "$@" > /tmp/percona-toolkit 2>/dev/null1214 mysql "$@" -ss -e 'SHOW MASTER LOGS' > /tmp/percona-toolkit 2>/dev/null
1205 summarize_binlogs1215 summarize_binlogs /tmp/percona-toolkit
1206 format="$(get_var binlog_format)"1216 format="$(get_var binlog_format)"
1207 name_val binlog_format "${format:-STATEMENT}"1217 name_val binlog_format "${format:-STATEMENT}"
1208 name_val expire_logs_days $(get_var expire_logs_days)1218 name_val expire_logs_days $(get_var expire_logs_days)
1209 name_val sync_binlog $(get_var sync_binlog)1219 name_val sync_binlog $(get_var sync_binlog)
1210 name_val server_id $(get_var server_id)1220 name_val server_id $(get_var server_id)
1211 mysql -ss -e 'SHOW MASTER STATUS' "$@" > /tmp/percona-toolkit 2>/dev/null1221 mysql "$@" -ss -e 'SHOW MASTER STATUS' > /tmp/percona-toolkit 2>/dev/null
1212 format_binlog_filters1222 format_binlog_filters /tmp/percona-toolkit
1213 fi1223 fi
12141224
1215# Replication: seconds behind, running, filters, skip_slave_start, skip_errors,1225# Replication: seconds behind, running, filters, skip_slave_start, skip_errors,
@@ -1243,7 +1253,7 @@
1243 # ########################################################################1253 # ########################################################################
1244 section Configuration_File1254 section Configuration_File
1245 ps auxww 2>/dev/null | $AP_GREP mysqld > /tmp/percona-toolkit1255 ps auxww 2>/dev/null | $AP_GREP mysqld > /tmp/percona-toolkit
1246 cnf_file=$(find_my_cnf_file ${port});1256 cnf_file=$(find_my_cnf_file /tmp/percona-toolkit ${port});
1247 if [ ! -e "${cnf_file}" ]; then1257 if [ ! -e "${cnf_file}" ]; then
1248 name_val "Config File" "Cannot autodetect, trying common locations"1258 name_val "Config File" "Cannot autodetect, trying common locations"
1249 cnf_file="/etc/my.cnf";1259 cnf_file="/etc/my.cnf";
@@ -1257,7 +1267,7 @@
1257 if [ -e "${cnf_file}" ]; then1267 if [ -e "${cnf_file}" ]; then
1258 name_val "Config File" "${cnf_file}"1268 name_val "Config File" "${cnf_file}"
1259 cat "${cnf_file}" > /tmp/percona-toolkit1269 cat "${cnf_file}" > /tmp/percona-toolkit
1260 pretty_print_cnf_file1270 pretty_print_cnf_file /tmp/percona-toolkit
1261 else1271 else
1262 name_val "Config File" "Cannot autodetect or find, giving up"1272 name_val "Config File" "Cannot autodetect or find, giving up"
1263 fi1273 fi
12641274
=== modified file 'bin/pt-pmp'
--- bin/pt-pmp 2011-08-04 20:35:38 +0000
+++ bin/pt-pmp 2011-08-19 17:39:24 +0000
@@ -17,16 +17,17 @@
17# to aggregate, and the files to read. If maxlen=0, it means infinity. We have17# to aggregate, and the files to read. If maxlen=0, it means infinity. We have
18# to pass the maxlen argument into this function to make maxlen testable.18# to pass the maxlen argument into this function to make maxlen testable.
19aggregate_stacktrace() {19aggregate_stacktrace() {
20 maxlen="$1";20 local maxlen=$1;
21 cat > /tmp/percona-toolkit.awk <<EOF21 shift
22 awk "
22 BEGIN {23 BEGIN {
23 s = "";24 s = \"\";
24 }25 }
25 /^Thread/ {26 /^Thread/ {
26 if ( s != "" ) {27 if ( s != \"\" ) {
27 print s;28 print s;
28 }29 }
29 s = "";30 s = \"\";
30 c = 0;31 c = 0;
31 }32 }
32 /^\#/ {33 /^\#/ {
@@ -38,37 +39,37 @@
38 targ = \$4;39 targ = \$4;
39 }40 }
40 if ( targ ~ /[<\\(]/ ) {41 if ( targ ~ /[<\\(]/ ) {
41 targ = substr(\$0, index(\$0, " in ") + 4);42 targ = substr(\$0, index(\$0, \" in \") + 4);
42 if ( targ ~ / from / ) {43 if ( targ ~ / from / ) {
43 targ = substr(targ, 1, index(targ, " from ") - 1);44 targ = substr(targ, 1, index(targ, \" from \") - 1);
44 }45 }
45 if ( targ ~ / at / ) {46 if ( targ ~ / at / ) {
46 targ = substr(targ, 1, index(targ, " at ") - 1);47 targ = substr(targ, 1, index(targ, \" at \") - 1);
47 }48 }
48 # Shorten C++ templates, e.g. in t/samples/stacktrace-004.txt49 # Shorten C++ templates, e.g. in t/samples/stacktrace-004.txt
49 while ( targ ~ />::/ ) {50 while ( targ ~ />::/ ) {
50 if ( 0 == gsub(/<[^<>]*>/, "", targ) ) {51 if ( 0 == gsub(/<[^<>]*>/, \"\", targ) ) {
51 break;52 break;
52 }53 }
53 }54 }
54 # Further shorten argument lists.55 # Further shorten argument lists.
55 while ( targ ~ /\\(/ ) {56 while ( targ ~ /\\(/ ) {
56 if ( 0 == gsub(/\\([^()]*\\)/, "", targ) ) {57 if ( 0 == gsub(/\\([^()]*\\)/, \"\", targ) ) {
57 break;58 break;
58 }59 }
59 }60 }
60 # Remove void and const decorators.61 # Remove void and const decorators.
61 gsub(/ ?(void|const) ?/, "", targ);62 gsub(/ ?(void|const) ?/, \"\", targ);
62 gsub(/ /, "", targ);63 gsub(/ /, \"\", targ);
63 }64 }
64 else if ( targ ~ /\\?\\?/ && \$2 ~ /[1-9]/ ) {65 else if ( targ ~ /\\?\\?/ && \$2 ~ /[1-9]/ ) {
65 # Substitute ?? by the name of the library.66 # Substitute ?? by the name of the library.
66 targ = \$NF;67 targ = \$NF;
67 while ( targ ~ /\\// ) {68 while ( targ ~ /\\// ) {
68 targ = substr(targ, index(targ, "/") + 1);69 targ = substr(targ, index(targ, \"/\") + 1);
69 }70 }
70 targ = substr(targ, 1, index(targ, ".") - 1);71 targ = substr(targ, 1, index(targ, \".\") - 1);
71 targ = targ "::??";72 targ = targ \"::??\";
72 }73 }
73 }74 }
74 else {75 else {
@@ -76,14 +77,14 @@
76 }77 }
77 # get rid of long symbol names such as 'pthread_cond_wait@@GLIBC_2.3.2'78 # get rid of long symbol names such as 'pthread_cond_wait@@GLIBC_2.3.2'
78 if ( targ ~ /@@/ ) {79 if ( targ ~ /@@/ ) {
79 fname = substr(targ, 1, index(targ, "@@") - 1);80 fname = substr(targ, 1, index(targ, \"@@\") - 1);
80 }81 }
81 else {82 else {
82 fname = targ;83 fname = targ;
83 }84 }
84 if ( ${maxlen:-0} == 0 || c < ${maxlen:-0} ) {85 if ( ${maxlen:-0} == 0 || c < ${maxlen:-0} ) {
85 if (s != "" ) {86 if (s != \"\" ) {
86 s = s "," fname;87 s = s \",\" fname;
87 }88 }
88 else {89 else {
89 s = fname;90 s = fname;
@@ -94,9 +95,7 @@
94 END {95 END {
95 print s96 print s
96 }97 }
97EOF98 " "$@" | sort | uniq -c | sort -r -n -k 1,1
98 awk -f /tmp/percona-toolkit.awk "$2" | sort | uniq -c | sort -r -n -k 1,1
99 rm -f /tmp/percona-toolkit
100}99}
101100
102# The main program to run.101# The main program to run.
103102
=== modified file 'bin/pt-summary'
--- bin/pt-summary 2011-08-04 20:35:38 +0000
+++ bin/pt-summary 2011-08-19 17:39:24 +0000
@@ -136,13 +136,14 @@
136# Parse Linux's /proc/cpuinfo, which should be stored in /tmp/percona-toolkit.136# Parse Linux's /proc/cpuinfo, which should be stored in /tmp/percona-toolkit.
137# ##############################################################################137# ##############################################################################
138parse_proc_cpuinfo () {138parse_proc_cpuinfo () {
139 local file=$1
139 # Physical processors are indicated by distinct 'physical id'. Virtual CPUs140 # Physical processors are indicated by distinct 'physical id'. Virtual CPUs
140 # are indicated by paragraphs -- one per paragraph. We assume that all141 # are indicated by paragraphs -- one per paragraph. We assume that all
141 # processors are identical, i.e. that there are not some processors with dual142 # processors are identical, i.e. that there are not some processors with dual
142 # cores and some with quad cores.143 # cores and some with quad cores.
143 virtual=$(grep -c ^processor /tmp/percona-toolkit);144 virtual=$(grep -c ^processor $file);
144 physical=$(grep 'physical id' /tmp/percona-toolkit | sort -u | wc -l);145 physical=$(grep 'physical id' $file | sort -u | wc -l);
145 cores=$(grep 'cpu cores' /tmp/percona-toolkit | head -n 1 | cut -d: -f2);146 cores=$(grep 'cpu cores' $file | head -n 1 | cut -d: -f2);
146147
147 # Older kernel won't have 'physical id' or 'cpu cores'.148 # Older kernel won't have 'physical id' or 'cpu cores'.
148 if [ "${physical}" = "0" ]; then physical=${virtual}; fi149 if [ "${physical}" = "0" ]; then physical=${virtual}; fi
@@ -155,17 +156,17 @@
155156
156 name_val "Processors" "physical = ${physical}, cores = ${cores}, virtual = ${virtual}, hyperthreading = ${htt}"157 name_val "Processors" "physical = ${physical}, cores = ${cores}, virtual = ${virtual}, hyperthreading = ${htt}"
157158
158 awk -F: '/cpu MHz/{print $2}' /tmp/percona-toolkit \159 awk -F: '/cpu MHz/{print $2}' $file \
159 | sort | uniq -c > /tmp/percona-toolkit2160 | sort | uniq -c > "$file.unq"
160 name_val "Speeds" "$(group_concat /tmp/percona-toolkit2)"161 name_val "Speeds" "$(group_concat "$file.unq")"
161162
162 awk -F: '/model name/{print $2}' /tmp/percona-toolkit \163 awk -F: '/model name/{print $2}' $file \
163 | sort | uniq -c > /tmp/percona-toolkit2164 | sort | uniq -c > "$file.unq"
164 name_val "Models" "$(group_concat /tmp/percona-toolkit2)"165 name_val "Models" "$(group_concat "$file.unq")"
165166
166 awk -F: '/cache size/{print $2}' /tmp/percona-toolkit \167 awk -F: '/cache size/{print $2}' $file \
167 | sort | uniq -c > /tmp/percona-toolkit2168 | sort | uniq -c > "$file.unq"
168 name_val "Caches" "$(group_concat /tmp/percona-toolkit2)"169 name_val "Caches" "$(group_concat "$file.unq")"
169}170}
170171
171# ##############################################################################172# ##############################################################################
@@ -196,16 +197,18 @@
196# Parse the output of 'free -b' plus the contents of /proc/meminfo197# Parse the output of 'free -b' plus the contents of /proc/meminfo
197# ##############################################################################198# ##############################################################################
198parse_free_minus_b () {199parse_free_minus_b () {
199 physical=$(awk '/Mem:/{print $3}' "${1}")200 local file=$1
200 swap=$(awk '/Swap:/{print $3}' "${1}")201
201 virtual=$(shorten $(($physical + $swap)))202 local physical=$(awk '/Mem:/{print $3}' "${file}")
202203 local swap=$(awk '/Swap:/{print $3}' "${file}")
203 name_val Total $(shorten $(awk '/Mem:/{print $2}' "${1}"))204 local virtual=$(shorten $(($physical + $swap)))
204 name_val Free $(shorten $(awk '/Mem:/{print $4}' "${1}"))205
206 name_val Total $(shorten $(awk '/Mem:/{print $2}' "${file}"))
207 name_val Free $(shorten $(awk '/Mem:/{print $4}' "${file}"))
205 name_val Used "physical = $(shorten ${physical}), swap = $(shorten ${swap}), virtual = ${virtual}"208 name_val Used "physical = $(shorten ${physical}), swap = $(shorten ${swap}), virtual = ${virtual}"
206 name_val Buffers $(shorten $(awk '/Mem:/{print $6}' "${1}"))209 name_val Buffers $(shorten $(awk '/Mem:/{print $6}' "${file}"))
207 name_val Caches $(shorten $(awk '/Mem:/{print $7}' "${1}"))210 name_val Caches $(shorten $(awk '/Mem:/{print $7}' "${file}"))
208 name_val Dirty "$(awk '/Dirty:/ {print $2, $3}' "${1}")"211 name_val Dirty "$(awk '/Dirty:/ {print $2, $3}' "${file}")"
209}212}
210213
211# ##############################################################################214# ##############################################################################
@@ -233,10 +236,10 @@
233}236}
234237
235# ##############################################################################238# ##############################################################################
236# Parse memory devices from the output of 'dmidecode', which should be stored in239# Parse memory devices from the output of 'dmidecode'.
237# /tmp/percona-toolkit.
238# ##############################################################################240# ##############################################################################
239parse_dmidecode_mem_devices () {241parse_dmidecode_mem_devices () {
242 local file=$1
240 echo " Locator Size Speed Form Factor Type Type Detail"243 echo " Locator Size Speed Form Factor Type Type Detail"
241 echo " ========= ======== ================= ============= ============= ==========="244 echo " ========= ======== ================= ============= ============= ==========="
242 # Print paragraphs containing 'Memory Device\n', extract the desired bits,245 # Print paragraphs containing 'Memory Device\n', extract the desired bits,
@@ -254,7 +257,7 @@
254 -e 's/</{/g' \257 -e 's/</{/g' \
255 -e 's/>/}/g' \258 -e 's/>/}/g' \
256 -e 's/[ \t]*\n/\n/g' \259 -e 's/[ \t]*\n/\n/g' \
257 /tmp/percona-toolkit \260 $file \
258 | awk -F: '/Size|Type|Form.Factor|Type.Detail|[^ ]Locator/{printf("|%s", $2)}/Speed/{print "|" $2}' \261 | awk -F: '/Size|Type|Form.Factor|Type.Detail|[^ ]Locator/{printf("|%s", $2)}/Speed/{print "|" $2}' \
259 | sed -e 's/No Module Installed/{EMPTY}/' \262 | sed -e 's/No Module Installed/{EMPTY}/' \
260 | sort \263 | sort \
@@ -292,10 +295,11 @@
292# Parse the output of 'netstat -antp' which should be in /tmp/percona-toolkit.295# Parse the output of 'netstat -antp' which should be in /tmp/percona-toolkit.
293# ##############################################################################296# ##############################################################################
294parse_netstat () {297parse_netstat () {
298 local file=$1
295 echo " Connections from remote IP addresses"299 echo " Connections from remote IP addresses"
296 awk '$1 ~ /^tcp/ && $5 ~ /^[1-9]/ {300 awk '$1 ~ /^tcp/ && $5 ~ /^[1-9]/ {
297 print substr($5, 0, index($5, ":") - 1);301 print substr($5, 0, index($5, ":") - 1);
298 }' /tmp/percona-toolkit | sort | uniq -c \302 }' $file | sort | uniq -c \
299 | awk "{303 | awk "{
300 fuzzy_var=\$1;304 fuzzy_var=\$1;
301 ${fuzzy_formula}305 ${fuzzy_formula}
@@ -305,7 +309,7 @@
305 echo " Connections to local IP addresses"309 echo " Connections to local IP addresses"
306 awk '$1 ~ /^tcp/ && $5 ~ /^[1-9]/ {310 awk '$1 ~ /^tcp/ && $5 ~ /^[1-9]/ {
307 print substr($4, 0, index($4, ":") - 1);311 print substr($4, 0, index($4, ":") - 1);
308 }' /tmp/percona-toolkit | sort | uniq -c \312 }' $file | sort | uniq -c \
309 | awk "{313 | awk "{
310 fuzzy_var=\$1;314 fuzzy_var=\$1;
311 ${fuzzy_formula}315 ${fuzzy_formula}
@@ -315,7 +319,7 @@
315 echo " Connections to top 10 local ports"319 echo " Connections to top 10 local ports"
316 awk '$1 ~ /^tcp/ && $5 ~ /^[1-9]/ {320 awk '$1 ~ /^tcp/ && $5 ~ /^[1-9]/ {
317 print substr($4, index($4, ":") + 1);321 print substr($4, index($4, ":") + 1);
318 }' /tmp/percona-toolkit | sort | uniq -c | sort -rn | head -n10 \322 }' $file | sort | uniq -c | sort -rn | head -n10 \
319 | awk "{323 | awk "{
320 fuzzy_var=\$1;324 fuzzy_var=\$1;
321 ${fuzzy_formula}325 ${fuzzy_formula}
@@ -324,7 +328,7 @@
324 echo " States of connections"328 echo " States of connections"
325 awk '$1 ~ /^tcp/ {329 awk '$1 ~ /^tcp/ {
326 print $6;330 print $6;
327 }' /tmp/percona-toolkit | sort | uniq -c | sort -rn \331 }' $file | sort | uniq -c | sort -rn \
328 | awk "{332 | awk "{
329 fuzzy_var=\$1;333 fuzzy_var=\$1;
330 ${fuzzy_formula}334 ${fuzzy_formula}
@@ -341,7 +345,10 @@
341 # requires two passes through the file. The first pass finds the max size of345 # requires two passes through the file. The first pass finds the max size of
342 # these columns and prints out a printf spec, and the second prints out the346 # these columns and prints out a printf spec, and the second prints out the
343 # file nicely aligned.347 # file nicely aligned.
344 cat > /tmp/pt-summary.awk <<-EOF348 local file=$1
349 local platform=$2
350
351 local spec=$(awk "
345 BEGIN {352 BEGIN {
346 device = 10;353 device = 10;
347 fstype = 4;354 fstype = 4;
@@ -351,9 +358,9 @@
351 f_device = \$1;358 f_device = \$1;
352 f_fstype = \$10;359 f_fstype = \$10;
353 f_options = substr(\$11, 2, length(\$11) - 2);360 f_options = substr(\$11, 2, length(\$11) - 2);
354 if ( "$2" == "FreeBSD" ) {361 if ( \"$2\" == \"FreeBSD\" ) {
355 f_fstype = substr(\$9, 2, length(\$9) - 2);362 f_fstype = substr(\$9, 2, length(\$9) - 2);
356 f_options = substr(\$0, index(\$0, ",") + 2);363 f_options = substr(\$0, index(\$0, \",\") + 2);
357 f_options = substr(f_options, 1, length(f_options) - 1);364 f_options = substr(f_options, 1, length(f_options) - 1);
358 }365 }
359 if ( length(f_device) > device ) {366 if ( length(f_device) > device ) {
@@ -367,30 +374,26 @@
367 }374 }
368 }375 }
369 END{376 END{
370 print "%-" device "s %5s %4s %-" fstype "s %-" options "s %s";377 print \"%-\" device \"s %5s %4s %-\" fstype \"s %-\" options \"s %s\";
371 }378 }
372 EOF379 " $file)
373 spec="$( awk -f /tmp/pt-summary.awk "$1" )";
374 #awk -f /tmp/pt-summary.awk "$1"
375 #return;
376380
377 cat > /tmp/pt-summary.awk <<-EOF381 awk "
378 BEGIN {382 BEGIN {
379 spec=" ${spec}\\n";383 spec=\" ${spec}\\n\";
380 printf spec, "Filesystem", "Size", "Used", "Type", "Opts", "Mountpoint";384 printf spec, \"Filesystem\", \"Size\", \"Used\", \"Type\", \"Opts\", \"Mountpoint\";
381 }385 }
382 {386 {
383 f_fstype = \$10;387 f_fstype = \$10;
384 f_options = substr(\$11, 2, length(\$11) - 2);388 f_options = substr(\$11, 2, length(\$11) - 2);
385 if ( "$2" == "FreeBSD" ) {389 if ( \"$2\" == \"FreeBSD\" ) {
386 f_fstype = substr(\$9, 2, length(\$9) - 2);390 f_fstype = substr(\$9, 2, length(\$9) - 2);
387 f_options = substr(\$0, index(\$0, ",") + 2);391 f_options = substr(\$0, index(\$0, \",\") + 2);
388 f_options = substr(f_options, 1, length(f_options) - 1);392 f_options = substr(f_options, 1, length(f_options) - 1);
389 }393 }
390 printf spec, \$1, \$2, \$5, f_fstype, f_options, \$6;394 printf spec, \$1, \$2, \$5, f_fstype, f_options, \$6;
391 }395 }
392 EOF396 " $file
393 awk -f /tmp/pt-summary.awk "$1"
394}397}
395398
396# ##############################################################################399# ##############################################################################
@@ -398,6 +401,7 @@
398# multiple fdisk -l outputs in the file.401# multiple fdisk -l outputs in the file.
399# ##############################################################################402# ##############################################################################
400parse_fdisk () {403parse_fdisk () {
404 local file=$1
401 awk '405 awk '
402 BEGIN {406 BEGIN {
403 format="%-12s %4s %10s %10s %18s\n";407 format="%-12s %4s %10s %10s %18s\n";
@@ -423,7 +427,7 @@
423 }427 }
424 printf(format, $1, "Part", start, end, sprintf("%.0f", (end - start) * units));428 printf(format, $1, "Part", start, end, sprintf("%.0f", (end - start) * units));
425 }429 }
426 ' /tmp/percona-toolkit430 ' $file
427}431}
428432
429# ##############################################################################433# ##############################################################################
@@ -431,17 +435,18 @@
431# virtualization.435# virtualization.
432# ##############################################################################436# ##############################################################################
433parse_virtualization_dmesg () {437parse_virtualization_dmesg () {
434 if grep -qi -e vmware -e vmxnet -e 'paravirtualized kernel on vmi' /tmp/percona-toolkit; then438 local file=$1
439 if grep -qi -e vmware -e vmxnet -e 'paravirtualized kernel on vmi' $file; then
435 echo "VMWare";440 echo "VMWare";
436 elif grep -qi -e 'paravirtualized kernel on xen' -e 'Xen virtual console' /tmp/percona-toolkit; then441 elif grep -qi -e 'paravirtualized kernel on xen' -e 'Xen virtual console' $file; then
437 echo "Xen";442 echo "Xen";
438 elif grep -qi qemu /tmp/percona-toolkit; then443 elif grep -qi qemu $file; then
439 echo "QEmu";444 echo "QEmu";
440 elif grep -qi 'paravirtualized kernel on KVM' /tmp/percona-toolkit; then445 elif grep -qi 'paravirtualized kernel on KVM' $file; then
441 echo "KVM";446 echo "KVM";
442 elif grep -q VBOX /tmp/percona-toolkit; then447 elif grep -q VBOX $file; then
443 echo "VirtualBox";448 echo "VirtualBox";
444 elif grep -qi 'hd.: Virtual .., ATA.*drive' /tmp/percona-toolkit; then449 elif grep -qi 'hd.: Virtual .., ATA.*drive' $file; then
445 echo "Microsoft VirtualPC";450 echo "Microsoft VirtualPC";
446 fi451 fi
447}452}
@@ -462,7 +467,8 @@
462# Ethernet cards.467# Ethernet cards.
463# ##############################################################################468# ##############################################################################
464parse_ethernet_controller_lspci () {469parse_ethernet_controller_lspci () {
465 grep -i ethernet /tmp/percona-toolkit | cut -d: -f3 | while read line; do470 local file=$1
471 grep -i ethernet $file | cut -d: -f3 | while read line; do
466 name_val Controller "${line}"472 name_val Controller "${line}"
467 done473 done
468}474}
@@ -472,20 +478,21 @@
472# controllers.478# controllers.
473# ##############################################################################479# ##############################################################################
474parse_raid_controller_lspci () {480parse_raid_controller_lspci () {
475 if grep -q "RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS" /tmp/percona-toolkit; then481 local file=$1
482 if grep -q "RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS" $file; then
476 echo 'LSI Logic MegaRAID SAS'483 echo 'LSI Logic MegaRAID SAS'
477 elif grep -q "Fusion-MPT SAS" /tmp/percona-toolkit; then484 elif grep -q "Fusion-MPT SAS" $file; then
478 echo 'Fusion-MPT SAS'485 echo 'Fusion-MPT SAS'
479 elif grep -q "RAID bus controller: LSI Logic / Symbios Logic Unknown" /tmp/percona-toolkit; then486 elif grep -q "RAID bus controller: LSI Logic / Symbios Logic Unknown" $file; then
480 echo 'LSI Logic Unknown'487 echo 'LSI Logic Unknown'
481 elif grep -q "RAID bus controller: Adaptec AAC-RAID" /tmp/percona-toolkit; then488 elif grep -q "RAID bus controller: Adaptec AAC-RAID" $file; then
482 echo 'AACRAID'489 echo 'AACRAID'
483 elif grep -q "3ware [0-9]* Storage Controller" /tmp/percona-toolkit; then490 elif grep -q "3ware [0-9]* Storage Controller" $file; then
484 echo '3Ware'491 echo '3Ware'
485 elif grep -q "Hewlett-Packard Company Smart Array" /tmp/percona-toolkit; then492 elif grep -q "Hewlett-Packard Company Smart Array" $file; then
486 echo 'HP Smart Array'493 echo 'HP Smart Array'
487 elif grep -q " RAID bus controller: " /tmp/percona-toolkit; then494 elif grep -q " RAID bus controller: " $file; then
488 awk -F: '/RAID bus controller\:/ {print $3" "$5" "$6}' /tmp/percona-toolkit495 awk -F: '/RAID bus controller\:/ {print $3" "$5" "$6}' $file
489 fi496 fi
490}497}
491498
@@ -494,14 +501,15 @@
494# controllers.501# controllers.
495# ##############################################################################502# ##############################################################################
496parse_raid_controller_dmesg () {503parse_raid_controller_dmesg () {
504 local file=$1
497 pat='scsi[0-9].*: .*'505 pat='scsi[0-9].*: .*'
498 if grep -qi "${pat}megaraid" /tmp/percona-toolkit; then506 if grep -qi "${pat}megaraid" $file; then
499 echo 'LSI Logic MegaRAID SAS'507 echo 'LSI Logic MegaRAID SAS'
500 elif grep -q "Fusion MPT SAS" /tmp/percona-toolkit; then508 elif grep -q "Fusion MPT SAS" $file; then
501 echo 'Fusion-MPT SAS'509 echo 'Fusion-MPT SAS'
502 elif grep -q "${pat}aacraid" /tmp/percona-toolkit; then510 elif grep -q "${pat}aacraid" $file; then
503 echo 'AACRAID'511 echo 'AACRAID'
504 elif grep -q "${pat}3ware [0-9]* Storage Controller" /tmp/percona-toolkit; then512 elif grep -q "${pat}3ware [0-9]* Storage Controller" $file; then
505 echo '3Ware'513 echo '3Ware'
506 fi514 fi
507}515}
@@ -511,20 +519,22 @@
511# /tmp/percona-toolkit519# /tmp/percona-toolkit
512# ##############################################################################520# ##############################################################################
513parse_hpacucli () {521parse_hpacucli () {
514 grep 'logicaldrive\|physicaldrive' /tmp/percona-toolkit522 local file=$1
523 grep 'logicaldrive\|physicaldrive' $file
515}524}
516525
517# ##############################################################################526# ##############################################################################
518# Parse the output of arcconf, which should be stored in /tmp/percona-toolkit527# Parse the output of arcconf, which should be stored in /tmp/percona-toolkit
519# ##############################################################################528# ##############################################################################
520parse_arcconf () {529parse_arcconf () {
521 model=$(awk -F: '/Controller Model/{print $2}' /tmp/percona-toolkit)530 local file=$1
522 chan="$(awk -F: '/Channel description/{print $2}' /tmp/percona-toolkit)"531 model=$(awk -F: '/Controller Model/{print $2}' $file)
523 cache="$(awk -F: '/Installed memory/{print $2}' /tmp/percona-toolkit)"532 chan="$(awk -F: '/Channel description/{print $2}' $file)"
524 status="$(awk -F: '/Controller Status/{print $2}' /tmp/percona-toolkit)"533 cache="$(awk -F: '/Installed memory/{print $2}' $file)"
534 status="$(awk -F: '/Controller Status/{print $2}' $file)"
525 name_val Specs "${model/ /},${chan},${cache} cache,${status}"535 name_val Specs "${model/ /},${chan},${cache} cache,${status}"
526536
527 battery=$(grep -A5 'Controller Battery Info' /tmp/percona-toolkit \537 battery=$(grep -A5 'Controller Battery Info' $file \
528 | awk '/Capacity remaining/ {c=$4}538 | awk '/Capacity remaining/ {c=$4}
529 /Status/ {s=$3}539 /Status/ {s=$3}
530 /Time remaining/ {t=sprintf("%dd%dh%dm", $7, $9, $11)}540 /Time remaining/ {t=sprintf("%dd%dh%dm", $7, $9, $11)}
@@ -537,9 +547,8 @@
537 echo547 echo
538 echo " LogicalDev Size RAID Disks Stripe Status Cache"548 echo " LogicalDev Size RAID Disks Stripe Status Cache"
539 echo " ========== ========= ==== ===== ====== ======= ======="549 echo " ========== ========= ==== ===== ====== ======= ======="
540 for dev in $(awk '/Logical device number/{print $4}' /tmp/percona-toolkit); do550 for dev in $(awk '/Logical device number/{print $4}' $file); do
541 sed -n -e "/^Logical device .* ${dev}$/,/^$\|^Logical device number/p" \551 sed -n -e "/^Logical device .* ${dev}$/,/^$\|^Logical device number/p" $file \
542 /tmp/percona-toolkit \
543 | awk '552 | awk '
544 /Logical device name/ {d=$5}553 /Logical device name/ {d=$5}
545 /Size/ {z=$3 " " $4}554 /Size/ {z=$3 " " $4}
@@ -565,7 +574,7 @@
565574
566 # Find the paragraph with physical devices, tabularize with assoc arrays.575 # Find the paragraph with physical devices, tabularize with assoc arrays.
567 tempresult=""576 tempresult=""
568 sed -n -e '/Physical Device information/,/^$/p' /tmp/percona-toolkit \577 sed -n -e '/Physical Device information/,/^$/p' $file \
569 | awk -F: '578 | awk -F: '
570 /Device #[0-9]/ {579 /Device #[0-9]/ {
571 device=substr($0, index($0, "#"));580 device=substr($0, index($0, "#"));
@@ -612,32 +621,33 @@
612 }621 }
613 }622 }
614 }'623 }'
615
616}624}
617625
618# ##############################################################################626# ##############################################################################
619# Parse the output of "lsiutil -i -s" from /tmp/percona-toolkit627# Parse the output of "lsiutil -i -s".
620# ##############################################################################628# ##############################################################################
621parse_fusionmpt_lsiutil () {629parse_fusionmpt_lsiutil () {
630 local file=$1
622 echo631 echo
623 awk '/LSI.*Firmware/ { print " ", $0 }' /tmp/percona-toolkit632 awk '/LSI.*Firmware/ { print " ", $0 }' $file
624 grep . /tmp/percona-toolkit | sed -n -e '/B___T___L/,$ {s/^/ /; p}'633 grep . $file | sed -n -e '/B___T___L/,$ {s/^/ /; p}'
625}634}
626635
627# ##############################################################################636# ##############################################################################
628# Parse the output of MegaCli64 -AdpAllInfo -aALL from /tmp/percona-toolkit.637# Parse the output of MegaCli64 -AdpAllInfo -aALL from /tmp/percona-toolkit.
629# ##############################################################################638# ##############################################################################
630parse_lsi_megaraid_adapter_info () {639parse_lsi_megaraid_adapter_info () {
631 name=$(awk -F: '/Product Name/{print substr($2, 2)}' /tmp/percona-toolkit);640 local file=$1
632 int=$(awk '/Host Interface/{print $4}' /tmp/percona-toolkit);641 name=$(awk -F: '/Product Name/{print substr($2, 2)}' $file);
633 prt=$(awk '/Number of Backend Port/{print $5}' /tmp/percona-toolkit);642 int=$(awk '/Host Interface/{print $4}' $file);
634 bbu=$(awk '/^BBU :/{print $3}' /tmp/percona-toolkit);643 prt=$(awk '/Number of Backend Port/{print $5}' $file);
635 mem=$(awk '/Memory Size/{print $4}' /tmp/percona-toolkit);644 bbu=$(awk '/^BBU :/{print $3}' $file);
636 vdr=$(awk '/Virtual Drives/{print $4}' /tmp/percona-toolkit);645 mem=$(awk '/Memory Size/{print $4}' $file);
637 dvd=$(awk '/Degraded/{print $3}' /tmp/percona-toolkit);646 vdr=$(awk '/Virtual Drives/{print $4}' $file);
638 phy=$(awk '/^ Disks/{print $3}' /tmp/percona-toolkit);647 dvd=$(awk '/Degraded/{print $3}' $file);
639 crd=$(awk '/Critical Disks/{print $4}' /tmp/percona-toolkit);648 phy=$(awk '/^ Disks/{print $3}' $file);
640 fad=$(awk '/Failed Disks/{print $4}' /tmp/percona-toolkit);649 crd=$(awk '/Critical Disks/{print $4}' $file);
650 fad=$(awk '/Failed Disks/{print $4}' $file);
641 name_val Model "${name}, ${int} interface, ${prt} ports"651 name_val Model "${name}, ${int} interface, ${prt} ports"
642 name_val Cache "${mem} Memory, BBU ${bbu}"652 name_val Cache "${mem} Memory, BBU ${bbu}"
643}653}
@@ -647,9 +657,10 @@
647# /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL657# /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL
648# ##############################################################################658# ##############################################################################
649parse_lsi_megaraid_bbu_status () {659parse_lsi_megaraid_bbu_status () {
650 charge=$(awk '/Relative State/{print $5}' /tmp/percona-toolkit);660 local file=$1
651 temp=$(awk '/^Temperature/{print $2}' /tmp/percona-toolkit);661 charge=$(awk '/Relative State/{print $5}' $file);
652 soh=$(awk '/isSOHGood:/{print $2}' /tmp/percona-toolkit);662 temp=$(awk '/^Temperature/{print $2}' $file);
663 soh=$(awk '/isSOHGood:/{print $2}' $file);
653 name_val BBU "${charge}% Charged, Temperature ${temp}C, isSOHGood=${soh}"664 name_val BBU "${charge}% Charged, Temperature ${temp}C, isSOHGood=${soh}"
654}665}
655666
@@ -660,11 +671,12 @@
660# /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL671# /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL
661# ##############################################################################672# ##############################################################################
662parse_lsi_megaraid_devices () {673parse_lsi_megaraid_devices () {
674 local file=$1
663 echo675 echo
664 echo " PhysiclDev Type State Errors Vendor Model Size"676 echo " PhysiclDev Type State Errors Vendor Model Size"
665 echo " ========== ==== ======= ====== ======= ============ ==========="677 echo " ========== ==== ======= ====== ======= ============ ==========="
666 for dev in $(awk '/Device Id/{print $3}' /tmp/percona-toolkit); do678 for dev in $(awk '/Device Id/{print $3}' $file); do
667 sed -e '/./{H;$!d;}' -e "x;/Device Id: ${dev}/!d;" /tmp/percona-toolkit \679 sed -e '/./{H;$!d;}' -e "x;/Device Id: ${dev}/!d;" $file \
668 | awk '680 | awk '
669 /Media Type/ {d=substr($0, index($0, ":") + 2)}681 /Media Type/ {d=substr($0, index($0, ":") + 2)}
670 /PD Type/ {t=$3}682 /PD Type/ {t=$3}
@@ -688,6 +700,7 @@
688# /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aAll700# /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aAll
689# ##############################################################################701# ##############################################################################
690parse_lsi_megaraid_virtual_devices () {702parse_lsi_megaraid_virtual_devices () {
703 local file=$1
691 # Somewhere on the Internet, I found the following guide to understanding the704 # Somewhere on the Internet, I found the following guide to understanding the
692 # RAID level, but I don't know the source anymore.705 # RAID level, but I don't know the source anymore.
693 # Primary-0, Secondary-0, RAID Level Qualifier-0 = 0706 # Primary-0, Secondary-0, RAID Level Qualifier-0 = 0
@@ -758,7 +771,7 @@
758 devices[device ",stripe"], devices[device ",state"],771 devices[device ",stripe"], devices[device ",state"],
759 devices[device ",wpolicy"] ", " devices[device ",rpolicy"]);772 devices[device ",wpolicy"] ", " devices[device ",rpolicy"]);
760 }773 }
761 }' /tmp/percona-toolkit774 }' $file
762}775}
763776
764# ##############################################################################777# ##############################################################################
@@ -766,15 +779,16 @@
766# system activity is enough.779# system activity is enough.
767# ##############################################################################780# ##############################################################################
768format_vmstat () {781format_vmstat () {
769 cat > /tmp/pt-summary.awk <<-EOF782 local file=$1
783 awk "
770 BEGIN {784 BEGIN {
771 format = " %2s %2s %4s %4s %5s %5s %6s %6s %3s %3s %3s %3s %3s\n";785 format = \" %2s %2s %4s %4s %5s %5s %6s %6s %3s %3s %3s %3s %3s\n\";
772 }786 }
773 /procs/ {787 /procs/ {
774 print " procs ---swap-- -----io---- ---system---- --------cpu--------";788 print \" procs ---swap-- -----io---- ---system---- --------cpu--------\";
775 }789 }
776 /bo/ {790 /bo/ {
777 printf format, "r", "b", "si", "so", "bi", "bo", "ir", "cs", "us", "sy", "il", "wa", "st";791 printf format, \"r\", \"b\", \"si\", \"so\", \"bi\", \"bo\", \"ir\", \"cs\", \"us\", \"sy\", \"il\", \"wa\", \"st\";
778 }792 }
779 \$0 !~ /r/ {793 \$0 !~ /r/ {
780 fuzzy_var = \$1; ${fuzzy_formula} r = fuzzy_var;794 fuzzy_var = \$1; ${fuzzy_formula} r = fuzzy_var;
@@ -792,9 +806,8 @@
792 fuzzy_var = \$17; st = fuzzy_var;806 fuzzy_var = \$17; st = fuzzy_var;
793 printf format, r, b, si, so, bi, bo, ir, cs, us, sy, il, wa, st;807 printf format, r, b, si, so, bi, bo, ir, cs, us, sy, il, wa, st;
794 }808 }
795 EOF809 " $file
796 awk -f /tmp/pt-summary.awk /tmp/percona-toolkit810}
797 }
798811
799# ##############################################################################812# ##############################################################################
800# The main() function is called at the end of the script. This makes it813# The main() function is called at the end of the script. This makes it
@@ -931,7 +944,7 @@
931 dmesg > /tmp/percona-toolkit 2>/dev/null944 dmesg > /tmp/percona-toolkit 2>/dev/null
932 fi945 fi
933 if [ -s /tmp/percona-toolkit ]; then946 if [ -s /tmp/percona-toolkit ]; then
934 virt="$(parse_virtualization_dmesg)"947 virt="$(parse_virtualization_dmesg /tmp/percona-toolkit)"
935 fi948 fi
936 if [ -z "${virt}" ]; then949 if [ -z "${virt}" ]; then
937 if which lspci >/dev/null 2>&1; then950 if which lspci >/dev/null 2>&1; then
@@ -963,7 +976,7 @@
963 section Processor976 section Processor
964 if [ -f /proc/cpuinfo ]; then977 if [ -f /proc/cpuinfo ]; then
965 cat /proc/cpuinfo > /tmp/percona-toolkit 2>/dev/null978 cat /proc/cpuinfo > /tmp/percona-toolkit 2>/dev/null
966 parse_proc_cpuinfo979 parse_proc_cpuinfo /tmp/percona-toolkit
967 elif [ "${platform}" = "FreeBSD" ]; then980 elif [ "${platform}" = "FreeBSD" ]; then
968 parse_sysctl_cpu_freebsd /tmp/percona-toolkit.sysctl981 parse_sysctl_cpu_freebsd /tmp/percona-toolkit.sysctl
969 elif [ "${platform}" = "SunOS" ]; then982 elif [ "${platform}" = "SunOS" ]; then
@@ -995,7 +1008,7 @@
995 fi1008 fi
9961009
997 if which dmidecode >/dev/null 2>&1 && dmidecode > /tmp/percona-toolkit 2>/dev/null; then1010 if which dmidecode >/dev/null 2>&1 && dmidecode > /tmp/percona-toolkit 2>/dev/null; then
998 parse_dmidecode_mem_devices1011 parse_dmidecode_mem_devices /tmp/percona-toolkit
999 fi1012 fi
10001013
1001 # ########################################################################1014 # ########################################################################
@@ -1028,7 +1041,7 @@
10281041
1029 # Relies on /tmp/percona-toolkit having data from the Disk Schedulers loop.1042 # Relies on /tmp/percona-toolkit having data from the Disk Schedulers loop.
1030 section "Disk_Partioning"1043 section "Disk_Partioning"
1031 parse_fdisk1044 parse_fdisk /tmp/percona-toolkit
10321045
1033 section "Kernel_Inode_State"1046 section "Kernel_Inode_State"
1034 for file in dentry-state file-nr inode-nr; do1047 for file in dentry-state file-nr inode-nr; do
@@ -1052,14 +1065,14 @@
1052 # /var/log/dmesg if possible.1065 # /var/log/dmesg if possible.
1053 # ########################################################################1066 # ########################################################################
1054 if which lspci >/dev/null 2>&1 && lspci > /tmp/percona-toolkit 2>/dev/null; then1067 if which lspci >/dev/null 2>&1 && lspci > /tmp/percona-toolkit 2>/dev/null; then
1055 controller="$(parse_raid_controller_lspci)"1068 controller="$(parse_raid_controller_lspci /tmp/percona-toolkit)"
1056 fi1069 fi
1057 if [ -z "${controller}" ]; then1070 if [ -z "${controller}" ]; then
1058 cat /var/log/dmesg > /tmp/percona-toolkit 2>/dev/null1071 cat /var/log/dmesg > /tmp/percona-toolkit 2>/dev/null
1059 if [ ! -s /tmp/percona-toolkit ]; then1072 if [ ! -s /tmp/percona-toolkit ]; then
1060 dmesg > /tmp/percona-toolkit 2>/dev/null1073 dmesg > /tmp/percona-toolkit 2>/dev/null
1061 fi1074 fi
1062 controller="$(parse_raid_controller_dmesg)"1075 controller="$(parse_raid_controller_dmesg /tmp/percona-toolkit)"
1063 fi1076 fi
10641077
1065 name_val Controller "${controller:-No RAID controller detected}"1078 name_val Controller "${controller:-No RAID controller detected}"
@@ -1073,28 +1086,28 @@
1073 notfound=""1086 notfound=""
1074 if [ "${controller}" = "AACRAID" ]; then1087 if [ "${controller}" = "AACRAID" ]; then
1075 if arcconf getconfig 1 > /tmp/percona-toolkit 2>/dev/null; then1088 if arcconf getconfig 1 > /tmp/percona-toolkit 2>/dev/null; then
1076 parse_arcconf1089 parse_arcconf /tmp/percona-toolkit
1077 elif ! which arcconf >/dev/null 2>&1; then1090 elif ! which arcconf >/dev/null 2>&1; then
1078 notfound="e.g. http://www.adaptec.com/en-US/support/raid/scsi_raid/ASR-2120S/"1091 notfound="e.g. http://www.adaptec.com/en-US/support/raid/scsi_raid/ASR-2120S/"
1079 fi1092 fi
1080 elif [ "${controller}" = "HP Smart Array" ]; then1093 elif [ "${controller}" = "HP Smart Array" ]; then
1081 if hpacucli ctrl all show config > /tmp/percona-toolkit 2>/dev/null; then1094 if hpacucli ctrl all show config > /tmp/percona-toolkit 2>/dev/null; then
1082 parse_hpacucli1095 parse_hpacucli /tmp/percona-toolkit
1083 elif ! which hpacucli >/dev/null 2>&1; then1096 elif ! which hpacucli >/dev/null 2>&1; then
1084 notfound="your package repository or the manufacturer's website"1097 notfound="your package repository or the manufacturer's website"
1085 fi1098 fi
1086 elif [ "${controller}" = "LSI Logic MegaRAID SAS" ]; then1099 elif [ "${controller}" = "LSI Logic MegaRAID SAS" ]; then
1087 if MegaCli64 -AdpAllInfo -aALL -NoLog > /tmp/percona-toolkit 2>/dev/null; then1100 if MegaCli64 -AdpAllInfo -aALL -NoLog > /tmp/percona-toolkit 2>/dev/null; then
1088 parse_lsi_megaraid_adapter_info1101 parse_lsi_megaraid_adapter_info /tmp/percona-toolkit
1089 elif ! which MegaCli64 >/dev/null 2>&1; then1102 elif ! which MegaCli64 >/dev/null 2>&1; then
1090 notfound="your package repository or the manufacturer's website"1103 notfound="your package repository or the manufacturer's website"
1091 fi1104 fi
1092 if MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL -NoLog > /tmp/percona-toolkit 2>/dev/null; then1105 if MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL -NoLog > /tmp/percona-toolkit 2>/dev/null; then
1093 parse_lsi_megaraid_bbu_status1106 parse_lsi_megaraid_bbu_status /tmp/percona-toolkit
1094 fi1107 fi
1095 if MegaCli64 -LdPdInfo -aALL -NoLog > /tmp/percona-toolkit 2>/dev/null; then1108 if MegaCli64 -LdPdInfo -aALL -NoLog > /tmp/percona-toolkit 2>/dev/null; then
1096 parse_lsi_megaraid_virtual_devices1109 parse_lsi_megaraid_virtual_devices /tmp/percona-toolkit
1097 parse_lsi_megaraid_devices1110 parse_lsi_megaraid_devices /tmp/percona-toolkit
1098 fi1111 fi
1099 fi1112 fi
11001113
@@ -1110,7 +1123,7 @@
1110 if [ "${platform}" = "Linux" ]; then1123 if [ "${platform}" = "Linux" ]; then
1111 section Network_Config1124 section Network_Config
1112 if which lspci > /dev/null 2>&1 && lspci > /tmp/percona-toolkit 2>/dev/null; then1125 if which lspci > /dev/null 2>&1 && lspci > /tmp/percona-toolkit 2>/dev/null; then
1113 parse_ethernet_controller_lspci1126 parse_ethernet_controller_lspci /tmp/percona-toolkit
1114 fi1127 fi
1115 if sysctl net.ipv4.tcp_fin_timeout > /dev/null 2>&1; then1128 if sysctl net.ipv4.tcp_fin_timeout > /dev/null 2>&1; then
1116 name_val "FIN Timeout" "$(sysctl net.ipv4.tcp_fin_timeout)"1129 name_val "FIN Timeout" "$(sysctl net.ipv4.tcp_fin_timeout)"
@@ -1130,7 +1143,7 @@
1130 if [ "${platform}" = "Linux" ]; then1143 if [ "${platform}" = "Linux" ]; then
1131 section Network_Connections1144 section Network_Connections
1132 if netstat -antp > /tmp/percona-toolkit 2>/dev/null; then1145 if netstat -antp > /tmp/percona-toolkit 2>/dev/null; then
1133 parse_netstat1146 parse_netstat /tmp/percona-toolkit
1134 fi1147 fi
1135 fi1148 fi
1136 fi1149 fi
@@ -1153,7 +1166,7 @@
1153 section "Simplified_and_fuzzy_rounded_vmstat_(wait_please)"1166 section "Simplified_and_fuzzy_rounded_vmstat_(wait_please)"
1154 vmstat 1 5 > /tmp/percona-toolkit1167 vmstat 1 5 > /tmp/percona-toolkit
1155 if [ "${platform}" = "Linux" ]; then1168 if [ "${platform}" = "Linux" ]; then
1156 format_vmstat1169 format_vmstat /tmp/percona-toolkit
1157 else1170 else
1158 # TODO: simplify/format for other platforms1171 # TODO: simplify/format for other platforms
1159 cat /tmp/percona-toolkit1172 cat /tmp/percona-toolkit
11601173
=== removed file 't/pt-diskstats/group-by-all-01'
--- t/pt-diskstats/group-by-all-01 2011-07-01 16:29:50 +0000
+++ t/pt-diskstats/group-by-all-01 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
1#!/bin/bash
2#group_by_all samples/diskstats-001.txt
3
4cat <<EOF > $1
5 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
6 2.0 ram0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
7 2.0 cciss/c0d0 0.0 0.0 0.0 0% 0.0 0.0 23.0 53.2 0.6 85% 0.0 0.9 0% 0
8 2.0 cciss/c0d0p1 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
9 2.0 cciss/c0d0p2 0.0 0.0 0.0 0% 0.0 0.0 23.0 53.2 0.6 85% 0.0 0.9 0% 0
10 2.0 cciss/c0d1 466.5 44.6 10.2 0% 11.2 23.9 985.0 47.5 22.8 0% 0.1 0.1 92% 18
11 2.0 cciss/c1d0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
12 2.0 dm-0 0.0 0.0 0.0 0% 0.0 0.0 153.0 8.0 0.6 0% 0.1 0.8 0% 0
13 2.0 md0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
14 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
15 4.0 ram0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
16 4.0 cciss/c0d0 0.0 0.0 0.0 0% 0.0 0.0 16.0 35.5 0.3 77% 0.0 0.4 0% 0
17 4.0 cciss/c0d0p1 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
18 4.0 cciss/c0d0p2 0.0 0.0 0.0 0% 0.0 0.0 16.0 35.5 0.3 77% 0.0 0.4 0% 0
19 4.0 cciss/c0d1 373.0 47.2 8.6 0% 10.2 27.4 560.0 46.2 12.6 0% 0.1 0.1 91% 17
20 4.0 cciss/c1d0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
21 4.0 dm-0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
22 4.0 md0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
23 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
24 5.0 ram0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
25 5.0 cciss/c0d0 0.0 0.0 0.0 0% 0.0 0.0 4.0 62.0 0.1 87% 0.0 0.0 0% 0
26 5.0 cciss/c0d0p1 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
27 5.0 cciss/c0d0p2 0.0 0.0 0.0 0% 0.0 0.0 4.0 62.0 0.1 87% 0.0 0.0 0% 0
28 5.0 cciss/c0d1 848.0 42.6 17.7 0% 21.6 25.5 1979.0 49.7 48.0 0% 0.2 0.1 178% 9
29 5.0 cciss/c1d0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
30 5.0 dm-0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
31 5.0 md0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
32 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
33 7.0 ram0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
34 7.0 cciss/c0d0 0.0 0.0 0.0 0% 0.0 0.0 21.0 74.7 0.8 89% 0.0 0.5 0% 0
35 7.0 cciss/c0d0p1 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
36 7.0 cciss/c0d0p2 0.0 0.0 0.0 0% 0.0 0.0 21.0 74.7 0.8 89% 0.0 0.5 0% 0
37 7.0 cciss/c0d1 340.0 36.6 6.1 0% 8.1 23.8 913.0 49.4 22.0 0% 0.1 0.1 86% 5
38 7.0 cciss/c1d0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
39 7.0 dm-0 0.0 0.0 0.0 0% 0.0 0.0 194.5 8.0 0.8 0% 0.1 0.6 0% 0
40 7.0 md0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
41EOF
420
=== removed file 't/pt-diskstats/group-by-disk-01'
--- t/pt-diskstats/group-by-disk-01 2011-07-01 16:29:50 +0000
+++ t/pt-diskstats/group-by-disk-01 1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
1#!/bin/bash
2#group_by_disk samples/diskstats-001.txt
3
4cat <<EOF > $1
5 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
6 {4} ram0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
7 {4} cciss/c0d0 0.0 0.0 0.0 0% 0.0 0.0 17.7 56.2 0.5 86% 0.0 0.6 0% 0
8 {4} cciss/c0d0p1 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
9 {4} cciss/c0d0p2 0.0 0.0 0.0 0% 0.0 0.0 17.7 56.2 0.5 86% 0.0 0.6 0% 0
10 {4} cciss/c0d1 458.1 43.0 9.6 0% 11.5 25.1 985.0 48.4 23.3 0% 0.1 0.1 102% 0
11 {4} cciss/c1d0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
12 {4} dm-0 0.0 0.0 0.0 0% 0.0 0.0 99.3 8.0 0.4 0% 0.1 0.7 0% 0
13 {4} md0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
14EOF
150
=== removed file 't/pt-diskstats/group-by-disk-02'
--- t/pt-diskstats/group-by-disk-02 2011-07-01 16:29:50 +0000
+++ t/pt-diskstats/group-by-disk-02 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
1#!/bin/bash
2#group_by_disk samples/diskstats-005.txt
3
4cat <<EOF > $1
5 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
6 {5} sda3 1394.1 32.0 21.8 1% 0.5 0.4 98.8 62.8 3.0 48% 0.0 0.3 41% 0
7 {5} sda4 1394.1 32.0 21.8 1% 0.5 0.4 98.8 62.8 3.0 48% 0.0 0.3 41% 0
8EOF
90
=== removed file 't/pt-diskstats/group-by-disk-03'
--- t/pt-diskstats/group-by-disk-03 2011-07-01 16:29:50 +0000
+++ t/pt-diskstats/group-by-disk-03 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
1#!/bin/bash
2#group_by_disk /tmp/aspersa
3
4cat <<EOF > $1
5 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
6 {5} sda3 1394.1 32.0 21.8 1% 0.5 0.4 98.8 62.8 3.0 48% 0.0 0.3 41% 0
7 {5} sda4 1394.1 32.0 21.8 1% 0.5 0.4 98.8 62.8 3.0 48% 0.0 0.3 41% 0
8EOF
9
10cat > $2 <<EOF
11TS 1298130002.073935000
12EOF
13cat >>$2 samples/diskstats-005.txt
140
=== removed file 't/pt-diskstats/group-by-disk-04'
--- t/pt-diskstats/group-by-disk-04 2011-07-01 16:29:50 +0000
+++ t/pt-diskstats/group-by-disk-04 1970-01-01 00:00:00 +0000
@@ -1,11 +0,0 @@
1#!/bin/bash
2#group_by_disk /tmp/aspersa
3
4cat <<EOF > $1
5EOF
6
7cat <<EOF > $2
8TS 1297205887.156653000
9 1 0 ram0 0 0 0 0 0 0 0 0 0 0 0
10TS 1297205888.161613000
11EOF
120
=== removed file 't/pt-diskstats/group-by-disk-05'
--- t/pt-diskstats/group-by-disk-05 2011-07-01 16:29:50 +0000
+++ t/pt-diskstats/group-by-disk-05 1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
1#!/bin/bash
2#group_by_disk /tmp/aspersa
3
4cat <<EOF > $1
5 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
6 {1} ram0 1.0 1.0 0.0 50% 0.0 1.0 1.0 1.0 0.0 50% 0.0 1.0 0% 0
7EOF
8
9cat <<EOF > $2
10 1 0 ram0 0 0 0 0 0 0 0 0 0 0 0
11TS 1297205887.156653000
12 1 0 ram0 1 1 1 1 1 1 1 1 1 1 1
13TS 1297205888.161613000
14EOF
150
=== removed file 't/pt-diskstats/group-by-sample-01'
--- t/pt-diskstats/group-by-sample-01 2011-07-01 16:29:50 +0000
+++ t/pt-diskstats/group-by-sample-01 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
1#!/bin/bash
2#group_by_sample samples/diskstats-001.txt
3
4cat <<EOF > $1
5 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
6 2.0 {8} 466.5 44.6 10.2 0% 1.4 23.9 1184.0 42.6 24.6 18% 0.0 0.2 12% 18
7 4.0 {8} 373.0 47.2 8.6 0% 1.3 27.4 592.0 45.6 13.2 16% 0.0 0.1 11% 17
8 5.0 {8} 848.0 42.6 17.7 0% 2.7 25.5 1987.0 49.8 48.3 3% 0.0 0.1 22% 9
9 7.0 {8} 340.0 36.6 6.1 0% 1.0 23.8 1149.5 43.4 24.3 23% 0.0 0.2 11% 5
10EOF
110
=== removed file 't/pt-diskstats/group-by-sample-02'
--- t/pt-diskstats/group-by-sample-02 2011-07-01 16:29:50 +0000
+++ t/pt-diskstats/group-by-sample-02 1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
1#!/bin/bash
2#group_by_sample /tmp/aspersa
3
4cat <<EOF > $1
5 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
6 1.0 sda3 1406.0 32.0 21.9 1% 0.6 0.4 46.3 61.1 1.4 67% 0.0 0.3 41% 0
7 2.0 sda3 1580.1 31.9 24.6 1% 0.6 0.4 163.7 62.2 5.0 36% 0.1 0.3 46% 1
8 3.0 sda3 1296.7 32.0 20.2 1% 0.5 0.4 51.3 50.5 1.3 62% 0.0 0.3 42% 1
9 4.1 sda3 1429.7 32.0 22.3 1% 0.5 0.3 73.9 61.0 2.2 57% 0.0 0.3 40% 0
10 5.1 sda3 1258.1 32.0 19.6 1% 0.4 0.3 158.7 68.8 5.3 36% 0.1 0.4 37% 0
11EOF
12
13cat > $2 <<EOF
14 8 3 sda3 4257315954 34043324 136169413346 1922644483 492348396 547079617 32764474048 248191881 0 1348454960 2169768832
15TS 1298130003.073935000
16 8 3 sda3 4257317380 34043342 136169458914 1922645044 492348443 547079711 32764476920 248191896 0 1348455373 2169769408
17TS 1298130004.088149000
18 8 3 sda3 4257318982 34043364 136169510082 1922645662 492348609 547079803 32764487248 248191947 1 1348455841 2169770075
19TS 1298130005.102035000
20 8 3 sda3 4257320297 34043384 136169552098 1922646173 492348661 547079889 32764489872 248191964 1 1348456262 2169770603
21TS 1298130006.116158000
22 8 3 sda3 4257321748 34043394 136169598530 1922646672 492348736 547079990 32764494448 248191983 0 1348456671 2169771121
23TS 1298130007.131062000
24 8 3 sda3 4257323024 34043406 136169639330 1922647105 492348897 547080080 32764505520 248192043 0 1348457045 2169771613
25TS 1298130008.145277000
26EOF
27
28# The below is incremental samples of the data and timestamps:
29# TS_diff reads reads_mrg read_sectors ms_reading writes write_mrg wrt_sectors ms_wrting i ms_ding_io ms_weightd
30# 1.14214000 1426 18 45568 561 47 94 2872 15 0 413 576
31# 1.13886000 1602 22 51168 618 166 92 10328 51 1 468 667
32# 1.14123000 1315 20 42016 511 52 86 2624 17 1 421 528
33# 1.14904000 1451 10 46432 499 75 101 4576 19 0 409 518
34# 1.14215000 1276 12 40800 433 161 90 11072 60 0 374 492
350
=== removed file 't/pt-diskstats/group-by-sample-03'
--- t/pt-diskstats/group-by-sample-03 2011-07-01 16:29:50 +0000
+++ t/pt-diskstats/group-by-sample-03 1970-01-01 00:00:00 +0000
@@ -1,11 +0,0 @@
1#!/bin/bash
2#group_by_sample samples/diskstats-005.txt
3
4cat <<EOF > $1
5 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
6 1.0 {2} 2812.0 32.0 43.9 1% 0.6 0.4 92.7 61.1 2.8 67% 0.0 0.3 41% 0
7 2.0 {2} 3160.1 31.9 49.3 1% 0.6 0.4 327.5 62.2 9.9 36% 0.1 0.3 46% 2
8 3.0 {2} 2593.4 32.0 40.5 1% 0.5 0.4 102.6 50.5 2.5 62% 0.0 0.3 42% 2
9 4.1 {2} 2859.4 32.0 44.7 1% 0.5 0.3 147.8 61.0 4.4 57% 0.0 0.3 40% 0
10 5.1 {2} 2516.2 32.0 39.3 1% 0.4 0.3 317.5 68.8 10.7 36% 0.1 0.4 37% 0
11EOF
120
=== removed file 't/pt-diskstats/group-by-sample-04'
--- t/pt-diskstats/group-by-sample-04 2011-07-01 16:29:50 +0000
+++ t/pt-diskstats/group-by-sample-04 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
1#!/bin/bash
2#group_by_sample /tmp/aspersa
3
4cat <<EOF > $1
5 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
6 1.0 {2} 2812.0 32.0 43.9 1% 0.6 0.4 92.7 61.1 2.8 67% 0.0 0.3 41% 0
7 2.0 {2} 3160.1 31.9 49.3 1% 0.6 0.4 327.5 62.2 9.9 36% 0.1 0.3 46% 2
8 3.0 {2} 2593.4 32.0 40.5 1% 0.5 0.4 102.6 50.5 2.5 62% 0.0 0.3 42% 2
9 4.1 {2} 2859.4 32.0 44.7 1% 0.5 0.3 147.8 61.0 4.4 57% 0.0 0.3 40% 0
10 5.1 {2} 2516.2 32.0 39.3 1% 0.4 0.3 317.5 68.8 10.7 36% 0.1 0.4 37% 0
11EOF
12
13cat > $2 <<EOF
14TS 1298130002.073935000
15EOF
16cat >>$2 samples/diskstats-005.txt
170
=== added file 't/pt-diskstats/group_by_all.sh'
--- t/pt-diskstats/group_by_all.sh 1970-01-01 00:00:00 +0000
+++ t/pt-diskstats/group_by_all.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,47 @@
1#!/bin/bash
2
3# This test file must be ran by util/test-bash-functions.
4
5TESTS=1
6
7cat <<EOF > $TMPDIR/expected
8 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
9 2.0 ram0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
10 2.0 cciss/c0d0 0.0 0.0 0.0 0% 0.0 0.0 23.0 53.2 0.6 85% 0.0 0.9 0% 0
11 2.0 cciss/c0d0p1 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
12 2.0 cciss/c0d0p2 0.0 0.0 0.0 0% 0.0 0.0 23.0 53.2 0.6 85% 0.0 0.9 0% 0
13 2.0 cciss/c0d1 466.5 44.6 10.2 0% 11.2 23.9 985.0 47.5 22.8 0% 0.1 0.1 92% 18
14 2.0 cciss/c1d0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
15 2.0 dm-0 0.0 0.0 0.0 0% 0.0 0.0 153.0 8.0 0.6 0% 0.1 0.8 0% 0
16 2.0 md0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
17 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
18 4.0 ram0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
19 4.0 cciss/c0d0 0.0 0.0 0.0 0% 0.0 0.0 16.0 35.5 0.3 77% 0.0 0.4 0% 0
20 4.0 cciss/c0d0p1 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
21 4.0 cciss/c0d0p2 0.0 0.0 0.0 0% 0.0 0.0 16.0 35.5 0.3 77% 0.0 0.4 0% 0
22 4.0 cciss/c0d1 373.0 47.2 8.6 0% 10.2 27.4 560.0 46.2 12.6 0% 0.1 0.1 91% 17
23 4.0 cciss/c1d0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
24 4.0 dm-0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
25 4.0 md0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
26 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
27 5.0 ram0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
28 5.0 cciss/c0d0 0.0 0.0 0.0 0% 0.0 0.0 4.0 62.0 0.1 87% 0.0 0.0 0% 0
29 5.0 cciss/c0d0p1 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
30 5.0 cciss/c0d0p2 0.0 0.0 0.0 0% 0.0 0.0 4.0 62.0 0.1 87% 0.0 0.0 0% 0
31 5.0 cciss/c0d1 848.0 42.6 17.7 0% 21.6 25.5 1979.0 49.7 48.0 0% 0.2 0.1 178% 9
32 5.0 cciss/c1d0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
33 5.0 dm-0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
34 5.0 md0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
35 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
36 7.0 ram0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
37 7.0 cciss/c0d0 0.0 0.0 0.0 0% 0.0 0.0 21.0 74.7 0.8 89% 0.0 0.5 0% 0
38 7.0 cciss/c0d0p1 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
39 7.0 cciss/c0d0p2 0.0 0.0 0.0 0% 0.0 0.0 21.0 74.7 0.8 89% 0.0 0.5 0% 0
40 7.0 cciss/c0d1 340.0 36.6 6.1 0% 8.1 23.8 913.0 49.4 22.0 0% 0.1 0.1 86% 5
41 7.0 cciss/c1d0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
42 7.0 dm-0 0.0 0.0 0.0 0% 0.0 0.0 194.5 8.0 0.8 0% 0.1 0.6 0% 0
43 7.0 md0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
44EOF
45
46group_by_all "samples/diskstats-001.txt" > $TMPDIR/got
47no_diff $TMPDIR/got $TMPDIR/expected
048
=== added file 't/pt-diskstats/group_by_disk.sh'
--- t/pt-diskstats/group_by_disk.sh 1970-01-01 00:00:00 +0000
+++ t/pt-diskstats/group_by_disk.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,74 @@
1#!/bin/bash
2
3# This test file must be ran by util/test-bash-functions.
4
5TESTS=5
6
7TEST_NAME="diskstats-001.txt"
8cat <<EOF > $TMPDIR/expected
9 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
10 {4} ram0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
11 {4} cciss/c0d0 0.0 0.0 0.0 0% 0.0 0.0 17.7 56.2 0.5 86% 0.0 0.6 0% 0
12 {4} cciss/c0d0p1 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
13 {4} cciss/c0d0p2 0.0 0.0 0.0 0% 0.0 0.0 17.7 56.2 0.5 86% 0.0 0.6 0% 0
14 {4} cciss/c0d1 458.1 43.0 9.6 0% 11.5 25.1 985.0 48.4 23.3 0% 0.1 0.1 102% 0
15 {4} cciss/c1d0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
16 {4} dm-0 0.0 0.0 0.0 0% 0.0 0.0 99.3 8.0 0.4 0% 0.1 0.7 0% 0
17 {4} md0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0.0 0% 0.0 0.0 0% 0
18EOF
19group_by_disk samples/diskstats-001.txt > $TMPDIR/got
20no_diff $TMPDIR/got $TMPDIR/expected
21
22
23TEST_NAME="diskstats-005.txt"
24cat <<EOF > $TMPDIR/expected
25 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
26 {5} sda3 1394.1 32.0 21.8 1% 0.5 0.4 98.8 62.8 3.0 48% 0.0 0.3 41% 0
27 {5} sda4 1394.1 32.0 21.8 1% 0.5 0.4 98.8 62.8 3.0 48% 0.0 0.3 41% 0
28EOF
29group_by_disk samples/diskstats-005.txt > $TMPDIR/got
30no_diff $TMPDIR/got $TMPDIR/expected
31
32
33TEST_NAME="diskstats-005.txt with TS"
34cat <<EOF > $TMPDIR/expected
35 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
36 {5} sda3 1394.1 32.0 21.8 1% 0.5 0.4 98.8 62.8 3.0 48% 0.0 0.3 41% 0
37 {5} sda4 1394.1 32.0 21.8 1% 0.5 0.4 98.8 62.8 3.0 48% 0.0 0.3 41% 0
38EOF
39
40cat > $TMPDIR/in <<EOF
41TS 1298130002.073935000
42EOF
43cat samples/diskstats-005.txt >> $TMPDIR/in
44group_by_disk $TMPDIR/in > $TMPDIR/got
45no_diff $TMPDIR/got $TMPDIR/expected
46
47
48TEST_NAME="no output"
49cat <<EOF > $TMPDIR/expected
50EOF
51
52cat <<EOF > $TMPDIR/in
53TS 1297205887.156653000
54 1 0 ram0 0 0 0 0 0 0 0 0 0 0 0
55TS 1297205888.161613000
56EOF
57group_by_disk $TMPDIR/in > $TMPDIR/got
58no_diff $TMPDIR/got $TMPDIR/expected
59
60
61TEST_NAME="timestamps"
62cat <<EOF > $TMPDIR/expected
63 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
64 {1} ram0 1.0 1.0 0.0 50% 0.0 1.0 1.0 1.0 0.0 50% 0.0 1.0 0% 0
65EOF
66
67cat <<EOF > $TMPDIR/in
68 1 0 ram0 0 0 0 0 0 0 0 0 0 0 0
69TS 1297205887.156653000
70 1 0 ram0 1 1 1 1 1 1 1 1 1 1 1
71TS 1297205888.161613000
72EOF
73group_by_disk $TMPDIR/in > $TMPDIR/got
74no_diff $TMPDIR/got $TMPDIR/expected
075
=== added file 't/pt-diskstats/group_by_sample.sh'
--- t/pt-diskstats/group_by_sample.sh 1970-01-01 00:00:00 +0000
+++ t/pt-diskstats/group_by_sample.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,84 @@
1#!/usr/bin/env bash
2
3# This test file must be ran by util/test-bash-functions.
4
5TESTS=4
6
7TEST_NAME="diskstats-001.txt"
8cat <<EOF > $TMPDIR/expected
9 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
10 2.0 {8} 466.5 44.6 10.2 0% 1.4 23.9 1184.0 42.6 24.6 18% 0.0 0.2 12% 18
11 4.0 {8} 373.0 47.2 8.6 0% 1.3 27.4 592.0 45.6 13.2 16% 0.0 0.1 11% 17
12 5.0 {8} 848.0 42.6 17.7 0% 2.7 25.5 1987.0 49.8 48.3 3% 0.0 0.1 22% 9
13 7.0 {8} 340.0 36.6 6.1 0% 1.0 23.8 1149.5 43.4 24.3 23% 0.0 0.2 11% 5
14EOF
15group_by_sample samples/diskstats-001.txt > $TMPDIR/got
16no_diff $TMPDIR/got $TMPDIR/expected
17
18
19TEST_NAME="input 1"
20cat <<EOF > $TMPDIR/expected
21 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
22 1.0 sda3 1406.0 32.0 21.9 1% 0.6 0.4 46.3 61.1 1.4 67% 0.0 0.3 41% 0
23 2.0 sda3 1580.1 31.9 24.6 1% 0.6 0.4 163.7 62.2 5.0 36% 0.1 0.3 46% 1
24 3.0 sda3 1296.7 32.0 20.2 1% 0.5 0.4 51.3 50.5 1.3 62% 0.0 0.3 42% 1
25 4.1 sda3 1429.7 32.0 22.3 1% 0.5 0.3 73.9 61.0 2.2 57% 0.0 0.3 40% 0
26 5.1 sda3 1258.1 32.0 19.6 1% 0.4 0.3 158.7 68.8 5.3 36% 0.1 0.4 37% 0
27EOF
28
29cat > $TMPDIR/in <<EOF
30 8 3 sda3 4257315954 34043324 136169413346 1922644483 492348396 547079617 32764474048 248191881 0 1348454960 2169768832
31TS 1298130003.073935000
32 8 3 sda3 4257317380 34043342 136169458914 1922645044 492348443 547079711 32764476920 248191896 0 1348455373 2169769408
33TS 1298130004.088149000
34 8 3 sda3 4257318982 34043364 136169510082 1922645662 492348609 547079803 32764487248 248191947 1 1348455841 2169770075
35TS 1298130005.102035000
36 8 3 sda3 4257320297 34043384 136169552098 1922646173 492348661 547079889 32764489872 248191964 1 1348456262 2169770603
37TS 1298130006.116158000
38 8 3 sda3 4257321748 34043394 136169598530 1922646672 492348736 547079990 32764494448 248191983 0 1348456671 2169771121
39TS 1298130007.131062000
40 8 3 sda3 4257323024 34043406 136169639330 1922647105 492348897 547080080 32764505520 248192043 0 1348457045 2169771613
41TS 1298130008.145277000
42EOF
43group_by_sample $TMPDIR/in > $TMPDIR/got
44no_diff $TMPDIR/got $TMPDIR/expected
45
46
47# The below is incremental samples of the data and timestamps:
48# TS_diff reads reads_mrg read_sectors ms_reading writes write_mrg wrt_sectors ms_wrting i ms_ding_io ms_weightd
49# 1.14214000 1426 18 45568 561 47 94 2872 15 0 413 576
50# 1.13886000 1602 22 51168 618 166 92 10328 51 1 468 667
51# 1.14123000 1315 20 42016 511 52 86 2624 17 1 421 528
52# 1.14904000 1451 10 46432 499 75 101 4576 19 0 409 518
53# 1.14215000 1276 12 40800 433 161 90 11072 60 0 374 492
54
55
56TEST_NAME="diskstats-005.txt"
57cat <<EOF > $TMPDIR/expected
58 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
59 1.0 {2} 2812.0 32.0 43.9 1% 0.6 0.4 92.7 61.1 2.8 67% 0.0 0.3 41% 0
60 2.0 {2} 3160.1 31.9 49.3 1% 0.6 0.4 327.5 62.2 9.9 36% 0.1 0.3 46% 2
61 3.0 {2} 2593.4 32.0 40.5 1% 0.5 0.4 102.6 50.5 2.5 62% 0.0 0.3 42% 2
62 4.1 {2} 2859.4 32.0 44.7 1% 0.5 0.3 147.8 61.0 4.4 57% 0.0 0.3 40% 0
63 5.1 {2} 2516.2 32.0 39.3 1% 0.4 0.3 317.5 68.8 10.7 36% 0.1 0.4 37% 0
64EOF
65group_by_sample samples/diskstats-005.txt > $TMPDIR/got
66no_diff $TMPDIR/got $TMPDIR/expected
67
68
69TEST_NAME="ts line"
70cat <<EOF > $TMPDIR/expected
71 #ts device rd_s rd_avkb rd_mb_s rd_mrg rd_cnc rd_rt wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt busy in_prg
72 1.0 {2} 2812.0 32.0 43.9 1% 0.6 0.4 92.7 61.1 2.8 67% 0.0 0.3 41% 0
73 2.0 {2} 3160.1 31.9 49.3 1% 0.6 0.4 327.5 62.2 9.9 36% 0.1 0.3 46% 2
74 3.0 {2} 2593.4 32.0 40.5 1% 0.5 0.4 102.6 50.5 2.5 62% 0.0 0.3 42% 2
75 4.1 {2} 2859.4 32.0 44.7 1% 0.5 0.3 147.8 61.0 4.4 57% 0.0 0.3 40% 0
76 5.1 {2} 2516.2 32.0 39.3 1% 0.4 0.3 317.5 68.8 10.7 36% 0.1 0.4 37% 0
77EOF
78
79cat > $TMPDIR/in <<EOF
80TS 1298130002.073935000
81EOF
82cat samples/diskstats-005.txt >> $TMPDIR/in
83group_by_sample $TMPDIR/in > $TMPDIR/got
84no_diff $TMPDIR/got $TMPDIR/expected
085
=== modified file 't/pt-diskstats/pt-diskstats.t'
--- t/pt-diskstats/pt-diskstats.t 2011-07-12 22:56:55 +0000
+++ t/pt-diskstats/pt-diskstats.t 2011-08-19 17:39:24 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/evn perl1#!/usr/bin/env perl
22
3BEGIN {3BEGIN {
4 die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"4 die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
@@ -12,6 +12,8 @@
1212
13use PerconaTest;13use PerconaTest;
1414
15system("$trunk/util/test-bash-tool pt-diskstats @ARGV");15my ($tool) = $PROGRAM_NAME =~ m/([\w-]+)\.t$/;
16push @ARGV, "$trunk/t/$tool/*.sh" unless @ARGV;
17system("$trunk/util/test-bash-functions $trunk/bin/$tool @ARGV");
1618
17exit;19exit;
1820
=== removed file 't/pt-mysql-summary/find-my-cnf-file-01'
--- t/pt-mysql-summary/find-my-cnf-file-01 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/find-my-cnf-file-01 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
1#!/bin/bash
2#find_my_cnf_file 12346
3
4echo /tmp/12346/my.sandbox.cnf > $1
5
6cp samples/ps-mysqld-001.txt /tmp/percona-toolkit
70
=== removed file 't/pt-mysql-summary/find-my-cnf-file-02'
--- t/pt-mysql-summary/find-my-cnf-file-02 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/find-my-cnf-file-02 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
1#!/bin/bash
2#find_my_cnf_file 12345
3
4echo /var/lib/mysql/my.cnf > $1
5
6cp samples/ps-mysqld-004.txt /tmp/percona-toolkit
70
=== removed file 't/pt-mysql-summary/find-my-cnf-file-03'
--- t/pt-mysql-summary/find-my-cnf-file-03 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/find-my-cnf-file-03 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
1#!/bin/bash
2#find_my_cnf_file
3
4echo /var/lib/mysql/my.cnf > $1
5
6cp samples/ps-mysqld-004.txt /tmp/percona-toolkit
70
=== removed file 't/pt-mysql-summary/find-my-cnf-file-04'
--- t/pt-mysql-summary/find-my-cnf-file-04 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/find-my-cnf-file-04 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
1#!/bin/bash
2#find_my_cnf_file
3
4echo /tmp/12345/my.sandbox.cnf > $1
5
6cp samples/ps-mysqld-001.txt /tmp/percona-toolkit
70
=== added file 't/pt-mysql-summary/find_my_cnf_file.sh'
--- t/pt-mysql-summary/find_my_cnf_file.sh 1970-01-01 00:00:00 +0000
+++ t/pt-mysql-summary/find_my_cnf_file.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,19 @@
1#!/usr/bin/env bash
2
3TESTS=4
4
5TEST_NAME="ps-mysqld-001.txt"
6res=$(find_my_cnf_file samples/ps-mysqld-001.txt)
7is "$res" "/tmp/12345/my.sandbox.cnf"
8
9TEST_NAME="ps-mysqld-001.txt with port"
10res=$(find_my_cnf_file samples/ps-mysqld-001.txt 12346)
11is "$res" "/tmp/12346/my.sandbox.cnf"
12
13TEST_NAME="ps-mysqld-004.txt"
14res=$(find_my_cnf_file samples/ps-mysqld-004.txt)
15is "$res" "/var/lib/mysql/my.cnf"
16
17TEST_NAME="ps-mysqld-004.txt with port"
18res=$(find_my_cnf_file samples/ps-mysqld-004.txt 12345)
19is "$res" "/var/lib/mysql/my.cnf"
020
=== removed file 't/pt-mysql-summary/format-innodb-status-01'
--- t/pt-mysql-summary/format-innodb-status-01 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/format-innodb-status-01 1970-01-01 00:00:00 +0000
@@ -1,52 +0,0 @@
1#!/bin/bash
2#format_innodb_status /tmp/percona-toolkit-innodb-status
3
4cat <<EOF > $1
5 Checkpoint Age | 619k
6 InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
7 Oldest Transaction | 3 Seconds
8 History List Len | 255
9 Read Views | 23
10 Undo Log Entries | 0 transactions, 0 total undo, 0 max undo
11 Pending I/O Reads | 14 buf pool reads, 6 normal AIO, 0 ibuf AIO, 23 preads
12 Pending I/O Writes | 63 buf pool (63 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (1 log, 0 chkp); 0 pwrites
13 Pending I/O Flushes | 0 buf pool, 1 log
14 Transaction States | 1xACTIVE
15Semaphore Waits
16 69 btr/btr0cur.c line 457
17 47 btr/btr0cur.c line 523
18 17 trx/trx0trx.c line 1621
19 12 row/row0sel.c line 3549
20 4 lock/lock0lock.c line 4944
21 3 lock/lock0lock.c line 5316
22 2 lock/lock0lock.c line 3224
23 2 btr/btr0sea.c line 1032
24 1 trx/trx0trx.c line 738
25 1 row/row0sel.c line 4574
26 1 lock/lock0lock.c line 5163
27 1 lock/lock0lock.c line 3249
28 1 ./include/btr0btr.ic line 53
29 1 fsp/fsp0fsp.c line 3395
30 1 btr/btr0cur.c line 672
31 1 btr/btr0cur.c line 450
32Semaphore Holders
33 66 thread id 139960165583184
34 45 thread id 139960567171408
35 4 thread id 139960404199760
36 1 thread id 139961215367504
37 1 thread id 139960969292112
38 1 thread id 139960676096336
39Mutexes/Locks Waited For
40 65 lock on RW-latch at 0x905d33d0 '&new_index->lock'
41 45 lock on RW-latch at 0x7f4bedbf8810 '&block->lock'
42 30 Mutex at 0xf89ab0 '&kernel_mutex'
43 15 lock on RW-latch at 0x90075530 '&btr_search_latch'
44 4 lock on RW-latch at 0x90a42ca0 '&new_index->lock'
45 1 lock on RW-latch at 0x90fe1c80 '&new_index->lock'
46 1 lock on RW-latch at 0x90078f10 '&space->latch'
47 1 lock on RW-latch at 0x7f4c0d3abba8 '&block->lock'
48 1 lock on RW-latch at 0x7f4bfc558040 '&block->lock'
49 1 lock on RW-latch at 0x7f4bd0a8c8d0 '&block->lock'
50EOF
51
52cp samples/innodb-status.001.txt /tmp/percona-toolkit-innodb-status
530
=== removed file 't/pt-mysql-summary/format-innodb-status-02'
--- t/pt-mysql-summary/format-innodb-status-02 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/format-innodb-status-02 1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
1#!/bin/bash
2#format_innodb_status /tmp/percona-toolkit-innodb-status
3
4cat <<'EOF' > $1
5 Checkpoint Age | 348M
6 InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
7 Oldest Transaction | 4 Seconds
8 History List Len | 426
9 Read Views | 583
10 Undo Log Entries | 71 transactions, 247 total undo, 46 max undo
11 Pending I/O Reads | 0 buf pool reads, 0 normal AIO, 0 ibuf AIO, 0 preads
12 Pending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (0 log, 0 chkp); 0 pwrites
13 Pending I/O Flushes | 0 buf pool, 0 log
14 Transaction States | 1xACTIVE, 70xACTIVE (PREPARED)
15Tables Locked
16 62 `citydb`.`player_buildings`
17 46 `citydb`.`players`
18 22 `citydb`.`city_grid`
19 17 `citydb`.`player_stats`
20 6 `citydb`.`player_contracts`
21 1 `citydb`.`player_achievements`
22Semaphore Waits
23 23 trx/trx0undo.c line 1796
24 10 trx/trx0trx.c line 1888
25 8 trx/trx0trx.c line 1033
26 7 trx/trx0trx.c line 738
27 1 lock/lock0lock.c line 3770
28 1 ./include/log0log.ic line 322
29Mutexes/Locks Waited For
30 33 Mutex at 0x2abf68b76a18 '&rseg->mutex'
31 16 Mutex at 0x48ace40 '&kernel_mutex'
32 1 Mutex at 0x2abf68b6c0d0 '&log_sys->mutex'
33EOF
34
35cp samples/innodb-status.002.txt /tmp/percona-toolkit-innodb-status
360
=== removed file 't/pt-mysql-summary/format-innodb-status-03'
--- t/pt-mysql-summary/format-innodb-status-03 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/format-innodb-status-03 1970-01-01 00:00:00 +0000
@@ -1,19 +0,0 @@
1#!/bin/bash
2#format_innodb_status /tmp/percona-toolkit-innodb-status
3
4cat <<'EOF' > $1
5 Checkpoint Age | 0k
6 InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
7 Oldest Transaction | 35 Seconds
8 History List Len | 11
9 Read Views | 1
10 Undo Log Entries | 0 transactions, 0 total undo, 0 max undo
11 Pending I/O Reads | 0 buf pool reads, 0 normal AIO, 0 ibuf AIO, 0 preads
12 Pending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (0 log, 0 chkp); 0 pwrites
13 Pending I/O Flushes | 0 buf pool, 0 log
14 Transaction States | 1xACTIVE, 1xnot started
15Tables Locked
16 1 `test`.`t`
17EOF
18
19cp samples/innodb-status.003.txt /tmp/percona-toolkit-innodb-status
200
=== removed file 't/pt-mysql-summary/format-innodb-status-04'
--- t/pt-mysql-summary/format-innodb-status-04 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/format-innodb-status-04 1970-01-01 00:00:00 +0000
@@ -1,29 +0,0 @@
1#!/bin/bash
2#format_innodb_status /tmp/percona-toolkit-innodb-status
3
4cat <<'EOF' > $1
5 Checkpoint Age | 93M
6 InnoDB Queue | 9 queries inside InnoDB, 0 queries in queue
7 Oldest Transaction | 263 Seconds
8 History List Len | 1282
9 Read Views | 10
10 Undo Log Entries | 3 transactions, 276797 total undo, 153341 max undo
11 Pending I/O Reads | 50 buf pool reads, 48 normal AIO, 0 ibuf AIO, 2 preads
12 Pending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (0 log, 0 chkp); 0 pwrites
13 Pending I/O Flushes | 0 buf pool, 0 log
14 Transaction States | 9xACTIVE, 57xnot started
15Semaphore Waits
16 3 row/row0sel.c line 3495
17 2 btr/btr0sea.c line 1024
18 1 btr/btr0sea.c line 1170
19 1 btr/btr0cur.c line 443
20 1 btr/btr0cur.c line 1501
21Semaphore Holders
22 7 thread id 1220999488
23 1 thread id 1229429056
24Mutexes/Locks Waited For
25 7 lock on RW-latch at 0x2aaab42120b8 created in file btr/btr0sea.c line 139
26 1 lock on RW-latch at 0x2ab2c679a550 created in file buf/buf0buf.c line 550
27EOF
28
29cp samples/innodb-status.004.txt /tmp/percona-toolkit-innodb-status
300
=== added file 't/pt-mysql-summary/format_binlog_filters.sh'
--- t/pt-mysql-summary/format_binlog_filters.sh 1970-01-01 00:00:00 +0000
+++ t/pt-mysql-summary/format_binlog_filters.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,11 @@
1#!/bin/bash
2
3TEST=1
4
5cat <<EOF > $TMPDIR/expected
6 binlog_do_db | foo
7 binlog_ignore_db | mysql,test
8EOF
9
10format_binlog_filters samples/mysql-show-master-status-001.txt > $TMPDIR/got
11no_diff $TMPDIR/got $TMPDIR/expected
012
=== added file 't/pt-mysql-summary/format_innodb_status.sh'
--- t/pt-mysql-summary/format_innodb_status.sh 1970-01-01 00:00:00 +0000
+++ t/pt-mysql-summary/format_innodb_status.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,146 @@
1#!/usr/bin/env bash
2
3TESTS=4
4
5# ############################################################################
6TEST_NAME="innodb-status.001.txt"
7# ############################################################################
8cat <<EOF > $TMPDIR/expected
9 Checkpoint Age | 619k
10 InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
11 Oldest Transaction | 3 Seconds
12 History List Len | 255
13 Read Views | 23
14 Undo Log Entries | 0 transactions, 0 total undo, 0 max undo
15 Pending I/O Reads | 14 buf pool reads, 6 normal AIO, 0 ibuf AIO, 23 preads
16 Pending I/O Writes | 63 buf pool (63 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (1 log, 0 chkp); 0 pwrites
17 Pending I/O Flushes | 0 buf pool, 1 log
18 Transaction States | 1xACTIVE
19Semaphore Waits
20 69 btr/btr0cur.c line 457
21 47 btr/btr0cur.c line 523
22 17 trx/trx0trx.c line 1621
23 12 row/row0sel.c line 3549
24 4 lock/lock0lock.c line 4944
25 3 lock/lock0lock.c line 5316
26 2 lock/lock0lock.c line 3224
27 2 btr/btr0sea.c line 1032
28 1 trx/trx0trx.c line 738
29 1 row/row0sel.c line 4574
30 1 lock/lock0lock.c line 5163
31 1 lock/lock0lock.c line 3249
32 1 ./include/btr0btr.ic line 53
33 1 fsp/fsp0fsp.c line 3395
34 1 btr/btr0cur.c line 672
35 1 btr/btr0cur.c line 450
36Semaphore Holders
37 66 thread id 139960165583184
38 45 thread id 139960567171408
39 4 thread id 139960404199760
40 1 thread id 139961215367504
41 1 thread id 139960969292112
42 1 thread id 139960676096336
43Mutexes/Locks Waited For
44 65 lock on RW-latch at 0x905d33d0 '&new_index->lock'
45 45 lock on RW-latch at 0x7f4bedbf8810 '&block->lock'
46 30 Mutex at 0xf89ab0 '&kernel_mutex'
47 15 lock on RW-latch at 0x90075530 '&btr_search_latch'
48 4 lock on RW-latch at 0x90a42ca0 '&new_index->lock'
49 1 lock on RW-latch at 0x90fe1c80 '&new_index->lock'
50 1 lock on RW-latch at 0x90078f10 '&space->latch'
51 1 lock on RW-latch at 0x7f4c0d3abba8 '&block->lock'
52 1 lock on RW-latch at 0x7f4bfc558040 '&block->lock'
53 1 lock on RW-latch at 0x7f4bd0a8c8d0 '&block->lock'
54EOF
55
56format_innodb_status samples/innodb-status.001.txt > $TMPDIR/got
57no_diff $TMPDIR/got $TMPDIR/expected
58
59# ############################################################################
60TEST_NAME="innodb-status.002.txt"
61# ############################################################################
62cat <<'EOF' > $TMPDIR/expected
63 Checkpoint Age | 348M
64 InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
65 Oldest Transaction | 4 Seconds
66 History List Len | 426
67 Read Views | 583
68 Undo Log Entries | 71 transactions, 247 total undo, 46 max undo
69 Pending I/O Reads | 0 buf pool reads, 0 normal AIO, 0 ibuf AIO, 0 preads
70 Pending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (0 log, 0 chkp); 0 pwrites
71 Pending I/O Flushes | 0 buf pool, 0 log
72 Transaction States | 1xACTIVE, 70xACTIVE (PREPARED)
73Tables Locked
74 62 `citydb`.`player_buildings`
75 46 `citydb`.`players`
76 22 `citydb`.`city_grid`
77 17 `citydb`.`player_stats`
78 6 `citydb`.`player_contracts`
79 1 `citydb`.`player_achievements`
80Semaphore Waits
81 23 trx/trx0undo.c line 1796
82 10 trx/trx0trx.c line 1888
83 8 trx/trx0trx.c line 1033
84 7 trx/trx0trx.c line 738
85 1 lock/lock0lock.c line 3770
86 1 ./include/log0log.ic line 322
87Mutexes/Locks Waited For
88 33 Mutex at 0x2abf68b76a18 '&rseg->mutex'
89 16 Mutex at 0x48ace40 '&kernel_mutex'
90 1 Mutex at 0x2abf68b6c0d0 '&log_sys->mutex'
91EOF
92
93format_innodb_status samples/innodb-status.002.txt > $TMPDIR/got
94no_diff $TMPDIR/got $TMPDIR/expected
95
96# ############################################################################
97TEST_NAME="innodb-status.003.txt"
98# ############################################################################
99cat <<'EOF' > $TMPDIR/expected
100 Checkpoint Age | 0k
101 InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
102 Oldest Transaction | 35 Seconds
103 History List Len | 11
104 Read Views | 1
105 Undo Log Entries | 0 transactions, 0 total undo, 0 max undo
106 Pending I/O Reads | 0 buf pool reads, 0 normal AIO, 0 ibuf AIO, 0 preads
107 Pending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (0 log, 0 chkp); 0 pwrites
108 Pending I/O Flushes | 0 buf pool, 0 log
109 Transaction States | 1xACTIVE, 1xnot started
110Tables Locked
111 1 `test`.`t`
112EOF
113
114format_innodb_status samples/innodb-status.003.txt > $TMPDIR/got
115no_diff $TMPDIR/got $TMPDIR/expected
116
117# ############################################################################
118TEST_NAME="innodb-status.004.txt"
119# ############################################################################
120cat <<'EOF' > $TMPDIR/expected
121 Checkpoint Age | 93M
122 InnoDB Queue | 9 queries inside InnoDB, 0 queries in queue
123 Oldest Transaction | 263 Seconds
124 History List Len | 1282
125 Read Views | 10
126 Undo Log Entries | 3 transactions, 276797 total undo, 153341 max undo
127 Pending I/O Reads | 50 buf pool reads, 48 normal AIO, 0 ibuf AIO, 2 preads
128 Pending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (0 log, 0 chkp); 0 pwrites
129 Pending I/O Flushes | 0 buf pool, 0 log
130 Transaction States | 9xACTIVE, 57xnot started
131Semaphore Waits
132 3 row/row0sel.c line 3495
133 2 btr/btr0sea.c line 1024
134 1 btr/btr0sea.c line 1170
135 1 btr/btr0cur.c line 443
136 1 btr/btr0cur.c line 1501
137Semaphore Holders
138 7 thread id 1220999488
139 1 thread id 1229429056
140Mutexes/Locks Waited For
141 7 lock on RW-latch at 0x2aaab42120b8 created in file btr/btr0sea.c line 139
142 1 lock on RW-latch at 0x2ab2c679a550 created in file buf/buf0buf.c line 550
143EOF
144
145format_innodb_status samples/innodb-status.004.txt > $TMPDIR/got
146no_diff $TMPDIR/got $TMPDIR/expected
0147
=== added file 't/pt-mysql-summary/format_overall_db_stats.sh'
--- t/pt-mysql-summary/format_overall_db_stats.sh 1970-01-01 00:00:00 +0000
+++ t/pt-mysql-summary/format_overall_db_stats.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,60 @@
1#!/bin/bash
2
3TESTS=2
4
5cat <<EOF > $TMPDIR/expected
6
7 Database Tables Views SPs Trigs Funcs FKs Partn
8 mysql 17
9 sakila 17 7 3 6 3 22 1
10
11 Database MyISAM InnoDB
12 mysql 17
13 sakila 2 15
14
15 Database BTREE FULLTEXT
16 mysql 24
17 sakila 63 1
18
19 c t s e t s i t b l b v d y d m
20 h i e n i m n e l o i a a e e e
21 a m t u n a t x o n g r t a c d
22 r e m y l t b g i c e r i i
23 s i l b n h t m u
24 t n i l t a i a m
25 a t n o r m l i
26 m t b e n
27 p t
28 Database === === === === === === === === === === === === === === === ===
29 mysql 38 5 5 69 2 3 16 2 4 1 2
30 sakila 1 15 1 3 19 26 3 4 1 45 4 1 7 2
31
32EOF
33format_overall_db_stats samples/mysql-schema-001.txt > $TMPDIR/got
34no_diff $TMPDIR/got $TMPDIR/expected
35
36
37cat <<EOF > $TMPDIR/expected
38
39 Database Tables Views SPs Trigs Funcs FKs Partn
40 {chosen} 1
41
42 Database InnoDB
43 {chosen} 1
44
45 Database BTREE
46 {chosen} 2
47
48 t v
49 i a
50 n r
51 y c
52 i h
53 n a
54 t r
55 Database === ===
56 {chosen} 1 1
57
58EOF
59format_overall_db_stats samples/mysql-schema-002.txt > $TMPDIR/got
60no_diff $TMPDIR/got $TMPDIR/expected
061
=== removed file 't/pt-mysql-summary/format_status_variables-01'
--- t/pt-mysql-summary/format_status_variables-01 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/format_status_variables-01 1970-01-01 00:00:00 +0000
@@ -1,93 +0,0 @@
1#!/bin/bash
2#format_status_variables
3
4cat <<EOF > $1
5Variable Per day Per second 5 secs
6Bytes_received 8000000 100
7Bytes_sent 35000000 400
8Com_admin_commands 20
9Com_change_db 1000
10Com_delete 8000
11Com_insert 8000
12Com_lock_tables 200
13Com_replace 1250
14Com_select 22500
15Com_set_option 22500
16Com_show_binlogs 10
17Com_show_create_db 400
18Com_show_create_table 7000
19Com_show_databases 125
20Com_show_fields 7000
21Com_show_innodb_status 300
22Com_show_open_tables 10
23Com_show_processlist 300
24Com_show_slave_status 300
25Com_show_status 350
26Com_show_storage_engines 10
27Com_show_tables 400
28Com_show_triggers 7000
29Com_show_variables 450
30Com_truncate 300
31Com_unlock_tables 250
32Com_update 900
33Connections 2500
34Created_tmp_disk_tables 15000
35Created_tmp_files 60
36Created_tmp_tables 22500
37Flush_commands 10
38Handler_delete 8000
39Handler_read_first 2250
40Handler_read_key 30000
41Handler_read_next 15000
42Handler_read_rnd 9000
43Handler_read_rnd_next 300000 3
44Handler_update 17500
45Handler_write 250000 2
46Innodb_buffer_pool_pages_data 225
47Innodb_buffer_pool_pages_free 5000
48Innodb_buffer_pool_pages_total 6000
49Innodb_buffer_pool_read_ahead_rnd 10
50Innodb_buffer_pool_read_requests 2250
51Innodb_buffer_pool_reads 150
52Innodb_data_fsyncs 35
53Innodb_data_read 30000000 350
54Innodb_data_reads 300
55Innodb_data_writes 35
56Innodb_data_written 17500
57Innodb_log_writes 10
58Innodb_os_log_fsyncs 35
59Innodb_os_log_written 6000
60Innodb_page_size 175000 2
61Innodb_pages_read 225
62Key_blocks_unused 150000 1
63Key_blocks_used 175
64Key_read_requests 100000 1
65Key_reads 600
66Key_write_requests 70000
67Key_writes 17500
68Max_used_connections 45
69Open_files 1500
70Open_tables 700
71Opened_tables 15000
72Qcache_free_blocks 80
73Qcache_free_memory 175000000 2250
74Qcache_hits 8000
75Qcache_inserts 20000
76Qcache_not_cached 10000
77Qcache_queries_in_cache 225
78Qcache_total_blocks 600
79Questions 100000 1
80Select_scan 25000
81Sort_rows 8000
82Sort_scan 300
83Table_locks_immediate 50000 17500
84Table_locks_waited 10 1
85Threads_cached 35
86Threads_connected 10
87Threads_created 45
88Threads_running 10
89Uptime 90000 1 1
90Uptime_since_flush_status 90000 1
91EOF
92
93join samples/mysql-status-00{1,2}.txt > /tmp/percona-toolkit
940
=== added file 't/pt-mysql-summary/format_status_variables.sh'
--- t/pt-mysql-summary/format_status_variables.sh 1970-01-01 00:00:00 +0000
+++ t/pt-mysql-summary/format_status_variables.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,96 @@
1#!/bin/bash
2
3TESTS=1
4
5cat <<EOF > $TMPDIR/expected
6Variable Per day Per second 5 secs
7Bytes_received 8000000 100
8Bytes_sent 35000000 400
9Com_admin_commands 20
10Com_change_db 1000
11Com_delete 8000
12Com_insert 8000
13Com_lock_tables 200
14Com_replace 1250
15Com_select 22500
16Com_set_option 22500
17Com_show_binlogs 10
18Com_show_create_db 400
19Com_show_create_table 7000
20Com_show_databases 125
21Com_show_fields 7000
22Com_show_innodb_status 300
23Com_show_open_tables 10
24Com_show_processlist 300
25Com_show_slave_status 300
26Com_show_status 350
27Com_show_storage_engines 10
28Com_show_tables 400
29Com_show_triggers 7000
30Com_show_variables 450
31Com_truncate 300
32Com_unlock_tables 250
33Com_update 900
34Connections 2500
35Created_tmp_disk_tables 15000
36Created_tmp_files 60
37Created_tmp_tables 22500
38Flush_commands 10
39Handler_delete 8000
40Handler_read_first 2250
41Handler_read_key 30000
42Handler_read_next 15000
43Handler_read_rnd 9000
44Handler_read_rnd_next 300000 3
45Handler_update 17500
46Handler_write 250000 2
47Innodb_buffer_pool_pages_data 225
48Innodb_buffer_pool_pages_free 5000
49Innodb_buffer_pool_pages_total 6000
50Innodb_buffer_pool_read_ahead_rnd 10
51Innodb_buffer_pool_read_requests 2250
52Innodb_buffer_pool_reads 150
53Innodb_data_fsyncs 35
54Innodb_data_read 30000000 350
55Innodb_data_reads 300
56Innodb_data_writes 35
57Innodb_data_written 17500
58Innodb_log_writes 10
59Innodb_os_log_fsyncs 35
60Innodb_os_log_written 6000
61Innodb_page_size 175000 2
62Innodb_pages_read 225
63Key_blocks_unused 150000 1
64Key_blocks_used 175
65Key_read_requests 100000 1
66Key_reads 600
67Key_write_requests 70000
68Key_writes 17500
69Max_used_connections 45
70Open_files 1500
71Open_tables 700
72Opened_tables 15000
73Qcache_free_blocks 80
74Qcache_free_memory 175000000 2250
75Qcache_hits 8000
76Qcache_inserts 20000
77Qcache_not_cached 10000
78Qcache_queries_in_cache 225
79Qcache_total_blocks 600
80Questions 100000 1
81Select_scan 25000
82Sort_rows 8000
83Sort_scan 300
84Table_locks_immediate 50000 17500
85Table_locks_waited 10 1
86Threads_cached 35
87Threads_connected 10
88Threads_created 45
89Threads_running 10
90Uptime 90000 1 1
91Uptime_since_flush_status 90000 1
92EOF
93
94join samples/mysql-status-00{1,2}.txt > $TMPDIR/in
95format_status_variables $TMPDIR/in > $TMPDIR/got
96no_diff $TMPDIR/got $TMPDIR/expected
097
=== removed file 't/pt-mysql-summary/fuzz-01'
--- t/pt-mysql-summary/fuzz-01 2011-07-01 16:29:50 +0000
+++ t/pt-mysql-summary/fuzz-01 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
1#!/bin/bash
2#fuzz 49
3
4cat <<EOF > $1
550
6EOF
70
=== added file 't/pt-mysql-summary/fuzz.sh'
--- t/pt-mysql-summary/fuzz.sh 1970-01-01 00:00:00 +0000
+++ t/pt-mysql-summary/fuzz.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,6 @@
1#!/bin/bash
2
3TESTS=1
4
5TEST_NAME="fuzz 49"
6is $(fuzz 49) "50"
07
=== removed file 't/pt-mysql-summary/get-mysql-tz'
--- t/pt-mysql-summary/get-mysql-tz 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/get-mysql-tz 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
1#!/bin/bash
2#get_mysql_timezone
3
4echo EDT > $1
5
6cp samples/mysql-variables-001.txt /tmp/percona-toolkit-mysql-variables
70
=== removed file 't/pt-mysql-summary/get-mysql-uptime'
--- t/pt-mysql-summary/get-mysql-uptime 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/get-mysql-uptime 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
1#!/bin/bash
2#get_mysql_uptime
3
4cat <<EOF > $1
52010-05-27 11:38 (up 0+02:08:52)
6EOF
7
8cp samples/mysql-status-001.txt /tmp/percona-toolkit-mysql-status
9echo "2010-05-27 11:38" > /tmp/percona-toolkit
100
=== removed file 't/pt-mysql-summary/get-mysql-version'
--- t/pt-mysql-summary/get-mysql-version 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/get-mysql-version 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
1#!/bin/bash
2#get_mysql_version
3
4cat <<EOF > $1
5 Version | 5.0.51a-24+lenny2 (Debian)
6 Built On | debian-linux-gnu i486
7EOF
8
9cp samples/mysql-variables-001.txt /tmp/percona-toolkit-mysql-variables
100
=== added file 't/pt-mysql-summary/get_mysql_info.sh'
--- t/pt-mysql-summary/get_mysql_info.sh 1970-01-01 00:00:00 +0000
+++ t/pt-mysql-summary/get_mysql_info.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,25 @@
1#!/bin/bash
2
3TESTS=3
4
5TEST_NAME="get_mysql_timezone"
6cp samples/mysql-variables-001.txt /tmp/percona-toolkit-mysql-variables
7is $(get_mysql_timezone) "EDT"
8
9TEST_NAME="get_mysql_uptime"
10cat <<EOF > $TMPDIR/expected
112010-05-27 11:38 (up 0+02:08:52)
12EOF
13cp samples/mysql-status-001.txt /tmp/percona-toolkit-mysql-status
14echo "2010-05-27 11:38" > $TMPDIR/in
15get_mysql_uptime $TMPDIR/in > $TMPDIR/got
16no_diff $TMPDIR/got $TMPDIR/expected
17
18TEST_NAME="get_mysql_version"
19cat <<EOF > $TMPDIR/expected
20 Version | 5.0.51a-24+lenny2 (Debian)
21 Built On | debian-linux-gnu i486
22EOF
23cp samples/mysql-variables-001.txt /tmp/percona-toolkit-mysql-variables
24get_mysql_version > $TMPDIR/got
25no_diff $TMPDIR/got $TMPDIR/expected
026
=== removed file 't/pt-mysql-summary/overall_db_stats-01'
--- t/pt-mysql-summary/overall_db_stats-01 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/overall_db_stats-01 1970-01-01 00:00:00 +0000
@@ -1,33 +0,0 @@
1#!/bin/bash
2#format_overall_db_stats
3
4cat <<EOF > $1
5
6 Database Tables Views SPs Trigs Funcs FKs Partn
7 mysql 17
8 sakila 17 7 3 6 3 22 1
9
10 Database MyISAM InnoDB
11 mysql 17
12 sakila 2 15
13
14 Database BTREE FULLTEXT
15 mysql 24
16 sakila 63 1
17
18 c t s e t s i t b l b v d y d m
19 h i e n i m n e l o i a a e e e
20 a m t u n a t x o n g r t a c d
21 r e m y l t b g i c e r i i
22 s i l b n h t m u
23 t n i l t a i a m
24 a t n o r m l i
25 m t b e n
26 p t
27 Database === === === === === === === === === === === === === === === ===
28 mysql 38 5 5 69 2 3 16 2 4 1 2
29 sakila 1 15 1 3 19 26 3 4 1 45 4 1 7 2
30
31EOF
32
33cp samples/mysql-schema-001.txt /tmp/percona-toolkit-mysqldump
340
=== removed file 't/pt-mysql-summary/overall_db_stats-02'
--- t/pt-mysql-summary/overall_db_stats-02 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/overall_db_stats-02 1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
1#!/bin/bash
2#format_overall_db_stats
3
4cat <<EOF > $1
5
6 Database Tables Views SPs Trigs Funcs FKs Partn
7 {chosen} 1
8
9 Database InnoDB
10 {chosen} 1
11
12 Database BTREE
13 {chosen} 2
14
15 t v
16 i a
17 n r
18 y c
19 i h
20 n a
21 t r
22 Database === ===
23 {chosen} 1 1
24
25EOF
26
27cp samples/mysql-schema-002.txt /tmp/percona-toolkit-mysqldump
280
=== removed file 't/pt-mysql-summary/parse-master-status-01'
--- t/pt-mysql-summary/parse-master-status-01 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/parse-master-status-01 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
1#!/bin/bash
2#format_binlog_filters
3
4cat <<EOF > $1
5 binlog_do_db | foo
6 binlog_ignore_db | mysql,test
7EOF
8
9cp samples/mysql-show-master-status-001.txt /tmp/percona-toolkit
100
=== removed file 't/pt-mysql-summary/parse-mysqld-instances-01'
--- t/pt-mysql-summary/parse-mysqld-instances-01 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/parse-mysqld-instances-01 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
1#!/bin/bash
2#parse_mysqld_instances
3
4cat <<EOF > $1
5 Port Data Directory Socket
6 ===== ========================== ======
7 3306 /var/lib/mysql /var/run/mysqld/mysqld.sock
8 12345 /tmp/12345/data /tmp/12345/mysql_sandbox12345.sock
9 12346 /tmp/12346/data /tmp/12346/mysql_sandbox12346.sock
10EOF
11
12cp samples/ps-mysqld-001.txt /tmp/percona-toolkit
130
=== removed file 't/pt-mysql-summary/parse-mysqld-instances-02'
--- t/pt-mysql-summary/parse-mysqld-instances-02 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/parse-mysqld-instances-02 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
1#!/bin/bash
2#parse_mysqld_instances
3
4cat <<EOF > $1
5 Port Data Directory Socket
6 ===== ========================== ======
7 /var/lib/mysql /var/lib/mysql/mysql.sock
8EOF
9
10cp samples/ps-mysqld-002.txt /tmp/percona-toolkit
110
=== removed file 't/pt-mysql-summary/parse-mysqld-instances-03'
--- t/pt-mysql-summary/parse-mysqld-instances-03 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/parse-mysqld-instances-03 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
1#!/bin/bash
2#parse_mysqld_instances
3
4cat <<EOF > $1
5 Port Data Directory Socket
6 ===== ========================== ======
7 3306 /mnt/data-store/mysql/data /tmp/mysql.sock
8EOF
9
10cp samples/ps-mysqld-003.txt /tmp/percona-toolkit
110
=== removed file 't/pt-mysql-summary/parse-mysqld-instances-04'
--- t/pt-mysql-summary/parse-mysqld-instances-04 2011-07-01 16:29:50 +0000
+++ t/pt-mysql-summary/parse-mysqld-instances-04 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
1#!/bin/bash
2#parse_mysqld_instances
3
4cat <<EOF > $1
5 Port Data Directory Socket
6 ===== ========================== ======
7 /var/db/mysql
8EOF
9
10cat <<EOF > $2
11mysql 767 0.0 0.9 3492 1100 v0 I 3:01PM 0:00.07 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/freebsd.hsd1.va.comcast.net..pid
12mysql 818 0.0 17.4 45292 20584 v0 I 3:01PM 0:02.28 /usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysql/my.cnf --basedir=/usr/local --datadir=/var/db/mysql --user=mysql --log-error=/var/db/mysql/freebsd.hsd1.va.comcast.net..err --pid-file=/var/db/mysql/freebsd.hsd1.va.comcast.net..pid
13EOF
140
=== removed file 't/pt-mysql-summary/parse-processlist-01'
--- t/pt-mysql-summary/parse-processlist-01 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/parse-processlist-01 1970-01-01 00:00:00 +0000
@@ -1,61 +0,0 @@
1#!/bin/bash
2#summarize_processlist
3
4cat <<EOF > $1
5
6 Command COUNT(*) Working SUM(Time) MAX(Time)
7 ------------------------------ -------- ------- --------- ---------
8 Binlog Dump 1 1 9000000 9000000
9 Connect 2 2 6000000 5000000
10 Query 2 2 0 0
11 Sleep 150 0 150000 20000
12
13 User COUNT(*) Working SUM(Time) MAX(Time)
14 ------------------------------ -------- ------- --------- ---------
15 acjcxx 4 0 0 0
16 aecac 1 0 0 0
17 babeecc 20 0 0 0
18 centous 2 0 0 0
19 crcpcpc 2 0 0 0
20 crgcp4c 3 0 0 0
21 eanecj 30 1 0 0
22 ebace 10 0 0 0
23 etace 80 0 0 0
24 goate 8 0 0 0
25 qjveec 1 0 0 0
26 repl 1 1 9000000 9000000
27 root 1 1 0 0
28 system user 2 2 6000000 5000000
29
30 Host COUNT(*) Working SUM(Time) MAX(Time)
31 ------------------------------ -------- ------- --------- ---------
32 10.14.82.196 6 0 0 0
33 10.14.82.202 20 0 0 0
34 10.17.85.100 9 0 0 0
35 10.17.85.74 1 1 9000000 9000000
36 10.17.85.86 35 0 0 0
37 10.17.85.88 5 0 0 0
38 10.17.85.90 10 0 0 0
39 10.36.34.66 35 1 0 0
40 2 2 6000000 5000000
41 localhost 1 1 0 0
42 someserver.woozle.com11 1 0 0 0
43 someserver.woozle.com14 1 0 0 0
44 someserver.woozle.com 40 0 0 0
45
46 db COUNT(*) Working SUM(Time) MAX(Time)
47 ------------------------------ -------- ------- --------- ---------
48 aetecjc 175 1 0 0
49 NULL 4 4 15000000 9000000
50
51 State COUNT(*) Working SUM(Time) MAX(Time)
52 ------------------------------ -------- ------- --------- ---------
53 150 0 0 0
54 Has read all relay log; waitin 1 1 300000 300000
55 Has sent all binlog to slave; 1 1 9000000 9000000
56 NULL 2 2 0 0
57 Waiting for master to send eve 1 1 5000000 5000000
58
59EOF
60
61cp samples/processlist-001.txt /tmp/percona-toolkit-mysql-processlist
620
=== added file 't/pt-mysql-summary/parse_mysqld_instances.sh'
--- t/pt-mysql-summary/parse_mysqld_instances.sh 1970-01-01 00:00:00 +0000
+++ t/pt-mysql-summary/parse_mysqld_instances.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,46 @@
1#!/bin/bash
2
3TESTS=4
4
5TEST_NAME="ps-mysqld-001.txt"
6cat <<EOF > $TMPDIR/expected
7 Port Data Directory Socket
8 ===== ========================== ======
9 3306 /var/lib/mysql /var/run/mysqld/mysqld.sock
10 12345 /tmp/12345/data /tmp/12345/mysql_sandbox12345.sock
11 12346 /tmp/12346/data /tmp/12346/mysql_sandbox12346.sock
12EOF
13parse_mysqld_instances samples/ps-mysqld-001.txt > $TMPDIR/got
14no_diff $TMPDIR/got $TMPDIR/expected
15
16TEST_NAME="ps-mysqld-002.txt"
17cat <<EOF > $TMPDIR/expected
18 Port Data Directory Socket
19 ===== ========================== ======
20 /var/lib/mysql /var/lib/mysql/mysql.sock
21EOF
22parse_mysqld_instances samples/ps-mysqld-002.txt > $TMPDIR/got
23no_diff $TMPDIR/got $TMPDIR/expected
24
25TEST_NAME="ps-mysqld-003.txt"
26#parse_mysqld_instances
27cat <<EOF > $TMPDIR/expected
28 Port Data Directory Socket
29 ===== ========================== ======
30 3306 /mnt/data-store/mysql/data /tmp/mysql.sock
31EOF
32parse_mysqld_instances samples/ps-mysqld-003.txt > $TMPDIR/got
33no_diff $TMPDIR/got $TMPDIR/expected
34
35cat <<EOF > $TMPDIR/expected
36 Port Data Directory Socket
37 ===== ========================== ======
38 /var/db/mysql
39EOF
40
41cat <<EOF > $TMPDIR/in
42mysql 767 0.0 0.9 3492 1100 v0 I 3:01PM 0:00.07 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/freebsd.hsd1.va.comcast.net..pid
43mysql 818 0.0 17.4 45292 20584 v0 I 3:01PM 0:02.28 /usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysql/my.cnf --basedir=/usr/local --datadir=/var/db/mysql --user=mysql --log-error=/var/db/mysql/freebsd.hsd1.va.comcast.net..err --pid-file=/var/db/mysql/freebsd.hsd1.va.comcast.net..pid
44EOF
45parse_mysqld_instances $TMPDIR/in > $TMPDIR/got
46no_diff $TMPDIR/got $TMPDIR/expected
047
=== removed file 't/pt-mysql-summary/pretty-print-my-cnf-01'
--- t/pt-mysql-summary/pretty-print-my-cnf-01 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/pretty-print-my-cnf-01 1970-01-01 00:00:00 +0000
@@ -1,37 +0,0 @@
1#!/bin/bash
2#pretty_print_cnf_file
3
4cat <<EOF > $1
5
6[mysqld]
7datadir = /mnt/data/mysql
8socket = /mnt/data/mysql/mysql.sock
9old_passwords = 1
10ssl-key = /opt/mysql.pdns/.cert/server-key.pem
11ssl-cert = /opt/mysql.pdns/.cert/server-cert.pem
12ssl-ca = /opt/mysql.pdns/.cert/ca-cert.pem
13innodb_buffer_pool_size = 16M
14innodb_flush_method = O_DIRECT
15innodb_log_file_size = 64M
16innodb_log_buffer_size = 1M
17innodb_flush_log_at_trx_commit = 2
18innodb_file_per_table = 1
19ssl = 1
20server-id = 1
21log-bin = sl1-bin
22
23[mysql.server]
24user = mysql
25basedir = /mnt/data
26
27[mysqld_safe]
28log-error = /var/log/mysqld.log
29pid-file = /var/run/mysqld/mysqld.pid
30
31[mysql]
32
33[xtrabackup]
34target-dir = /data/backup
35EOF
36
37cp samples/my.cnf-001.txt /tmp/percona-toolkit
380
=== added file 't/pt-mysql-summary/pretty_print_cnf_file.sh'
--- t/pt-mysql-summary/pretty_print_cnf_file.sh 1970-01-01 00:00:00 +0000
+++ t/pt-mysql-summary/pretty_print_cnf_file.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,39 @@
1#!/bin/bash
2
3TESTS=1
4
5cat <<EOF > $TMPDIR/expected
6
7[mysqld]
8datadir = /mnt/data/mysql
9socket = /mnt/data/mysql/mysql.sock
10old_passwords = 1
11ssl-key = /opt/mysql.pdns/.cert/server-key.pem
12ssl-cert = /opt/mysql.pdns/.cert/server-cert.pem
13ssl-ca = /opt/mysql.pdns/.cert/ca-cert.pem
14innodb_buffer_pool_size = 16M
15innodb_flush_method = O_DIRECT
16innodb_log_file_size = 64M
17innodb_log_buffer_size = 1M
18innodb_flush_log_at_trx_commit = 2
19innodb_file_per_table = 1
20ssl = 1
21server-id = 1
22log-bin = sl1-bin
23
24[mysql.server]
25user = mysql
26basedir = /mnt/data
27
28[mysqld_safe]
29log-error = /var/log/mysqld.log
30pid-file = /var/run/mysqld/mysqld.pid
31
32[mysql]
33
34[xtrabackup]
35target-dir = /data/backup
36EOF
37
38pretty_print_cnf_file samples/my.cnf-001.txt > $TMPDIR/got
39no_diff $TMPDIR/got $TMPDIR/expected
040
=== modified file 't/pt-mysql-summary/pt-mysql-summary.t'
--- t/pt-mysql-summary/pt-mysql-summary.t 2011-07-12 22:56:55 +0000
+++ t/pt-mysql-summary/pt-mysql-summary.t 2011-08-19 17:39:24 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/evn perl1#!/usr/bin/env perl
22
3BEGIN {3BEGIN {
4 die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"4 die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
@@ -12,6 +12,8 @@
1212
13use PerconaTest;13use PerconaTest;
1414
15system("$trunk/util/test-bash-tool pt-mysql-summary @ARGV");15my ($tool) = $PROGRAM_NAME =~ m/([\w-]+)\.t$/;
16push @ARGV, "$trunk/t/$tool/*.sh" unless @ARGV;
17system("$trunk/util/test-bash-functions $trunk/bin/$tool @ARGV");
1618
17exit;19exit;
1820
=== removed file 't/pt-mysql-summary/summarize-binlogs-01'
--- t/pt-mysql-summary/summarize-binlogs-01 2011-08-02 21:14:06 +0000
+++ t/pt-mysql-summary/summarize-binlogs-01 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
1#!/bin/bash
2#summarize_binlogs
3
4cat <<EOF > $1
5 Binlogs | 20
6 Zero-Sized | 3
7 Total Size | 6.5G
8EOF
9
10cp samples/mysql-master-logs-001.txt /tmp/percona-toolkit
110
=== added file 't/pt-mysql-summary/summarize_binlogs.sh'
--- t/pt-mysql-summary/summarize_binlogs.sh 1970-01-01 00:00:00 +0000
+++ t/pt-mysql-summary/summarize_binlogs.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,12 @@
1#!/bin/bash
2
3TESTS=1
4
5cat <<EOF > $TMPDIR/expected
6 Binlogs | 20
7 Zero-Sized | 3
8 Total Size | 6.5G
9EOF
10
11summarize_binlogs samples/mysql-master-logs-001.txt > $TMPDIR/got
12no_diff $TMPDIR/expected $TMPDIR/got
013
=== added file 't/pt-mysql-summary/summarize_processlist.sh'
--- t/pt-mysql-summary/summarize_processlist.sh 1970-01-01 00:00:00 +0000
+++ t/pt-mysql-summary/summarize_processlist.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,63 @@
1#!/bin/bash
2
3TESTS=1
4
5cat <<EOF > $TMPDIR/expected
6
7 Command COUNT(*) Working SUM(Time) MAX(Time)
8 ------------------------------ -------- ------- --------- ---------
9 Binlog Dump 1 1 9000000 9000000
10 Connect 2 2 6000000 5000000
11 Query 2 2 0 0
12 Sleep 150 0 150000 20000
13
14 User COUNT(*) Working SUM(Time) MAX(Time)
15 ------------------------------ -------- ------- --------- ---------
16 acjcxx 4 0 0 0
17 aecac 1 0 0 0
18 babeecc 20 0 0 0
19 centous 2 0 0 0
20 crcpcpc 2 0 0 0
21 crgcp4c 3 0 0 0
22 eanecj 30 1 0 0
23 ebace 10 0 0 0
24 etace 80 0 0 0
25 goate 8 0 0 0
26 qjveec 1 0 0 0
27 repl 1 1 9000000 9000000
28 root 1 1 0 0
29 system user 2 2 6000000 5000000
30
31 Host COUNT(*) Working SUM(Time) MAX(Time)
32 ------------------------------ -------- ------- --------- ---------
33 10.14.82.196 6 0 0 0
34 10.14.82.202 20 0 0 0
35 10.17.85.100 9 0 0 0
36 10.17.85.74 1 1 9000000 9000000
37 10.17.85.86 35 0 0 0
38 10.17.85.88 5 0 0 0
39 10.17.85.90 10 0 0 0
40 10.36.34.66 35 1 0 0
41 2 2 6000000 5000000
42 localhost 1 1 0 0
43 someserver.woozle.com11 1 0 0 0
44 someserver.woozle.com14 1 0 0 0
45 someserver.woozle.com 40 0 0 0
46
47 db COUNT(*) Working SUM(Time) MAX(Time)
48 ------------------------------ -------- ------- --------- ---------
49 aetecjc 175 1 0 0
50 NULL 4 4 15000000 9000000
51
52 State COUNT(*) Working SUM(Time) MAX(Time)
53 ------------------------------ -------- ------- --------- ---------
54 150 0 0 0
55 Has read all relay log; waitin 1 1 300000 300000
56 Has sent all binlog to slave; 1 1 9000000 9000000
57 NULL 2 2 0 0
58 Waiting for master to send eve 1 1 5000000 5000000
59
60EOF
61
62summarize_processlist samples/processlist-001.txt > $TMPDIR/got
63no_diff $TMPDIR/got $TMPDIR/expected
064
=== removed file 't/pt-pmp/aggregate-stacktrace-01'
--- t/pt-pmp/aggregate-stacktrace-01 2011-08-02 21:14:06 +0000
+++ t/pt-pmp/aggregate-stacktrace-01 1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
1#!/bin/bash
2#aggregate_stacktrace 0 /tmp/percona-toolkit
3
4cat > $1 <<EOF
5 187 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,open_table,open_tables,open_and_lock_tables,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
6 62 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,close_thread_tables,dispatch_command,handle_one_connection,start_thread,clone
7 39 read,vio_read,my_real_read,my_net_read,handle_one_connection,start_thread,clone
8 18 pthread_cond_wait,safe_cond_wait,os_event_wait_low,os_aio_simulated_handle,fil_aio_wait,io_handler_thread,start_thread,clone
9 15 pthread_cond_wait,safe_cond_wait,end_thread,handle_one_connection,start_thread,clone
10 15 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,open_table,open_tables,mysql_update,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
11 12 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,open_table,open_tables,open_and_lock_tables,mysql_insert,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
12 2 __lll_mutex_lock_wait,_L_mutex_lock_107,pthread_mutex_lock,safe_mutex_lock,Log_event::read_log_event,mysql_binlog_send,dispatch_command,handle_one_connection,start_thread,clone
13 1 select,os_thread_sleep,srv_master_thread,start_thread,clone
14 1 select,os_thread_sleep,srv_lock_timeout_and_monitor_thread,start_thread,clone
15 1 select,os_thread_sleep,srv_error_monitor_thread,start_thread,clone
16 1 select,handle_connections_sockets,main
17 1 _sanity,_myfree,st_join_table::cleanup,JOIN::cleanup,JOIN::join_free,do_select,JOIN::exec,mysql_select,handle_select,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
18 1 pread64,_os_file_pread,_os_file_read,_fil_io,buf_read_page_low,buf_read_page,buf_page_get_gen,btr_cur_search_to_nth_level,btr_estimate_n_rows_in_range,ha_innobase::records_in_range,check_quick_keys,check_quick_select,get_key_scans_params,SQL_SELECT::test_quick_select,mysql_update,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
19 1 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,_sanity,_myrealloc,String::realloc,String::append,Log_event::read_log_event,mysql_binlog_send,dispatch_command,handle_one_connection,start_thread,clone
20 1 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,_sanity,_mymalloc,_myrealloc,mi_alloc_rec_buff,mi_open,ha_myisam::open,handler::ha_open,open_tmp_table,create_tmp_table,select_union::create_result_table,mysql_derived_prepare,mysql_handle_derived,open_and_lock_tables,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
21 1 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,_sanity,_mymalloc,init_dynamic_array,QUICK_RANGE_SELECT,get_quick_select,TRP_RANGE::make_quick,SQL_SELECT::test_quick_select,make_join_statistics,JOIN::optimize,mysql_select,mysql_derived_filling,mysql_handle_derived,open_and_lock_tables,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
22 1 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,_mymalloc,alloc_root,MYSQLparse,mysql_make_view,open_unireg_entry,open_table,open_tables,open_and_lock_tables,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
23 1 __lll_mutex_lock_wait,_L_mutex_lock_107,pthread_mutex_lock,safe_mutex_lock,mi_open,ha_myisam::open,handler::ha_open,open_tmp_table,create_tmp_table,select_union::create_result_table,mysql_derived_prepare,mysql_handle_derived,open_and_lock_tables,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
24 1 do_sigwait,sigwait,signal_hand,start_thread,clone
25EOF
26
27cp samples/stacktrace-001.txt $2
280
=== removed file 't/pt-pmp/aggregate-stacktrace-02'
--- t/pt-pmp/aggregate-stacktrace-02 2011-08-02 21:14:06 +0000
+++ t/pt-pmp/aggregate-stacktrace-02 1970-01-01 00:00:00 +0000
@@ -1,19 +0,0 @@
1#!/bin/bash
2#aggregate_stacktrace 0 /tmp/percona-toolkit
3
4cat > $1 <<EOF
5 2387 pthread_cond_wait,open_table,open_tables,open_and_lock_tables_derived,execute_sqlcom_select,mysql_execute_command,mysql_parse,dispatch_command,do_command,handle_one_connection,start_thread,clone
6 5 pthread_cond_wait,open_table,open_tables,open_and_lock_tables_derived,mysql_insert,mysql_execute_command,mysql_parse,dispatch_command,do_command,handle_one_connection,start_thread,clone
7 4 pthread_cond_wait,os_event_wait_low,os_aio_simulated_handle,fil_aio_wait,io_handler_thread,start_thread,clone
8 4 pthread_cond_wait,open_table,open_tables,open_and_lock_tables_derived,mysql_delete,mysql_execute_command,mysql_parse,dispatch_command,do_command,handle_one_connection,start_thread,clone
9 1 select,os_thread_sleep,srv_master_thread,start_thread,clone
10 1 select,os_thread_sleep,srv_lock_timeout_and_monitor_thread,start_thread,clone
11 1 select,os_thread_sleep,srv_error_monitor_thread,start_thread,clone
12 1 select,handle_connections_sockets,main,select
13 1 read,my_real_read,my_net_read,do_command,handle_one_connection,start_thread,clone
14 1 pthread_cond_wait,cache_thread,one_thread_per_connection_end,handle_one_connection,start_thread,clone
15 1 free,ut_free,page_cur_insert_rec_low,btr_cur_optimistic_insert,row_ins_index_entry_low,row_ins_index_entry,row_ins,row_ins_step,row_insert_for_mysql,ha_innobase::write_row,handler::ha_write_row,ha_partition::copy_partitions,ha_partition::change_partitions,handler::ha_change_partitions,mysql_change_partitions,fast_alter_partition_table,mysql_alter_table,mysql_execute_command,mysql_parse,dispatch_command,do_command,handle_one_connection,start_thread,clone
16 1 do_sigwait,sigwait,signal_hand,start_thread,clone
17EOF
18
19cp samples/stacktrace-002.txt $2
200
=== removed file 't/pt-pmp/aggregate-stacktrace-03'
--- t/pt-pmp/aggregate-stacktrace-03 2011-08-02 21:14:06 +0000
+++ t/pt-pmp/aggregate-stacktrace-03 1970-01-01 00:00:00 +0000
@@ -1,18 +0,0 @@
1#!/bin/bash
2#aggregate_stacktrace 0 /tmp/percona-toolkit
3
4cat > $1 <<EOF
5 35 pthread_cond_wait,end_thread,handle_one_connection,start_thread,clone
6 20 read,read,vio_read,my_real_read,my_net_read,handle_one_connection,start_thread,clone
7 18 pthread_cond_wait,os_event_wait_low,os_aio_simulated_handle,fil_aio_wait,io_handler_thread,start_thread,clone
8 3 pthread_cond_wait,MYSQL_LOG::wait_for_update,mysql_binlog_send,dispatch_command,handle_one_connection,start_thread,clone
9 1 select,os_thread_sleep,srv_master_thread,start_thread,clone
10 1 select,os_thread_sleep,srv_lock_timeout_and_monitor_thread,start_thread,clone
11 1 select,os_thread_sleep,srv_error_monitor_thread,start_thread,clone
12 1 select,handle_connections_sockets,main
13 1 do_sigwait,sigwait,signal_hand,start_thread,clone
14 1 btr_search_guess_on_hash,btr_cur_search_to_nth_level,btr_pcur_open_with_no_init,row_search_for_mysql,ha_innobase::index_read,join_read_always_key,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,do_select,JOIN::exec,mysql_select,handle_select,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
15 1 btr_cur_search_to_nth_level,btr_estimate_n_rows_in_range,ha_innobase::records_in_range,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_select,get_key_scans_params,SQL_SELECT::test_quick_select,get_quick_record_count,make_join_statistics,JOIN::optimize,mysql_select,handle_select,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
16EOF
17
18cp samples/stacktrace-003.txt $2
190
=== removed file 't/pt-pmp/aggregate-stacktrace-03-b'
--- t/pt-pmp/aggregate-stacktrace-03-b 2011-08-02 21:14:06 +0000
+++ t/pt-pmp/aggregate-stacktrace-03-b 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
1#!/bin/bash
2#aggregate_stacktrace 2 /tmp/percona-toolkit
3
4cat > $1 <<EOF
5 35 pthread_cond_wait,end_thread
6 20 read,read
7 18 pthread_cond_wait,os_event_wait_low
8 3 select,os_thread_sleep
9 3 pthread_cond_wait,MYSQL_LOG::wait_for_update
10 1 select,handle_connections_sockets
11 1 do_sigwait,sigwait
12 1 btr_search_guess_on_hash,btr_cur_search_to_nth_level
13 1 btr_cur_search_to_nth_level,btr_estimate_n_rows_in_range
14EOF
15
16cp samples/stacktrace-003.txt $2
170
=== removed file 't/pt-pmp/aggregate-stacktrace-04'
--- t/pt-pmp/aggregate-stacktrace-04 2011-08-02 21:14:06 +0000
+++ t/pt-pmp/aggregate-stacktrace-04 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
1#!/bin/bash
2#aggregate_stacktrace 0 /tmp/percona-toolkit
3
4cat > $1 <<EOF
5 33 pthread_cond_wait,boost::condition_variable::wait,Queue::pop,Worker::work,boost::_mfi::mf0::operator,boost::_bi::list1::operator,boost::_bi::bind_t::operator,boost::detail::thread_data::run,thread_proxy,start_thread,clone,??
6 1 StringBuilder::length,Parser::add,Parser::try_parse_query,Parser::parse_block,Parser::work,boost::_mfi::mf0::operator,boost::_bi::list1::operator,boost::_bi::bind_t::operator,boost::detail::thread_data::run,thread_proxy,start_thread,clone,??
7 1 pthread_cond_wait,boost::thread::join,LogReader::wait,Replay::wait,main
8 1 pthread_cond_wait,boost::condition_variable::wait,Queue::push,LogReader::work,boost::_mfi::mf0::operator,boost::_bi::list1::operator,boost::_bi::bind_t::operator,boost::detail::thread_data::run,thread_proxy,start_thread,clone,??
9 1 pthread_cond_wait,boost::condition_variable::wait,Queue::pop,Reporter::work,boost::_mfi::mf0::operator,boost::_bi::list1::operator,boost::_bi::bind_t::operator,boost::detail::thread_data::run,thread_proxy,start_thread,clone,??
10EOF
11
12cp samples/stacktrace-004.txt $2
130
=== removed file 't/pt-pmp/aggregate-stacktrace-05'
--- t/pt-pmp/aggregate-stacktrace-05 2011-08-02 21:14:06 +0000
+++ t/pt-pmp/aggregate-stacktrace-05 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
1#!/bin/bash
2#aggregate_stacktrace 0 /tmp/percona-toolkit
3
4cat > $1 <<EOF
5 32 read,vio_read_buff,libmysqlclient::??,my_net_read,cli_safe_read,libmysqlclient::??,mysql_real_query,Connection::run,Worker::work,thread_proxy,start_thread,clone,??
6 1 pthread_cond_wait,LogReader::work,thread_proxy,start_thread,clone,??
7 1 pthread_cond_wait,boost::thread::join,main
8 1 pthread_cond_wait,boost::condition_variable::wait,Worker::work,thread_proxy,start_thread,clone,??
9 1 pthread_cond_wait,boost::condition_variable::wait,Reporter::work,thread_proxy,start_thread,clone,??
10 1 pthread_cond_wait,boost::condition_variable::wait,Queue::push,Parser::work,thread_proxy,start_thread,clone,??
11EOF
12
13cp samples/stacktrace-005.txt $2
140
=== added file 't/pt-pmp/aggregate_stacktrace.sh'
--- t/pt-pmp/aggregate_stacktrace.sh 1970-01-01 00:00:00 +0000
+++ t/pt-pmp/aggregate_stacktrace.sh 2011-08-19 17:39:24 +0000
@@ -0,0 +1,122 @@
1#!/usr/bin/env bash
2
3# This test file must be ran by util/test-bash-functions.
4
5TESTS=6
6
7# ############################################################################
8TEST_NAME="stacktrace-001.txt"
9# ############################################################################
10cat > $TMPDIR/expected <<EOF
11 187 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,open_table,open_tables,open_and_lock_tables,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
12 62 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,close_thread_tables,dispatch_command,handle_one_connection,start_thread,clone
13 39 read,vio_read,my_real_read,my_net_read,handle_one_connection,start_thread,clone
14 18 pthread_cond_wait,safe_cond_wait,os_event_wait_low,os_aio_simulated_handle,fil_aio_wait,io_handler_thread,start_thread,clone
15 15 pthread_cond_wait,safe_cond_wait,end_thread,handle_one_connection,start_thread,clone
16 15 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,open_table,open_tables,mysql_update,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
17 12 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,open_table,open_tables,open_and_lock_tables,mysql_insert,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
18 2 __lll_mutex_lock_wait,_L_mutex_lock_107,pthread_mutex_lock,safe_mutex_lock,Log_event::read_log_event,mysql_binlog_send,dispatch_command,handle_one_connection,start_thread,clone
19 1 select,os_thread_sleep,srv_master_thread,start_thread,clone
20 1 select,os_thread_sleep,srv_lock_timeout_and_monitor_thread,start_thread,clone
21 1 select,os_thread_sleep,srv_error_monitor_thread,start_thread,clone
22 1 select,handle_connections_sockets,main
23 1 _sanity,_myfree,st_join_table::cleanup,JOIN::cleanup,JOIN::join_free,do_select,JOIN::exec,mysql_select,handle_select,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
24 1 pread64,_os_file_pread,_os_file_read,_fil_io,buf_read_page_low,buf_read_page,buf_page_get_gen,btr_cur_search_to_nth_level,btr_estimate_n_rows_in_range,ha_innobase::records_in_range,check_quick_keys,check_quick_select,get_key_scans_params,SQL_SELECT::test_quick_select,mysql_update,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
25 1 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,_sanity,_myrealloc,String::realloc,String::append,Log_event::read_log_event,mysql_binlog_send,dispatch_command,handle_one_connection,start_thread,clone
26 1 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,_sanity,_mymalloc,_myrealloc,mi_alloc_rec_buff,mi_open,ha_myisam::open,handler::ha_open,open_tmp_table,create_tmp_table,select_union::create_result_table,mysql_derived_prepare,mysql_handle_derived,open_and_lock_tables,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
27 1 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,_sanity,_mymalloc,init_dynamic_array,QUICK_RANGE_SELECT,get_quick_select,TRP_RANGE::make_quick,SQL_SELECT::test_quick_select,make_join_statistics,JOIN::optimize,mysql_select,mysql_derived_filling,mysql_handle_derived,open_and_lock_tables,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
28 1 __lll_mutex_lock_wait,_L_mutex_lock_1133,pthread_mutex_lock,safe_mutex_lock,_mymalloc,alloc_root,MYSQLparse,mysql_make_view,open_unireg_entry,open_table,open_tables,open_and_lock_tables,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
29 1 __lll_mutex_lock_wait,_L_mutex_lock_107,pthread_mutex_lock,safe_mutex_lock,mi_open,ha_myisam::open,handler::ha_open,open_tmp_table,create_tmp_table,select_union::create_result_table,mysql_derived_prepare,mysql_handle_derived,open_and_lock_tables,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
30 1 do_sigwait,sigwait,signal_hand,start_thread,clone
31EOF
32
33aggregate_stacktrace 0 samples/stacktrace-001.txt > $TMPDIR/got
34no_diff $TMPDIR/got $TMPDIR/expected
35
36# ############################################################################
37TEST_NAME="stacktrace-002.txt"
38# ############################################################################
39cat > $TMPDIR/expected <<EOF
40 2387 pthread_cond_wait,open_table,open_tables,open_and_lock_tables_derived,execute_sqlcom_select,mysql_execute_command,mysql_parse,dispatch_command,do_command,handle_one_connection,start_thread,clone
41 5 pthread_cond_wait,open_table,open_tables,open_and_lock_tables_derived,mysql_insert,mysql_execute_command,mysql_parse,dispatch_command,do_command,handle_one_connection,start_thread,clone
42 4 pthread_cond_wait,os_event_wait_low,os_aio_simulated_handle,fil_aio_wait,io_handler_thread,start_thread,clone
43 4 pthread_cond_wait,open_table,open_tables,open_and_lock_tables_derived,mysql_delete,mysql_execute_command,mysql_parse,dispatch_command,do_command,handle_one_connection,start_thread,clone
44 1 select,os_thread_sleep,srv_master_thread,start_thread,clone
45 1 select,os_thread_sleep,srv_lock_timeout_and_monitor_thread,start_thread,clone
46 1 select,os_thread_sleep,srv_error_monitor_thread,start_thread,clone
47 1 select,handle_connections_sockets,main,select
48 1 read,my_real_read,my_net_read,do_command,handle_one_connection,start_thread,clone
49 1 pthread_cond_wait,cache_thread,one_thread_per_connection_end,handle_one_connection,start_thread,clone
50 1 free,ut_free,page_cur_insert_rec_low,btr_cur_optimistic_insert,row_ins_index_entry_low,row_ins_index_entry,row_ins,row_ins_step,row_insert_for_mysql,ha_innobase::write_row,handler::ha_write_row,ha_partition::copy_partitions,ha_partition::change_partitions,handler::ha_change_partitions,mysql_change_partitions,fast_alter_partition_table,mysql_alter_table,mysql_execute_command,mysql_parse,dispatch_command,do_command,handle_one_connection,start_thread,clone
51 1 do_sigwait,sigwait,signal_hand,start_thread,clone
52EOF
53
54aggregate_stacktrace 0 samples/stacktrace-002.txt > $TMPDIR/got
55no_diff $TMPDIR/got $TMPDIR/expected
56
57# ############################################################################
58TEST_NAME="stacktrace-003.txt"
59# ############################################################################
60cat > $TMPDIR/expected <<EOF
61 35 pthread_cond_wait,end_thread,handle_one_connection,start_thread,clone
62 20 read,read,vio_read,my_real_read,my_net_read,handle_one_connection,start_thread,clone
63 18 pthread_cond_wait,os_event_wait_low,os_aio_simulated_handle,fil_aio_wait,io_handler_thread,start_thread,clone
64 3 pthread_cond_wait,MYSQL_LOG::wait_for_update,mysql_binlog_send,dispatch_command,handle_one_connection,start_thread,clone
65 1 select,os_thread_sleep,srv_master_thread,start_thread,clone
66 1 select,os_thread_sleep,srv_lock_timeout_and_monitor_thread,start_thread,clone
67 1 select,os_thread_sleep,srv_error_monitor_thread,start_thread,clone
68 1 select,handle_connections_sockets,main
69 1 do_sigwait,sigwait,signal_hand,start_thread,clone
70 1 btr_search_guess_on_hash,btr_cur_search_to_nth_level,btr_pcur_open_with_no_init,row_search_for_mysql,ha_innobase::index_read,join_read_always_key,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,do_select,JOIN::exec,mysql_select,handle_select,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
71 1 btr_cur_search_to_nth_level,btr_estimate_n_rows_in_range,ha_innobase::records_in_range,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_select,get_key_scans_params,SQL_SELECT::test_quick_select,get_quick_record_count,make_join_statistics,JOIN::optimize,mysql_select,handle_select,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread,clone
72EOF
73
74aggregate_stacktrace 0 samples/stacktrace-003.txt > $TMPDIR/got
75no_diff $TMPDIR/got $TMPDIR/expected
76
77# ############################################################################
78TEST_NAME="stacktrace-003-b.txt"
79# ############################################################################
80cat > $TMPDIR/expected <<EOF
81 35 pthread_cond_wait,end_thread
82 20 read,read
83 18 pthread_cond_wait,os_event_wait_low
84 3 select,os_thread_sleep
85 3 pthread_cond_wait,MYSQL_LOG::wait_for_update
86 1 select,handle_connections_sockets
87 1 do_sigwait,sigwait
88 1 btr_search_guess_on_hash,btr_cur_search_to_nth_level
89 1 btr_cur_search_to_nth_level,btr_estimate_n_rows_in_range
90EOF
91
92aggregate_stacktrace 2 samples/stacktrace-003.txt > $TMPDIR/got
93no_diff $TMPDIR/got $TMPDIR/expected
94
95# ############################################################################
96TEST_NAME="stacktrace-004.txt"
97# ############################################################################
98cat > $TMPDIR/expected <<EOF
99 33 pthread_cond_wait,boost::condition_variable::wait,Queue::pop,Worker::work,boost::_mfi::mf0::operator,boost::_bi::list1::operator,boost::_bi::bind_t::operator,boost::detail::thread_data::run,thread_proxy,start_thread,clone,??
100 1 StringBuilder::length,Parser::add,Parser::try_parse_query,Parser::parse_block,Parser::work,boost::_mfi::mf0::operator,boost::_bi::list1::operator,boost::_bi::bind_t::operator,boost::detail::thread_data::run,thread_proxy,start_thread,clone,??
101 1 pthread_cond_wait,boost::thread::join,LogReader::wait,Replay::wait,main
102 1 pthread_cond_wait,boost::condition_variable::wait,Queue::push,LogReader::work,boost::_mfi::mf0::operator,boost::_bi::list1::operator,boost::_bi::bind_t::operator,boost::detail::thread_data::run,thread_proxy,start_thread,clone,??
103 1 pthread_cond_wait,boost::condition_variable::wait,Queue::pop,Reporter::work,boost::_mfi::mf0::operator,boost::_bi::list1::operator,boost::_bi::bind_t::operator,boost::detail::thread_data::run,thread_proxy,start_thread,clone,??
104EOF
105
106aggregate_stacktrace 0 samples/stacktrace-004.txt > $TMPDIR/got
107no_diff $TMPDIR/got $TMPDIR/expected
108
109# ############################################################################
110TEST_NAME="stacktrace-005.txt"
111# ############################################################################
112cat > $TMPDIR/expected <<EOF
113 32 read,vio_read_buff,libmysqlclient::??,my_net_read,cli_safe_read,libmysqlclient::??,mysql_real_query,Connection::run,Worker::work,thread_proxy,start_thread,clone,??
114 1 pthread_cond_wait,LogReader::work,thread_proxy,start_thread,clone,??
115 1 pthread_cond_wait,boost::thread::join,main
116 1 pthread_cond_wait,boost::condition_variable::wait,Worker::work,thread_proxy,start_thread,clone,??
117 1 pthread_cond_wait,boost::condition_variable::wait,Reporter::work,thread_proxy,start_thread,clone,??
118 1 pthread_cond_wait,boost::condition_variable::wait,Queue::push,Parser::work,thread_proxy,start_thread,clone,??
119EOF
120
121aggregate_stacktrace 0 samples/stacktrace-005.txt > $TMPDIR/got
122no_diff $TMPDIR/got $TMPDIR/expected
0123
=== modified file 't/pt-pmp/pt-pmp.t'
--- t/pt-pmp/pt-pmp.t 2011-07-12 22:56:55 +0000
+++ t/pt-pmp/pt-pmp.t 2011-08-19 17:39:24 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/evn perl1#!/usr/bin/env perl
22
3BEGIN {3BEGIN {
4 die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"4 die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
@@ -12,6 +12,8 @@
1212
13use PerconaTest;13use PerconaTest;
1414
15system("$trunk/util/test-bash-tool pt-pmp @ARGV");15my ($tool) = $PROGRAM_NAME =~ m/([\w-]+)\.t$/;
16push @ARGV, "$trunk/t/$tool/*.sh" unless @ARGV;
17system("$trunk/util/test-bash-functions $trunk/bin/$tool @ARGV");
1618
17exit;19exit;
1820
=== removed file 't/pt-summary/format-filesystems-01'
--- t/pt-summary/format-filesystems-01 2011-07-01 16:29:50 +0000
+++ t/pt-summary/format-filesystems-01 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
1#!/bin/bash
2#parse_filesystems samples/df-mount-001.txt Linux
3
4cat <<EOF > $1
5 Filesystem Size Used Type Opts Mountpoint
6 /dev/mapper/vg_ginger-lv_root 454G 6% ext4 rw /
7 /dev/sda1 194M 31% ext4 rw /boot
8 tmpfs 2.0G 1% tmpfs rw /dev/shm
9EOF
100
=== removed file 't/pt-summary/format-filesystems-02'
--- t/pt-summary/format-filesystems-02 2011-07-01 16:29:50 +0000
+++ t/pt-summary/format-filesystems-02 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
1#!/bin/bash
2#parse_filesystems samples/df-mount-002.txt Linux
3
4cat <<EOF > $1
5 Filesystem Size Used Type Opts Mountpoint
6 /dev/mapper/VolGroup00-LogVol00 62G 56% ext3 rw /
7 /dev/mapper/VolGroup01-MySQLData00 67G 20% ext3 rw /var/lib/mysql
8 /dev/sda3 190M 11% ext3 rw /boot
9 tmpfs 7.9G 0% tmpfs rw /dev/shm
10EOF
110
=== removed file 't/pt-summary/format-filesystems-03'
--- t/pt-summary/format-filesystems-03 2011-07-01 16:29:50 +0000
+++ t/pt-summary/format-filesystems-03 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
1#!/bin/bash
2#parse_filesystems samples/df-mount-003.txt Linux
3
4cat <<EOF > $1
5 Filesystem Size Used Type Opts Mountpoint
6 /dev/sda1 99M 13% ext3 rw /boot
7 /dev/sda2 540G 89% ext3 rw /
8 tmpfs 48G 0% tmpfs rw /dev/shm
9EOF
100
=== removed file 't/pt-summary/format-filesystems-04'
--- t/pt-summary/format-filesystems-04 2011-07-01 16:29:50 +0000
+++ t/pt-summary/format-filesystems-04 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
1#!/bin/bash
2#parse_filesystems samples/df-mount-004.txt Linux
3
4cat <<EOF > $1
5 Filesystem Size Used Type Opts Mountpoint
6 /dev/sda1 9.9G 34% ext3 rw /
7 /dev/sdb 414G 1% ext3 rw /mnt
8 none 7.6G 0% devpts rw,gid=5,mode=620 /dev/shm
9 none 7.6G 0% tmpfs rw /dev/shm
10 none 7.6G 0% binfmt_misc rw /dev/shm
11 none 7.6G 0% proc rw /dev/shm
12 none 7.6G 0% sysfs rw /dev/shm
13EOF
140
=== removed file 't/pt-summary/format-filesystems-05'
--- t/pt-summary/format-filesystems-05 2011-07-01 16:29:50 +0000
+++ t/pt-summary/format-filesystems-05 1970-01-01 00:00:00 +0000
@@ -1,11 +0,0 @@
1#!/bin/bash
2#parse_filesystems samples/df-mount-005.txt Linux
3
4cat <<EOF > $1
5 Filesystem Size Used Type Opts Mountpoint
6 /dev/cciss/c0d0p1 99M 24% ext3 rw /boot
7 /dev/mapper/VolGroup00-LogVol00 194G 58% ext3 rw /
8 /dev/mapper/VolGroup00-mysql_log 191G 4% ext3 rw /data/mysql-log
9 /dev/mapper/VolGroup01-mysql_data 1008G 44% ext3 rw,noatime /data/mysql-data
10 tmpfs 48G 0% tmpfs rw /dev/shm
11EOF
120
=== removed file 't/pt-summary/format-filesystems-06'
--- t/pt-summary/format-filesystems-06 2011-07-01 16:29:50 +0000
+++ t/pt-summary/format-filesystems-06 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
1#!/bin/bash
2#parse_filesystems samples/df-mount-006.txt FreeBSD
3
4# This one is from FreeBSD.
5
6cat <<EOF > $1
7 Filesystem Size Used Type Opts Mountpoint
8 /dev/ad0s1a 496M 32% ufs local /
9 /dev/ad0s1d 1.1G 1% ufs local, soft-updates /var
10 /dev/ad0s1e 496M 0% ufs local, soft-updates /tmp
11 /dev/ad0s1f 17G 9% ufs local, soft-updates /usr
12 devfs 1.0K 100% devfs local /dev
13EOF
140
=== renamed file 't/pt-summary/vmstat-simplify' => 't/pt-summary/format_vmstat.sh' (properties changed: +x to -x)
--- t/pt-summary/vmstat-simplify 2011-07-01 16:29:50 +0000
+++ t/pt-summary/format_vmstat.sh 2011-08-19 17:39:24 +0000
@@ -1,7 +1,21 @@
1#!/bin/bash1#!/bin/bash
2#format_vmstat2
33cat <<EOF > $TMPDIR/in
4cat <<EOF > $14procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
5 r b swpd free buff cache si so bi bo in cs us sy id wa st
6 0 0 68 288220 372588 13534140 0 0 24 138 1 1 4 1 94 1 0
7 1 0 68 288080 372588 13534184 0 0 0 187 721 943 3 0 96 0 0
8 0 0 68 287708 372588 13534276 0 0 0 1058 747 992 8 3 89 0 0
9 1 0 68 287468 372588 13534340 0 0 0 1058 552 856 15 2 84 0 0
10 1 0 68 287460 372588 13534388 0 0 0 322 859 1014 10 3 87 0 0
11 0 0 68 287460 372588 13534444 0 0 0 214 612 729 10 3 88 0 0
12 0 0 68 287460 372588 13534484 0 0 0 309 553 741 0 0 99 0 0
13 1 0 68 287460 372588 13534532 0 0 2 197 605 727 2 1 97 0 0
14 0 0 68 287344 372588 13534596 0 0 0 1037 485 626 0 0 99 0 0
15 0 0 68 287220 372588 13534656 0 0 0 235 875 1004 0 0 99 0 0
16EOF
17
18cat <<EOF > $TMPDIR/expected
5 procs ---swap-- -----io---- ---system---- --------cpu--------19 procs ---swap-- -----io---- ---system---- --------cpu--------
6 r b si so bi bo ir cs us sy il wa st20 r b si so bi bo ir cs us sy il wa st
7 0 0 0 0 25 150 1 1 4 1 94 1 021 0 0 0 0 25 150 1 1 4 1 94 1 0
@@ -16,17 +30,5 @@
16 0 0 0 0 0 225 900 1000 0 0 99 0 030 0 0 0 0 0 225 900 1000 0 0 99 0 0
17EOF31EOF
1832
19cat <<EOF > $233format_vmstat $TMPDIR/in > $TMPDIR/got
20procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------34no_diff $TMPDIR/got $TMPDIR/expected
21 r b swpd free buff cache si so bi bo in cs us sy id wa st
22 0 0 68 288220 372588 13534140 0 0 24 138 1 1 4 1 94 1 0
23 1 0 68 288080 372588 13534184 0 0 0 187 721 943 3 0 96 0 0
24 0 0 68 287708 372588 13534276 0 0 0 1058 747 992 8 3 89 0 0
25 1 0 68 287468 372588 13534340 0 0 0 1058 552 856 15 2 84 0 0
26 1 0 68 287460 372588 13534388 0 0 0 322 859 1014 10 3 87 0 0
27 0 0 68 287460 372588 13534444 0 0 0 214 612 729 10 3 88 0 0
28 0 0 68 287460 372588 13534484 0 0 0 309 553 741 0 0 99 0 0
29 1 0 68 287460 372588 13534532 0 0 2 197 605 727 2 1 97 0 0
30 0 0 68 287344 372588 13534596 0 0 0 1037 485 626 0 0 99 0 0
31 0 0 68 287220 372588 13534656 0 0 0 235 875 1004 0 0 99 0 0
32EOF
3335
=== removed file 't/pt-summary/fusionmpt-01'
--- t/pt-summary/fusionmpt-01 2011-07-01 16:29:50 +0000
+++ t/pt-summary/fusionmpt-01 1970-01-01 00:00:00 +0000
@@ -1,19 +0,0 @@
1#!/bin/bash
2#parse_fusionmpt_lsiutil
3
4cat <<EOF > $1
5
6 /proc/mpt/ioc0 LSI Logic SAS1068E B3 MPT 105 Firmware 00192f00 IOC 0
7 B___T___L Type Vendor Product Rev SASAddress PhyNum
8 0 0 0 Disk Dell VIRTUAL DISK 1028
9 0 2 0 Disk Dell VIRTUAL DISK 1028
10 0 8 0 EnclServ DP BACKPLANE 1.05 510240805f4feb00 8
11 Hidden RAID Devices:
12 B___T Device Vendor Product Rev SASAddress PhyNum
13 0 1 PhysDisk 0 SEAGATE ST373455SS S52A 5000c50012a8ac61 1
14 0 9 PhysDisk 1 SEAGATE ST373455SS S52A 5000c50012a8a24d 0
15 0 3 PhysDisk 2 SEAGATE ST3146855SS S52A 5000c500130fcaed 3
16 0 10 PhysDisk 3 SEAGATE ST3146855SS S52A 5000c500131093f5 2
17EOF
18
19cat samples/lsiutil-001.txt > $2
200
=== removed file 't/pt-summary/fusionmpt-02'
--- t/pt-summary/fusionmpt-02 2011-07-01 16:29:50 +0000
+++ t/pt-summary/fusionmpt-02 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
1#!/bin/bash
2#parse_fusionmpt_lsiutil
3
4cat <<EOF > $1
5
6 /proc/mpt/ioc0 LSI Logic SAS1064E B3 MPT 105 Firmware 011e0000 IOC 0
7 B___T___L Type Vendor Product Rev SASAddress PhyNum
8 0 1 0 Disk LSILOGIC Logical Volume 3000
9 Hidden RAID Devices:
10 B___T Device Vendor Product Rev SASAddress PhyNum
11 0 2 PhysDisk 0 IBM-ESXS ST9300603SS F B536 5000c5001d784329 1
12 0 3 PhysDisk 1 IBM-ESXS MBD2300RC SB17 500000e113c17152 0
13EOF
14
15cat samples/lsiutil-002.txt > $2
160
=== removed file 't/pt-summary/fusionmpt-03'
--- t/pt-summary/fusionmpt-03 2011-07-01 16:29:50 +0000
+++ t/pt-summary/fusionmpt-03 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
1#!/bin/bash
2#parse_fusionmpt_lsiutil
3
4cat <<EOF > $1
5
6 /proc/mpt/ioc0 LSI Logic SAS1064E B3 MPT 105 Firmware 011e0000 IOC 0
7 B___T___L Type Vendor Product Rev SASAddress PhyNum
8 0 1 0 Disk LSILOGIC Logical Volume 3000
9 Hidden RAID Devices:
10 B___T Device Vendor Product Rev SASAddress PhyNum
11 0 2 PhysDisk 0 IBM-ESXS MBD2300RC SB17 500000e113c00ed2 1
12 0 3 PhysDisk 1 IBM-ESXS MBD2300RC SB17 500000e113c17ee2 0
13EOF
14
15cat samples/lsiutil-003.txt > $2
160
=== removed file 't/pt-summary/lsi-megaraid-bbu-status'
--- t/pt-summary/lsi-megaraid-bbu-status 2011-07-01 16:29:50 +0000
+++ t/pt-summary/lsi-megaraid-bbu-status 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
1#!/bin/bash
2#parse_lsi_megaraid_bbu_status
3
4cat <<EOF > $1
5 BBU | 100% Charged, Temperature 18C, isSOHGood=Yes
6EOF
7
8cat <<EOF > $2
9BBU status for Adapter: 0
10
11BatteryType: BBU
12Voltage: 4072 mV
13Current: 0 mA
14Temperature: 18 C
15Firmware Status: 00000000
16
17Battery state:
18
19GasGuageStatus:
20 Fully Discharged : No
21 Fully Charged : Yes
22 Discharging : Yes
23 Initialized : Yes
24 Remaining Time Alarm : No
25 Remaining Capacity Alarm: No
26 Discharge Terminated : No
27 Over Temperature : No
28 Charging Terminated : No
29 Over Charged : No
30
31Relative State of Charge: 100 %
32Charger Status: Complete
33Remaining Capacity: 867 mAh
34Full Charge Capacity: 867 mAh
35isSOHGood: Yes
36
37Exit Code: 0x00
38EOF
390
=== removed file 't/pt-summary/lsi-megaraid-devices-0'
--- t/pt-summary/lsi-megaraid-devices-0 2011-07-01 16:29:50 +0000
+++ t/pt-summary/lsi-megaraid-devices-0 1970-01-01 00:00:00 +0000
@@ -1,100 +0,0 @@
1#!/bin/bash
2#parse_lsi_megaraid_devices
3
4cat <<EOF > $1
5
6 PhysiclDev Type State Errors Vendor Model Size
7 ========== ==== ======= ====== ======= ============ ===========
8 Hard Disk SAS Online 0/0/0 SEAGATE ST373455SS 70007MB
9 Hard Disk SAS Online 0/0/0 SEAGATE ST373455SS 70007MB
10 Hard Disk SAS Online 0/0/0 SEAGATE ST373455SS 70007MB
11 Hard Disk SAS Online 0/0/0 SEAGATE ST373455SS 70007MB
12EOF
13
14cat <<EOF > $2
15
16Adapter #0
17
18Enclosure Device ID: 32
19Slot Number: 0
20Device Id: 0
21Sequence Number: 2
22Media Error Count: 0
23Other Error Count: 0
24Predictive Failure Count: 0
25Last Predictive Failure Event Seq Number: 0
26PD Type: SAS
27Raw Size: 70007MB [0x88bb93a Sectors]
28Non Coerced Size: 69495MB [0x87bb93a Sectors]
29Coerced Size: 69376MB [0x8780000 Sectors]
30Firmware state: Online
31SAS Address(0): 0x5000c500079f8cf9
32SAS Address(1): 0x0
33Connected Port Number: 0(path0)
34Inquiry Data: SEAGATE ST373455SS S5273LQ2DZ33
35Foreign State: None
36Media Type: Hard Disk Device
37
38Enclosure Device ID: 32
39Slot Number: 1
40Device Id: 1
41Sequence Number: 2
42Media Error Count: 0
43Other Error Count: 0
44Predictive Failure Count: 0
45Last Predictive Failure Event Seq Number: 0
46PD Type: SAS
47Raw Size: 70007MB [0x88bb93a Sectors]
48Non Coerced Size: 69495MB [0x87bb93a Sectors]
49Coerced Size: 69376MB [0x8780000 Sectors]
50Firmware state: Online
51SAS Address(0): 0x5000c500079f5c35
52SAS Address(1): 0x0
53Connected Port Number: 1(path0)
54Inquiry Data: SEAGATE ST373455SS S5273LQ2D9RH
55Foreign State: None
56Media Type: Hard Disk Device
57
58Enclosure Device ID: 32
59Slot Number: 2
60Device Id: 2
61Sequence Number: 2
62Media Error Count: 0
63Other Error Count: 0
64Predictive Failure Count: 0
65Last Predictive Failure Event Seq Number: 0
66PD Type: SAS
67Raw Size: 70007MB [0x88bb93a Sectors]
68Non Coerced Size: 69495MB [0x87bb93a Sectors]
69Coerced Size: 69376MB [0x8780000 Sectors]
70Firmware state: Online
71SAS Address(0): 0x5000c500079fc0c9
72SAS Address(1): 0x0
73Connected Port Number: 2(path0)
74Inquiry Data: SEAGATE ST373455SS S5273LQ2DPST
75Foreign State: None
76Media Type: Hard Disk Device
77
78Enclosure Device ID: 32
79Slot Number: 3
80Device Id: 3
81Sequence Number: 2
82Media Error Count: 0
83Other Error Count: 0
84Predictive Failure Count: 0
85Last Predictive Failure Event Seq Number: 0
86PD Type: SAS
87Raw Size: 70007MB [0x88bb93a Sectors]
88Non Coerced Size: 69495MB [0x87bb93a Sectors]
89Coerced Size: 69376MB [0x8780000 Sectors]
90Firmware state: Online
91SAS Address(0): 0x5000c500079dc339
92SAS Address(1): 0x0
93Connected Port Number: 3(path0)
94Inquiry Data: SEAGATE ST373455SS S5273LQ2CKD5
95Foreign State: None
96Media Type: Hard Disk Device
97
98
99Exit Code: 0x00
100EOF
1010
=== removed file 't/pt-summary/lsi-megaraid-devices-1'
--- t/pt-summary/lsi-megaraid-devices-1 2011-07-01 16:29:50 +0000
+++ t/pt-summary/lsi-megaraid-devices-1 1970-01-01 00:00:00 +0000
@@ -1,134 +0,0 @@
1#!/bin/bash
2#parse_lsi_megaraid_devices
3
4cat <<EOF > $1
5
6 PhysiclDev Type State Errors Vendor Model Size
7 ========== ==== ======= ====== ======= ============ ===========
8 Hard Disk SAS Online 0/0/0 SEAGATE ST373455SS 70007MB
9 Hard Disk SAS Online 0/0/0 SEAGATE ST373455SS 70007MB
10 Hard Disk SAS Online 0/0/0 SEAGATE ST373455SS 70007MB
11 Hard Disk SAS Online 0/0/0 SEAGATE ST373455SS 70007MB
12EOF
13
14cat <<EOF > $2
15[root@pc-db1 ~]# /opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aALL
16
17Adapter #0
18
19Number of Virtual Disks: 2
20Virtual Disk: 0 (Target Id: 0)
21Name:
22RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
23Size:69376MB
24State: Optimal
25Stripe Size: 64kB
26Number Of Drives:2
27Span Depth:1
28Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
29Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
30Access Policy: Read/Write
31Disk Cache Policy: Disk's Default
32Number of Spans: 1
33Span: 0 - Number of PDs: 2
34PD: 0 Information
35Enclosure Device ID: 32
36Slot Number: 0
37Device Id: 0
38Sequence Number: 2
39Media Error Count: 0
40Other Error Count: 0
41Predictive Failure Count: 0
42Last Predictive Failure Event Seq Number: 0
43PD Type: SAS
44Raw Size: 70007MB [0x88bb93a Sectors]
45Non Coerced Size: 69495MB [0x87bb93a Sectors]
46Coerced Size: 69376MB [0x8780000 Sectors]
47Firmware state: Online
48SAS Address(0): 0x5000c500079f8cf9
49SAS Address(1): 0x0
50Connected Port Number: 0(path0)
51Inquiry Data: SEAGATE ST373455SS S5273LQ2DZ33
52Foreign State: None
53Media Type: Hard Disk Device
54
55PD: 1 Information
56Enclosure Device ID: 32
57Slot Number: 1
58Device Id: 1
59Sequence Number: 2
60Media Error Count: 0
61Other Error Count: 0
62Predictive Failure Count: 0
63Last Predictive Failure Event Seq Number: 0
64PD Type: SAS
65Raw Size: 70007MB [0x88bb93a Sectors]
66Non Coerced Size: 69495MB [0x87bb93a Sectors]
67Coerced Size: 69376MB [0x8780000 Sectors]
68Firmware state: Online
69SAS Address(0): 0x5000c500079f5c35
70SAS Address(1): 0x0
71Connected Port Number: 1(path0)
72Inquiry Data: SEAGATE ST373455SS S5273LQ2D9RH
73Foreign State: None
74Media Type: Hard Disk Device
75
76Virtual Disk: 1 (Target Id: 1)
77Name:
78RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
79Size:69376MB
80State: Optimal
81Stripe Size: 64kB
82Number Of Drives:2
83Span Depth:1
84Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
85Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
86Access Policy: Read/Write
87Disk Cache Policy: Disk's Default
88Number of Spans: 1
89Span: 0 - Number of PDs: 2
90PD: 0 Information
91Enclosure Device ID: 32
92Slot Number: 2
93Device Id: 2
94Sequence Number: 2
95Media Error Count: 0
96Other Error Count: 0
97Predictive Failure Count: 0
98Last Predictive Failure Event Seq Number: 0
99PD Type: SAS
100Raw Size: 70007MB [0x88bb93a Sectors]
101Non Coerced Size: 69495MB [0x87bb93a Sectors]
102Coerced Size: 69376MB [0x8780000 Sectors]
103Firmware state: Online
104SAS Address(0): 0x5000c500079fc0c9
105SAS Address(1): 0x0
106Connected Port Number: 2(path0)
107Inquiry Data: SEAGATE ST373455SS S5273LQ2DPST
108Foreign State: None
109Media Type: Hard Disk Device
110
111PD: 1 Information
112Enclosure Device ID: 32
113Slot Number: 3
114Device Id: 3
115Sequence Number: 2
116Media Error Count: 0
117Other Error Count: 0
118Predictive Failure Count: 0
119Last Predictive Failure Event Seq Number: 0
120PD Type: SAS
121Raw Size: 70007MB [0x88bb93a Sectors]
122Non Coerced Size: 69495MB [0x87bb93a Sectors]
123Coerced Size: 69376MB [0x8780000 Sectors]
124Firmware state: Online
125SAS Address(0): 0x5000c500079dc339
126SAS Address(1): 0x0
127Connected Port Number: 3(path0)
128Inquiry Data: SEAGATE ST373455SS S5273LQ2CKD5
129Foreign State: None
130Media Type: Hard Disk Device
131
132
133Exit Code: 0x00
134EOF
1350
=== removed file 't/pt-summary/lsi-megaraid-vdevices-0'
--- t/pt-summary/lsi-megaraid-vdevices-0 2011-07-01 16:29:50 +0000
+++ t/pt-summary/lsi-megaraid-vdevices-0 1970-01-01 00:00:00 +0000
@@ -1,132 +0,0 @@
1#!/bin/bash
2#parse_lsi_megaraid_virtual_devices
3
4cat <<EOF > $1
5
6 VirtualDev Size RAID Level Disks SpnDpth Stripe Status Cache
7 ========== ========= ========== ===== ======= ====== ======= =========
8 0(no name) 69376MB 1 (1-0-0) 2 1-1 64kB Optimal WB, no RA
9 1(no name) 69376MB 1 (1-0-0) 2 1-1 64kB Optimal WB, no RA
10EOF
11
12cat <<EOF > $2
13[root@pc-db1 ~]# /opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aALL
14
15Adapter #0
16
17Number of Virtual Disks: 2
18Virtual Disk: 0 (Target Id: 0)
19Name:
20RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
21Size:69376MB
22State: Optimal
23Stripe Size: 64kB
24Number Of Drives:2
25Span Depth:1
26Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
27Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
28Access Policy: Read/Write
29Disk Cache Policy: Disk's Default
30Number of Spans: 1
31Span: 0 - Number of PDs: 2
32PD: 0 Information
33Enclosure Device ID: 32
34Slot Number: 0
35Device Id: 0
36Sequence Number: 2
37Media Error Count: 0
38Other Error Count: 0
39Predictive Failure Count: 0
40Last Predictive Failure Event Seq Number: 0
41PD Type: SAS
42Raw Size: 70007MB [0x88bb93a Sectors]
43Non Coerced Size: 69495MB [0x87bb93a Sectors]
44Coerced Size: 69376MB [0x8780000 Sectors]
45Firmware state: Online
46SAS Address(0): 0x5000c500079f8cf9
47SAS Address(1): 0x0
48Connected Port Number: 0(path0)
49Inquiry Data: SEAGATE ST373455SS S5273LQ2DZ33
50Foreign State: None
51Media Type: Hard Disk Device
52
53PD: 1 Information
54Enclosure Device ID: 32
55Slot Number: 1
56Device Id: 1
57Sequence Number: 2
58Media Error Count: 0
59Other Error Count: 0
60Predictive Failure Count: 0
61Last Predictive Failure Event Seq Number: 0
62PD Type: SAS
63Raw Size: 70007MB [0x88bb93a Sectors]
64Non Coerced Size: 69495MB [0x87bb93a Sectors]
65Coerced Size: 69376MB [0x8780000 Sectors]
66Firmware state: Online
67SAS Address(0): 0x5000c500079f5c35
68SAS Address(1): 0x0
69Connected Port Number: 1(path0)
70Inquiry Data: SEAGATE ST373455SS S5273LQ2D9RH
71Foreign State: None
72Media Type: Hard Disk Device
73
74Virtual Disk: 1 (Target Id: 1)
75Name:
76RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
77Size:69376MB
78State: Optimal
79Stripe Size: 64kB
80Number Of Drives:2
81Span Depth:1
82Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
83Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
84Access Policy: Read/Write
85Disk Cache Policy: Disk's Default
86Number of Spans: 1
87Span: 0 - Number of PDs: 2
88PD: 0 Information
89Enclosure Device ID: 32
90Slot Number: 2
91Device Id: 2
92Sequence Number: 2
93Media Error Count: 0
94Other Error Count: 0
95Predictive Failure Count: 0
96Last Predictive Failure Event Seq Number: 0
97PD Type: SAS
98Raw Size: 70007MB [0x88bb93a Sectors]
99Non Coerced Size: 69495MB [0x87bb93a Sectors]
100Coerced Size: 69376MB [0x8780000 Sectors]
101Firmware state: Online
102SAS Address(0): 0x5000c500079fc0c9
103SAS Address(1): 0x0
104Connected Port Number: 2(path0)
105Inquiry Data: SEAGATE ST373455SS S5273LQ2DPST
106Foreign State: None
107Media Type: Hard Disk Device
108
109PD: 1 Information
110Enclosure Device ID: 32
111Slot Number: 3
112Device Id: 3
113Sequence Number: 2
114Media Error Count: 0
115Other Error Count: 0
116Predictive Failure Count: 0
117Last Predictive Failure Event Seq Number: 0
118PD Type: SAS
119Raw Size: 70007MB [0x88bb93a Sectors]
120Non Coerced Size: 69495MB [0x87bb93a Sectors]
121Coerced Size: 69376MB [0x8780000 Sectors]
122Firmware state: Online
123SAS Address(0): 0x5000c500079dc339
124SAS Address(1): 0x0
125Connected Port Number: 3(path0)
126Inquiry Data: SEAGATE ST373455SS S5273LQ2CKD5
127Foreign State: None
128Media Type: Hard Disk Device
129
130
131Exit Code: 0x00
132EOF
1330
=== removed file 't/pt-summary/lsi-megaraid-vdevices-1'
--- t/pt-summary/lsi-megaraid-vdevices-1 2011-07-01 16:29:50 +0000
+++ t/pt-summary/lsi-megaraid-vdevices-1 1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
1#!/bin/bash
2#parse_lsi_megaraid_virtual_devices
3
4cat <<EOF > $1
5
6 VirtualDev Size RAID Level Disks SpnDpth Stripe Status Cache
7 ========== ========= ========== ===== ======= ====== ======= =========
8 0(no name) 69376MB 1 (1-0-0) 2 1- 64kB Optimal WB, no RA
9 1(no name) 69376MB 1 (1-0-0) 2 1- 64kB Optimal WB, no RA
10EOF
11
12cat <<EOF > $2
13[root@pc-db1 ~]# /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aAll
14
15
16Adapter 0 -- Virtual Drive Information:
17Virtual Disk: 0 (Target Id: 0)
18Name:
19RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
20Size:69376MB
21State: Optimal
22Stripe Size: 64kB
23Number Of Drives:2
24Span Depth:1
25Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
26Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
27Access Policy: Read/Write
28Disk Cache Policy: Disk's Default
29Virtual Disk: 1 (Target Id: 1)
30Name:
31RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
32