Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Collecting metrics
#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