Last active
October 4, 2019 00:17
-
-
Save dontstopbelieveing/8815057e8ca2e283c4a23ace863dd74f to your computer and use it in GitHub Desktop.
Collecting metrics
This file contains hidden or 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
| #Slave Lag | |
| #!/usr/bin/bash | |
| log_dir=/logs/ | |
| #Slave lag | |
| mysql --login-path=mysqlconn -e "show slave status \G" | grep Seconds| awk '{ print $2 }' | while IFS= read -r line; do printf '%s\t%s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$line"; done | tee -a $log_dir/slave_lag | |
| #Processlist | |
| mysql --login-path=mysqlconn -e "show slave status \G" | grep Seconds| awk '{ print $2 }' | while IFS= read -r line; do printf '%s\t%s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$line"; done | tee -a $log_dir/slave_lag |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment