용도
DBA 업무를 하다보면 db 상태라든지 점검을 위한 sql 문들을 많이들 갖고 있을 텐데 필요한 순간마다 매번 찾아서 쿼리 실행기(mysql cli 나 기타 gui tool등) 를 통해서 copy 후 실행하는 방식은 좀 불편하였다.
이를 간편하게 하기 위해서 평소 활용도가 높거나 유용한 쿼리들을 번호만 입력하면 쉽게 실행할 수 있고 Enter 키만 치면 반복해서 실행하도록 하는 shell script 를 작성하였다.
본인들이 소장하고 있는 쿼리문을 shell script 에 계속 추가해 나갈 수 있다.
실행방법
$ sh mymon.sh
실행 화면

서브메뉴 실행화면

소스 다운로드
https://github.com/bsshin71/mymon
GitHub - bsshin71/mymon: shell script for monitoring MySQL
shell script for monitoring MySQL. Contribute to bsshin71/mymon development by creating an account on GitHub.
github.com
지원 기능 상세
기능대분류 | 메뉴명 | 호출 sql파일 | 기능 | 비고 |
1.GENERAL | 11 - Instance/Database Info | 1_instance.sql |
|
|
12 - Parameter Info (innodb buffer) | 1_parameters.sql |
|
||
13 - Memory Usage by each module | 1_memoryusage.sql |
|
||
2.Cache & Latch | 21 - Buffer Hit Ratio | 2_bufferhitratio.sql |
|
|
3.SESSION | 31 - Current Session Info | 3_current_session.sql |
|
|
32 - Current Running Session Info | 3_run_session.sql |
|
||
33 - Current Wait Session Info | 3_wait_session.sql |
|
||
34 - Running Session SQL Info | 3_run_session_sql.sql |
|
||
4.LOCK | 41 - Current Transaction | 4_current_transaction.sql |
|
|
42 - Current Lock status of Grant and Wait | 4_lock_grant_wait.sql |
|
||
43 - Waiting commit session info | 4_waiting_commit_session.sql |
|
sys.session 의 trx_state가 'ACTIVE' 인 세션정보 | |
44 - Waiting commit Transaction info (require time) | 4_waiting_commit_transaction.sql |
|
지정시간 입력값 필요 | |
45 - Meta Locking Session Info | 4_meta_lock_session.sql |
|
||
46 - Waiting Session by table lock | 4_wait_session_by_tablelock.sql |
|
||
47 - All Lock Wait stat by table (sort by avg) | 4_all_lockwait_stat_by_table_sortby_avg.sql |
|
||
48 - All Lock Wait stat by table (sort by sum) | 4_all_lockwait_stat_by_table_sortby_sum.sql |
|
||
49 - Write Lock Wait stat by table (sort by avg) | 4_write_lockwait_stat_by_table_sortby_avg.sql |
|
||
491 - Write Lock Wait stat by table (sort by sum) | 4_write_lockwait_stat_by_table_sortby_sum.sql |
|
||
5.Wait Event | 51 - Most time used Wait Event by AvgTime | 5_most_timeused_waitevent_avg.sql |
|
|
52 - Most time used Wait Event by SumTime | 5_most_timeused_waitevent_sum.sql |
|
||
53 - Most time used Wait Event by MaxTime | 5_most_timeused_waitevent_max.sql |
|
||
6.I/O | 61 - Event I/O by avg WaitTime | 6_fileio_by_eventname_avg.sql |
|
디스크 병목시 원인 추적시 활용 |
62 - Event I/O by sum WaitTime | 6_fileio_by_eventname_sum.sql |
|
||
63 - File I/O by avg WaitTime | 6_fileio_by_instance_avg.sql |
|
||
64 - File I/O by sum WaitTime | 6_fileio_by_instance_sum.sql |
|
||
65 - Table I/O by avg WaitTime | 6_tableio_by_table_avg.sql |
|
||
66 - Table I/O by sum WaitTime | 6_tableio_by_table_sum.sql |
|
||
67 - Index I/O by avg WaitTime | 6_indexio_by_index_avg.sql |
|
||
68 - Index I/O by sum WaitTime | 6_indexio_by_index_sum.sql |
|
||
7.DML statistics | 71 - Top slow query-digest by avg of exec time | 7_topslow_query_digest_by_avg.sql |
|
|
72 - Top slow query-digest by sum of exec time | 7_topslow_query_digest_by_sum.sql |
|
||
73 - Top slow query history by duration | 7_topslow_queryhistory_by_duration.sql |
|
||
74 - Most executed query | 7_most_exec_query.sql |
|
||
75 - Most row examined query | 7_most_row_examined_query.sql |
|
||
8. Space & Usage | 81 - Database Usage | 8_database_usage.sql |
|
|
82 - Top table Usage | 8_top_table_usage.sql |
|
||
83 - Top index Usage | 8_top_index_usage.sql |
|
||
84 - Top partition table Usage | 8_top_partition_table_usage.sql |
|
||
85 - Redo dir Disk Usage ( only possible local) | 8_redolog_dir.sql sub-script:disk_usage.sh |
|
||
86 - Datafile dir Disk Usage ( only possible local) | 8_datafile_dir.sql sub-script:disk_usage.sh |
|
||
87 - Temp dir Disk Usage ( only possible local) | 8_tmp_dir.sql sub-script:disk_usage.sh |
|
||
9. Replication | 91 - Connected Slave hosts | 9_connected_slave_hosts.sql |
|
|
92 - Master Server info | 9_master_server_info.sql |
|
||
93 - Show slave status | 9_show_slave_status.sql sub-script:slave_status.sh |
|
||
94 - Replication Lag (auto repeat) | 9_show_slave_status.sql sub-script:show_delta.sh |
|
||
10. Status | 101 - Thread status | 10_thread_status.sql |
|
|
102 - Replication status | 10_replication_status.sql |
|
||
103 - DML execution status (auto repeat) | 10_dml_execution_status.sql sub-script:show_multi_delta.sh |
|
||
20. Plan & Index | 201 - Unused Index | 20_unused_index_status.sql |
|
|
202 - Tables with full table scan | 20_tables_with_fullscan.sql |
|
||
203 - Statement with full table scan | 20_statement_with_fullscan.sql |
|
||
30. Performance_schema Configuration | 301. Show Performance_schema variable | 30_perf_variables.sql |
|
|
302. Show Performacne_schema setup_consumer | 30_perf_setup_consumer.sql |
|
||
303. Enable Performance_schema support statement history_long | 30_enable_history_long.sql |
|
||
304. Disable Performance_schema support statement history_long | 30_disable_history_long.sql |
|
||
305. flush status (=reset status ) | 30_flush_status.sql |
|
||
306. Truncate all performance_schema table( reset all) | 30_ps_truncate_all_table.sql |
|