Created
September 30, 2019 19:25
-
-
Save dontstopbelieveing/fa09a85016563233a632b8e00499fe0d to your computer and use it in GitHub Desktop.
Cron - connection metrics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
#export PATH=$PATH:/x/home/mysql/product/mysql/bin/mysql | |
#mysql --login-path=mysqlconn --batch --skip-column-names -e "select * from information_schema.processlist where user not in ('root','repl','system user') and host like '10.72.12.201%'" | while IFS= read -r line; do printf '%s %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$line"; done | tee -a $log_dir/connection_metrics.log | |
mysql --login-path=mysqlconn --batch --skip-column-names -e "select now(),count(*) from information_schema.processlist where user not in ('root','repl','system user');" | tee -a /tmp/connection_metrics.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment