Buy Percona ServicesBuy Now!

can pt-stalk monitor multi variables?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • can pt-stalk monitor multi variables?

    when Thread_connected >= N or Thread_running >=M trigger pt-stalk

  • #2
    [root@iZbp18t5u2dsk7yec4lggpZ 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

    Comment

    Working...
    X