Setting up additional monitoring tools: top, iotop, Apache and MySQL process lists, iostat

Post Reply
User avatar
isscbta
Team Member
Posts: 137
Joined: Mon Jul 19, 2021 1:41 am
Has thanked: 17 times
Been thanked: 3 times

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
  • 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.
Instructions

Create a directory for MySQL logs:

Code: Select all

mkdir /root/mysql-logs
Download the MySQL process list monitoring script:

Code: Select all

wget -nv http://dl.myvestacp.com/vesta/see-mysql-processlist.sh -O /root/see-mysql-processlist.sh
Make the script executable:

Code: Select all

chmod u+x /root/see-mysql-processlist.sh
Download the Apache process list monitoring script:

Code: Select all

wget -nv http://dl.myvestacp.com/vesta/see-apache-processlist.sh -O /root/see-apache-processlist.sh
Make the script executable:

Code: Select all

chmod u+x /root/see-apache-processlist.sh
Set up a cron job to run the MySQL process list script every minute and log the output:

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 -
Set up a cron job to run the Apache process list script every minute and log the output:

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 -
Set up a cron job to delete logs older than one day, running daily at 4:05 AM:

Code: Select all

crontab -l | { cat; echo ‘5 4 * * * find /root/mysql-logs/ -mtime +1 -delete’; } | crontab -
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.
Post Reply