Skip to content

Instantly share code, notes, and snippets.

@hn-support
Created March 13, 2017 12:25
Show Gist options
  • Save hn-support/66daf5aef6dfae0724c9b69b87d0b170 to your computer and use it in GitHub Desktop.
Save hn-support/66daf5aef6dfae0724c9b69b87d0b170 to your computer and use it in GitHub Desktop.
Monitor I/O heavy SQL queries and PHP requests on Hypernode
#!/bin/bash
# monitors iops per 30 sec interval, and prints current http and sql transactions if iops avg > 100
while true; do
iops=$(iostat xvdf -d 30 2 | tail -2 | head -1 | awk '{print $2}' | cut -d. -f1)
if [[ "$iops" -gt 100 ]]; then
echo "-------------------------------------------------------------------"
echo "IOPS: $iops"
echo
echo
echo 'show full processlist' | mysql --skip-column-names
hypernode-fpm-status
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment