Mysql loads
Jump to navigation
Jump to search
Scriptas tikrina sistemos apkrovas ir jeigu peržengtas trigger loadavg limitas vykdo mysql užklausų nutraukimą visame mysql serveryje
#!/bin/bash
trigger=40.00
load=`cat /proc/loadavg | awk '{print $1}'`
response=`echo | awk -v T=$trigger -v L=$load 'BEGIN{if ( L > T){ print "greater"}}'`
if [ "$response" = "greater" ]; then
echo "Load is to high!"
for i in $(mysql -e "show processlist" | grep -v wsrep | awk '{print $1}' ); do
mysql -e "kill $i"&
done
fi