Home > OS >  CentOS7 automatic monitoring CPU utilization rate more than 80% automatic restart MariaDB service, h
CentOS7 automatic monitoring CPU utilization rate more than 80% automatic restart MariaDB service, h

Time:11-23

CentOS7 system, automatic monitoring CPU utilization rate more than 80% automatic restart MariaDB service, how to implement?

Please give detailed implementation methods, thank you,

CodePudding user response:

Use ps - aux can get all the processes of CPU information (column 5), the process of using awk will you want to monitor the fifth column values, and then make judgment to the value, more than 80% is executed systemctl restart mysqld. Service
Time this script can use crontab establish execution, also using a loop in a script, use of sleep time interval to achieve timing control, specific code written by yourself, or simple,

CodePudding user response:

Can include a zabbix, action set in a remote command invocation (trigger alarm, restart the database)

CodePudding user response:

Include a sysstat, using SAR + shell
  • Related