Hi Team,
Please help me to fetch below details from MySQL perspective (probably from information_schema, performance_schema or sys databases). This functionality is available in SQL.
Please note that MySQL instances are running in Linux platform.
- CPU utilization %
- CPU utilization against each query
- Total memory of Server and allocated memory for MySQL
- Total CPU Core of Server
- Disk utilization, at least for data directory partition
Required the customized query for fetching these details directly from MySQL, not recommended to explore PMM for this.
Thanks,
Sujith VG.
- Not available in MySQL using SQL (metric does not exist in mysql)
- Not available in MySQL using SQL (metric does not exist in mysql)
- Not available in MySQL using SQL (memory info is found in /proc and not accessible by MySQL)
- Not available in MySQL using SQL (this information is found in /proc/cpuinfo which is not accessible by MySQL)
- Overall dataset size can be calculated as follows:
SELECT CONCAT(ROUND(SUM(data_length) / (1024*1024*1024),2),'G') Data_Size,
CONCAT(ROUND(SUM(index_length)/ (1024*1024*1024),2),'G') Index_Size,
CONCAT(ROUND((sum(data_length)+sum(index_length))/(1024*1024*1024), 2),'G') Total_Size
FROM information_schema.TABLES
WHERE TABLE_SCHEMA NOT IN ('information_schema', 'performance_schema', 'sys')
GROUP BY NULL
but that does not equal amount of space taken on disk. You need to add data_free
to the calculation because files on disk can contain empty, free space.
If you’re using Percona MySQL, check out the ProcFS plugin which will allow you to query the /proc filesystem.