1. Monitoring and collection basis: mainly based on show global status to collect data:
2. Authorize the user, and then use show global status for collection and analysis.
mysql -uroot -p "xxxx" -e "show global status" ###View all values
Item Notes:
Aborted_clients ##Clients cannot connect normally, the number of failed connections.
Aborted_connects ##Number of client interruptions, possibly malicious connections.
###Throughput
Bytes_received ##Number of bytes received from all clients.
Bytes_sent ##Number of bytes sent to all clients.
###com admin statement execution number
Com_commit ##Count the number of commit statements
com_delete ##Statistical delete statement
com_delete_multi ##minimum
com_insert ##Statistical insert statement
com_rollback ##Transaction rollback
Connections ##Regardless of whether the number of successful connections to mysql
###Number of temporary tables
Created_tmp_disk_tables ##Number of temporary tables created by the server
Created_tmp_files ##Number of temporary files that have been created
Created_tmp_tables ##Number of in-memory temporary tables automatically created when the server executes the statement. If Created_tmp_disk_tables is large, you may want to increase the tmp_table_size value to make the temporary table memory-based rather than disk-based.
##The number of pages read to the Innodb buffer pool by the background read-ahead thread
Innodb_buffer_pool_reads ##The number of logical reads in the buffer pool that InnoDB must read on a single page cannot be satisfied.
Innodb_buffer_pool_read_ahead ##Number of read ahead
Innodb_buffer_pool_read_requests ##Number of pages read from the buffer pool
* buffer pool hit ratio =
innodb_buffer_pool_read_requests/(innodb_buffer_pool_read_requests+innodb_buffer_pool_read_ahead+innodb_buffer_pool_reads)
innodb_data_read The total number of bytes read;
innodb_data_reads The number of times a read request was initiated, and each read may require reading multiple pages.
* Average bytes per read = innodb_data_read/innodb_data_reads
Innodb_rows_deleted ##The number of times the delete operation is performed
Innodb_rows_inserted ##The number of times the insert operation is performed
Innodb_rows_read ##The number of times to perform select operations
Innodb_rows_updated ##The number of times the update operation is performed
###For MyISAM engine:
key_buffer_size ##Buffer pool size
Key_blocks_unused ##Number of unused cache clusters (blocks)
Key_blocks_used ##Indicates the largest number of blocks ever used
* This server, all the caches are used, either increase the key_buffer_size, or the transition index, which fills the cache, ideal settings:
Key_blocks_used / (Key_blocks_unused + Key_blocks_used) * 100% ≈ 80%
Key_reads ##Read index directly from hard disk not found in memory
Key_read_requests ##Total index requests
* Calculate the probability that the index is not named:
key_cache_miss_rate = Key_reads / Key_read_requests * 100%
###Qcache query buffer:
Qcache_free_blocks ##How many remaining blocks are currently in the Query Cache
Qcache_free_memory ##Query Cache remaining memory size
Qcache_hits ## How many hits
Qcache_inserts ## How many missed inserts: Qcache_hits / ( Qcache_hits + Qcache_inserts )
Qcache_lowmem_prunes ##How many queries are cleared out of the Query Cache due to insufficient memory
Qcache_not_cached ##Because of the setting of query_cache_type or the number of Query that cannot be cached;
Qcache_queries_in_cache ##The number of queries in the cache in the current Query Cache
Slow_queries ##Slow query
Sort_range ##The total number of sorting done by range scan
Sort_rows ##Sort the total number of rows
Sort_scan ##The total number of times of sorting done by scanning
Table_locks_immediate ##Number of queries that can acquire locks immediately.
Table_locks_waited ##Number of queries that cannot obtain locks immediately.
Uptime ##mysql runtime
Three, zabbix agnet custom key:
UserParameter=mysql[*],mysql -uroot -pxxx -e "show global status"|grep "$1" | cut -f2
Mysql[Uptime]
Grep uptime | cut -f2
Myslq[Table_locks_waited]
Note: Through the value returned by key, $1 filters out the value we want.
The content of this article comes from personal learning essays, refer to the course material of "Zabbix 3.0 Introduction to Production Environment Application Practice"
http://www.roncoo.com/course/view/fb3050a5b34b42f39ccad83ebebc89c1