Not the answer you need?
Register and ask your own question!

pt-stalk

stofa.kenidastofa.kenida ContributorCurrent User Role Novice
Hi There,

I'am testing pt-stalk tool by using 3.0.9 version on 5.5 mysql server version. When i run the command as below :

/usr/bin/pt-stalk --host 127.0.0.1 --port 3355 --mysql-only --daemonize --log /tmp/pt-stalk/pt-stalk.log --dest /tmp/pt-stalk --function status --variable Threads_running --threshold 12 --cycles=10 --sleep=30 --run-time=20 --interval 5 --retention-time 1 --disk-pct-free 10

It seems that mysql-only option is ignored as the generated processlist file is empty. I expected to see the output of SHOW FULL PROCESSLIST in the file named DATA-TIIME-processlist. Instead, by removing --mysql-only option, the file is correctly generated. What is wrong in my command?

Moreover, can pt-stalk be used against old mysql versions ( 5.0 and 4.1.25 ) ?

Thanks.

Comments

  • carlos.salguerocarlos.salguero Percona Toolkit Developer Percona Staff Role
    Hello,

    I don't see anything wrong with your command. Maybe it is an error. Could you fill a bug in Jira? https://jira.percona.com
    Regarding MySQL versions, version prior 5.5 are not supported but you can try it anyway. pt-stalk is a bash script that run commands and collect information so it should work.
  • stofa.kenidastofa.kenida Contributor Current User Role Novice
    Ok. Created bug in jira as suggested.

    Thanks.
  • stofa.kenidastofa.kenida Contributor Current User Role Novice
    I think the problem is fixed.
    Inside the script, the function called collect() is used to collect all the needed info.
    The following block is used to collect system info only when mysql-only is NOT used.

    while [ $((curr_time - start_time)) -lt $OPT_RUN_TIME ]; do
    if [ ! "$OPT_MYSQL_ONLY" ]; then
    disk_space $d > $d/$p-disk-space
    check_disk_space \
    $d/$p-disk-space \
    "$OPT_DISK_BYTES_FREE" \
    "$OPT_DISK_PCT_FREE" \
    || break

    sleep $(date +'%s.%N' | awk "{print $OPT_SLEEP_COLLECT - (\$1 % $OPT_SLEEP_COLLECT)}")
    local ts="$(date +"TS %s.%N %F %T")"

    if [ -d "/proc" ]; then
    if [ -f "/proc/diskstats" ]; then
    (echo $ts; cat /proc/diskstats) >> "$d/$p-diskstats" &
    fi
    if [ -f "/proc/stat" ]; then
    (echo $ts; cat /proc/stat) >> "$d/$p-procstat" &
    fi
    if [ -f "/proc/vmstat" ]; then
    (echo $ts; cat /proc/vmstat) >> "$d/$p-procvmstat" &
    fi
    if [ -f "/proc/meminfo" ]; then
    (echo $ts; cat /proc/meminfo) >> "$d/$p-meminfo" &
    fi
    if [ -f "/proc/slabinfo" ]; then
    (echo $ts; cat /proc/slabinfo) >> "$d/$p-slabinfo" &
    fi
    if [ -f "/proc/interrupts" ]; then
    (echo $ts; cat /proc/interrupts) >> "$d/$p-interrupts" &
    fi
    fi
    (echo $ts; df -k) >> "$d/$p-df" &
    (echo $ts; netstat -antp) >> "$d/$p-netstat" &
    (echo $ts; netstat -antp) >> "$d/$p-netstat" &
    (echo $ts; netstat -s) >> "$d/$p-netstat_s" &
    fi
    (echo $ts; $CMD_MYSQL $EXT_ARGV -e "SHOW FULL PROCESSLIST\G") \
    >> "$d/$p-processlist" &

    As you can see, in order to get SHOW FULL PROCESSLIST output, $ts variable is required.

    But the above variable is delared inside the if block, then when mysql-only is used, $ts is NOT set.

    By putting local ts="$(date +"TS %s.%N %F %T")" outside the if block, for instance just under while [ ] do;

    the command is executed and processlist file is populated.

    Stofa.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.