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

can pt-stalk monitor multi variables?

FanFan ContributorCurrent User Role Patron
when Thread_connected >= N or Thread_running >=M trigger pt-stalk

Comments

  • FanFan Contributor Current User Role Patron
    [[email protected] bin]# vi pt_stalk_func_thds_conn_runn.sh
    #!/bin/bash
    trg_plugin() {
    mysqladmin -uroot -p01890c7a92a5 -S /data/mysql/mysql.sock extended-status |\
    awk -F"|" \
    "BEGIN{ count=0; }"\
    '{ if ($2 ~ /Threads_connected/){Threads_connected=$3;}\
    else if ($2 ~ /Threads_running/){Threads_running=$3;}\
    else if ($2 ~ /Uptime / && count >= 0){\
    print Threads_connected,Threads_running;\
    }}' | awk 'BEGIN{counter=0} \
    { if ($1 > 7500 || $2 > 2000 ) counter++ ; } END {print counter}'
    }
    trg_plugin

    /usr/bin/pt-stalk --function /data/scripts/bin/pt_stalk_func_thds_conn_runn.sh --threshold 0 --daemonize --cycles 3 --user=root --ask-pass --socket=/data/mysql/mysql.sock
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.