Setting up additional monitoring tools: top, iotop, Apache and MySQL process lists, iostat
Posted: Wed Nov 27, 2024 4:34 pm
This guide provides step-by-step instructions to set up additional monitoring tools on your server, including top, iotop, Apache process list, MySQL process list, and iostat.
Overview
Create a directory for MySQL logs:
Download the MySQL process list monitoring script:
Make the script executable:
Download the Apache process list monitoring script:
Make the script executable:
Set up a cron job to run the MySQL process list script every minute and log the output:
Set up a cron job to run the Apache process list script every minute and log the output:
Set up a cron job to delete logs older than one day, running daily at 4:05 AM:
By following these steps, you will have additional monitoring tools set up to track the performance and processes of your server, helping you to diagnose issues and maintain optimal performance.
Overview
- top: Displays real-time system summary information and a list of processes or threads currently being managed by the Linux kernel.
- iotop: Monitors disk I/O usage information output by the Linux kernel.
- Apache process list: Monitors the processes of the Apache web server.
- MySQL process list: Monitors the processes of the MySQL database server.
- iostat: Reports CPU statistics and input/output statistics for devices and partitions.
Create a directory for MySQL logs:
Code: Select all
mkdir /root/mysql-logs
Code: Select all
wget -nv http://dl.myvestacp.com/vesta/see-mysql-processlist.sh -O /root/see-mysql-processlist.sh
Code: Select all
chmod u+x /root/see-mysql-processlist.sh
Code: Select all
wget -nv http://dl.myvestacp.com/vesta/see-apache-processlist.sh -O /root/see-apache-processlist.sh
Code: Select all
chmod u+x /root/see-apache-processlist.sh
Code: Select all
crontab -l | { cat; echo '* * * * * /root/see-mysql-processlist.sh > /root/mysql-logs/mysql-`date +\%Y-\%m-\%d-\%H-\%M-\%S`-cron.log 2>&1'; } | crontab -
Code: Select all
crontab -l | { cat; echo '* * * * * /root/see-apache-processlist.sh > /root/mysql-logs/apache-`date +\%Y-\%m-\%d-\%H-\%M-\%S`-cron.html 2>&1'; } | crontab -
Code: Select all
crontab -l | { cat; echo '5 4 * * * find /root/mysql-logs/ -mtime +1 -delete'; } | crontab -