標籤:
mycheckpoint 是針對mysql的一個效能監控、指標採集的python寫成的工具。
工作原理說明:
mycheckpoint是一段指令碼,通過將其設定為crontab定時任務,每幾分鐘採集一次資料(受限於crontab只能是分鐘為基本單位)儲存在自己的資料庫中,並可以將採集的資料進行統計,以web頁面的形式展現出來。
樣本效果:
詳細請參見:http://code.openark.org/forge/mycheckpoint
使用步驟:
0. 下載:
wget https://mycheckpoint.googlecode.com/files/mycheckpoint-231.tar.gz
1. 為mycheckpoint建立資料庫
CREATE DATABASE mycheckpoint;
2. 授權給當前登入mysql的使用者
GRANT ALL PRIVILEGES ON mycheckpoint.* TO ‘root‘@‘localhost‘ IDENTIFIED BY ‘xxxx‘;
3. 建立mycheckpoint需要的資料庫表。
mycheckpoint --host=127.0.0.1 --port=3306 --user=root --password=xxxx --socket=/mysql/tmp/mysql.sock --database=mycheckpoint
進過這一個步驟之後,會在名為:mycheckpoint資料庫中,產生以下資料表。
+------------------------------------+| Tables_in_mycheckpoint |+------------------------------------+| alert || alert_condition || alert_condition_query_view || alert_email_message_items_view || alert_pending || alert_pending_html_view || alert_pending_view || alert_view || charts_api || custom_query || custom_query_top_navigation_view || custom_query_view || html_components || metadata || numbers || status_variables || status_variables_aggregated_day || status_variables_aggregated_hour || sv_custom_chart_day || sv_custom_chart_flattened_day || sv_custom_chart_flattened_hour || sv_custom_chart_flattened_sample || sv_custom_chart_hour || sv_custom_chart_sample || sv_custom_html || sv_custom_html_brief || sv_day || sv_diff || sv_hour || sv_latest || sv_param_change || sv_parameter_change_union || sv_report_24_7 || sv_report_24_7_minmax || sv_report_chart_24_7 || sv_report_chart_day || sv_report_chart_day_labels || sv_report_chart_day_timeseries || sv_report_chart_hour || sv_report_chart_hour_labels || sv_report_chart_hour_timeseries || sv_report_chart_sample || sv_report_chart_sample_labels || sv_report_chart_sample_timeseries || sv_report_day || sv_report_day_recent || sv_report_day_recent_minmax || sv_report_hour || sv_report_hour_recent || sv_report_hour_recent_minmax || sv_report_html || sv_report_html_24_7 || sv_report_html_brief || sv_report_human_day || sv_report_human_hour || sv_report_human_sample || sv_report_sample || sv_report_sample_recent || sv_report_sample_recent_aggregated || sv_report_sample_recent_minmax || sv_sample |+------------------------------------+
如果意外將你的web app 的DB指定成了log資料庫,則會在你的web app DB中加入以上資料表,並將原web app DB中重名的資料表刪除。這將是災難性的!
4. http方式查看結果:
mycheckpoint --host=127.0.0.1 --port=3306 --user=root --password=xxxx --socket=/mysql/tmp/mysql.sock --database=mycheckpoint http
指定資料庫時需注意,切莫使用你的web app 的DB.
一個小時之後就可以開啟本地的http://localhost:12306/mycheckpoint 查看報表。
點評:
這個工具的優勢是能將資料統計結果以web形式展現,但是由於其依賴crontab,導致資料擷取間隔過大,不能很好的描述mysql的健全狀態, 另外,此工具已經於2014年4月停止更新。
其它的mysql第三方工具還有: percona-toolkit 以及 tuning-primer.sh 等。
參考:
1. http://code.openark.org/forge/mycheckpoint
2. https://code.google.com/p/mycheckpoint/downloads/list
3.
mysql效能監控工具:mycheckpoint的使用方法