Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dontstopbelieveing/fa09a85016563233a632b8e00499fe0d to your computer and use it in GitHub Desktop.
Save dontstopbelieveing/fa09a85016563233a632b8e00499fe0d to your computer and use it in GitHub Desktop.
Cron - connection metrics
#!/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