{"id":380,"date":"2010-03-22T10:06:27","date_gmt":"2010-03-22T08:06:27","guid":{"rendered":"http:\/\/code.openark.org\/forge\/?page_id=380"},"modified":"2010-09-06T10:06:16","modified_gmt":"2010-09-06T08:06:16","slug":"quick-howto","status":"publish","type":"page","link":"https:\/\/code.openark.org\/forge\/mycheckpoint\/documentation\/quick-howto","title":{"rendered":"Quick HOWTO"},"content":{"rendered":"<p>Here&#8217;s a quick HOWTO for mycheckpoint. It explains very briefly how to:<\/p>\n<ul>\n<li><a href=\"#Download\">Download<\/a><\/li>\n<li><a href=\"#Install\">Install<\/a><\/li>\n<li><a href=\"#Setup\">Setup<\/a><\/li>\n<li><a href=\"#Create a defaults file\">Create a defaults file<\/a><\/li>\n<li><a href=\"#Monitor\">Monitor<\/a><\/li>\n<li><a href=\"#Generate human reports\">Generate human reports<\/a><\/li>\n<li><a href=\"#Generate HTML reports\">Generate HTML reports<\/a><\/li>\n<li><a href=\"#Setup alert conditions\">Setup alert conditions<\/a><\/li>\n<li><a href=\"#View pending alerts\">View pending alerts<\/a><\/li>\n<li><a href=\"#custom queries\">Setup &amp; monitor custom queries<\/a><\/li>\n<li><a href=\"#Skip alerts\">Skip alerts<\/a><\/li>\n<li><a href=\"#Skip email notifications\">Skip email notifications<\/a><\/li>\n<li><a href=\"#Report a bug\">Report a bug<\/a><\/li>\n<\/ul>\n<p><a name=\"Download\"><\/a><\/p>\n<h4>Download<\/h4>\n<p>Get mycheckpoint from the <a href=\"https:\/\/code.google.com\/p\/mycheckpoint\/\">Google Code mycheckpoint project&#8217;s homepage<\/a>. Look to the right.<\/p>\n<p>Download either:<\/p>\n<ul>\n<li>deb package (Debian, Ubuntu, etc.)<\/li>\n<li>tar.gz package (python installer)<\/li>\n<li>python script file<\/li>\n<\/ul>\n<p><a href=\"http:\/\/code.openark.org\/forge\/mycheckpoint\/download\">Read more&#8230;<\/a><\/p>\n<p><a name=\"Install\"><\/a><\/p>\n<h4>Install<\/h4>\n<p>deb package:<\/p>\n<blockquote>\n<pre>sudo dpkg -i mycheckpoint-NNN-1.deb<\/pre>\n<\/blockquote>\n<p>Python installer:<\/p>\n<blockquote>\n<pre>tar xzfv mycheckpoint-NNN.tar.gz\r\ncd mycheckpoint-NNN\r\nsudo python setup.py install<\/pre>\n<\/blockquote>\n<p>Python script:<\/p>\n<blockquote>\n<pre>chmod +x mycheckpoint-NNN\r\nmv mycheckpoint-NNN \/usr\/bin\/mycheckpoint<\/pre>\n<\/blockquote>\n<p><em>mycheckpoint<\/em> requires the <a href=\"http:\/\/sourceforge.net\/projects\/mysql-python\/files\/\">MySQL-Python<\/a> driver. On Debian\/Ubuntu:<\/p>\n<blockquote>\n<pre>sudo apt-get install python-mysqldb<\/pre>\n<\/blockquote>\n<p>On RedHat\/CentOS:<\/p>\n<blockquote>\n<pre>sudo yum install MySQL-python<\/pre>\n<\/blockquote>\n<p><a href=\"http:\/\/code.openark.org\/forge\/mycheckpoint\/documentation\/installation\">Read more&#8230;<\/a><br \/>\n<a name=\"Setup\"><\/a><\/p>\n<h4>Setup<\/h4>\n<p>Each monitored node needs a schema (database) of its own. mycheckpoint must have all privileges on that schema:<\/p>\n<blockquote>\n<pre>CREATE DATABASE mycheckpoint;\r\nGRANT ALL PRIVILEGES ON mycheckpoint_host1.* TO 'mycheckpoint_user'@'localhost' IDENTIFIED BY 'some_password';<\/pre>\n<\/blockquote>\n<p>To allow mycheckpoint to monitor master status, rpelication status and processlist, also provide with:<\/p>\n<blockquote>\n<pre>GRANT SUPER, REPLICATION CLIENT, PROCESS ON *.* TO 'mychckpoint_user'@'localhost'<\/pre>\n<\/blockquote>\n<p><a name=\"Create a defaults file\"><\/a><\/p>\n<h4>Create a defaults file<\/h4>\n<p>Create a file in the following format:<\/p>\n<blockquote>\n<pre>[mycheckpoint]\r\nsmtp_host = mail.my-server-company.com\r\nsmtp_from = monitor@my-server-company.com\r\nsmtp_to = dba@my-server-company.com\r\n\r\n[client]\r\nhost=localhost\r\nsocket=\/tmp\/mysql.sock\r\nuser=root\r\npassword=\r\nport=3306<\/pre>\n<\/blockquote>\n<p>The <strong>[client]<\/strong> section follows standard MySQL notation.<\/p>\n<p>If not instructed otherwise, mycheckpoint will look for <strong>\/etc\/mycheckpoint.cnf<\/strong>. Or you can place it anywhere you like and use the <strong>&#8211;defaults-file<\/strong> option.<\/p>\n<p><a href=\"http:\/\/code.openark.org\/forge\/mycheckpoint\/documentation\/usage#defaults_file\">Read more&#8230;<\/a><br \/>\n<a name=\"Monitor\"><\/a><\/p>\n<h4>Monitor<\/h4>\n<p>Use full connection specification:<\/p>\n<blockquote>\n<pre>mycheckpoint --host=127.0.0.1 --port=3306 --user=mcp_user --password=123456 --database=mycheckpoint_host1<\/pre>\n<\/blockquote>\n<p>Use defaults file:<\/p>\n<blockquote>\n<pre>mycheckpoint <strong>--defaults-file<\/strong>=\/home\/admin\/.mycheckpoint.cnf<\/pre>\n<\/blockquote>\n<p>Write down <strong>\/etc\/mycheckpoint.cnf<\/strong>; run:<\/p>\n<blockquote>\n<pre>mycheckpoint<\/pre>\n<\/blockquote>\n<p>Monitor local host, write to central server:<\/p>\n<blockquote>\n<pre>mycheckpoint --host=centralserver --port=3306 --user=mcp_user --password=123456 --database=mycheckpoint_host1 <strong>--monitored-host<\/strong>=localhost <strong>--monitored-socket<\/strong>=\/tmp\/mysql.sock<\/pre>\n<\/blockquote>\n<p>Monitor remote hosts<\/p>\n<blockquote>\n<pre>mycheckpoint --host=myhost --port=3306 --user=mcp_user --password=123456 --database=mycheckpoint_host1 <strong>--monitored-host<\/strong>=host1 <strong>--monitored-port<\/strong>=3306<\/pre>\n<\/blockquote>\n<p>Read more&#8230; <a href=\"http:\/\/code.openark.org\/forge\/mycheckpoint\/documentation\/usage\">[1]<\/a>, <a href=\"http:\/\/code.openark.org\/forge\/mycheckpoint\/documentation\/remote-multiple-hosts\">[2]<\/a><br \/>\n<a name=\"Generate human reports\"><\/a><\/p>\n<h4>Generate human reports<\/h4>\n<p>Generate latest report:<\/p>\n<blockquote>\n<pre>mysql&gt; SELECT report FROM <strong>sv_report_human_sample<\/strong> ORDER BY <strong>id<\/strong> DESC LIMIT 1\\G<\/pre>\n<\/blockquote>\n<p>Show hourly report in given time range:<\/p>\n<blockquote>\n<pre>mysql&gt; SELECT report FROM <strong>sv_report_human_hour<\/strong> WHERE <strong>ts<\/strong> BETWEEN '2010-03-17 10:00:00' AND '2010-03-17 14:00:00';<\/pre>\n<\/blockquote>\n<p><a href=\"http:\/\/code.openark.org\/forge\/mycheckpoint\/documentation\/generating-human-reports\">Read more&#8230;<\/a><br \/>\n<a name=\"Generate HTML reports\"><\/a><\/p>\n<h4>Generate HTML reports<\/h4>\n<p>From within MySQL<\/p>\n<blockquote>\n<pre>mysql&gt; SELECT <strong>html<\/strong> FROM <strong>sv_report_html_brief<\/strong>;\r\nmysql&gt; SELECT <strong>html<\/strong> FROM <strong>sv_report_html<\/strong>;\r\nmysql&gt; SELECT <strong>html<\/strong> FROM <strong>sv_report_html_24_7<\/strong>;\r\nmysql&gt; SELECT <strong>html<\/strong> FROM <strong>sv_custom_html_brief<\/strong>;\r\n<\/pre>\n<\/blockquote>\n<p>Using mysql command line client (you may need to supply your mysql login\/password to execute):<\/p>\n<blockquote>\n<pre>mysql mycheckpoint <strong>--silent<\/strong> <strong>--raw<\/strong> <strong>--execute<\/strong>=\"SELECT html FROM <strong>sv_report_html_brief<\/strong>\" &gt; \/tmp\/mycheckpoint_brief_report.html\r\nfirefox \/tmp\/mycheckpoint_brief_report.html\r\n\r\nmysql mycheckpoint --silent --raw --execute=\"SELECT html FROM sv_report_html_brief\" &gt; \/var\/www\/mycheckpoint_brief_report.html<\/pre>\n<\/blockquote>\n<p>Sending by email:<\/p>\n<blockquote>\n<pre>mycheckpoint --defaults-file=\/etc\/mycheckpoint.cnf <strong>email_brief_report<\/strong><\/pre>\n<\/blockquote>\n<p>or<\/p>\n<blockquote>\n<pre>mycheckpoint --defaults-file=\/etc\/mycheckpoint.cnf <strong>--smtp-from<\/strong>=monitor@my-server-company.com <strong>--smtp-to<\/strong>=dba@my-server-company.com <strong>--smtp-host<\/strong>=mail.my-server-company.com <strong>email_brief_report<\/strong><\/pre>\n<\/blockquote>\n<p><a href=\"http:\/\/code.openark.org\/forge\/mycheckpoint\/documentation\/generating-html-reports\">Read more&#8230;<\/a><br \/>\n<a name=\"Setup alert conditions\"><\/a><\/p>\n<h4>Setup alert conditions<\/h4>\n<blockquote>\n<pre>mysql&gt; INSERT INTO <strong>alert_condition<\/strong> (condition_eval, description, alert_delay_minutes)\r\n         VALUES ('seconds_behind_master &gt; 60', 'Slave lags too far behind', 10);\r\n\r\nmysql&gt; INSERT INTO <strong>alert_condition<\/strong> (condition_eval, description, alert_delay_minutes)\r\n         VALUES ('(seconds_behind_master &gt; 300) AND (HOUR(ts) NOT BETWEEN 2 AND 4)', 'Slave lags too far behind', 0);\r\n\r\nmysql&gt; INSERT INTO <strong>alert_condition<\/strong> (condition_eval, description, alert_delay_minutes)\r\n         VALUES ('os_datadir_mountpoint_usage_percent &gt; 90', 'datadir mount point is over 90%', 30);<\/pre>\n<\/blockquote>\n<p><a href=\"http:\/\/code.openark.org\/forge\/mycheckpoint\/documentation\/alerts\">Read more&#8230;<\/a><br \/>\n<a name=\"View pending alerts\"><\/a><\/p>\n<h4>View pending alerts<\/h4>\n<blockquote>\n<pre>mysql&gt; SELECT * FROM <strong>alert_pending_view<\/strong>;<\/pre>\n<\/blockquote>\n<p>Or, generate HTML report:<\/p>\n<blockquote>\n<pre>mysql&gt; SELECT html FROM <strong>alert_pending_html_view<\/strong> \\G<\/pre>\n<\/blockquote>\n<p>Same, from command line:<\/p>\n<blockquote>\n<pre>mysql --defaults-file=\/etc\/mycheckpoint.cnf <strong>--silent<\/strong> <strong>--raw<\/strong> <strong>--execute<\/strong>=\"SELECT html FROM alert_pending_html_view\" &gt; \/tmp\/mycheckpoint_pending_alerts.html &amp;&amp; firefox \/tmp\/mycheckpoint_pending_alerts.html<\/pre>\n<\/blockquote>\n<p><a href=\"http:\/\/code.openark.org\/forge\/mycheckpoint\/documentation\/alerts\">Read more&#8230;<\/a><br \/>\n<a name=\"custom queries\"><\/a><\/p>\n<h4>Setup &amp; monitor custom queries<\/h4>\n<p>Create a new custom query:<\/p>\n<blockquote>\n<pre>INSERT INTO\r\n <strong>custom_query<\/strong> (custom_query_id, enabled, query_eval, description, chart_type, chart_order)\r\n VALUES (0, 1, 'SELECT COUNT(*) FROM store.shopping_cart WHERE is_pending=1', 'Number of pending carts', 'value', 0);<\/pre>\n<\/blockquote>\n<p>Read custom values:<\/p>\n<blockquote>\n<pre>SELECT id, ts, created_tmp_tables_psec, <strong>custom_0<\/strong>, <strong>custom_0_time<\/strong>, <strong>custom_1_psec<\/strong> FROM sv_sample WHERE ts &gt;= NOW() - INTERVAL 1 HOUR;\r\n<\/pre>\n<\/blockquote>\n<p>Get chart for custom values:<\/p>\n<blockquote>\n<pre>SELECT <strong>custom_1_psec<\/strong> FROM sv_report_chart_sample\\G\r\n<\/pre>\n<\/blockquote>\n<p>Generate HTML report for custom values:<\/p>\n<blockquote>\n<pre>SELECT <strong>html<\/strong> FROM <strong>sv_custom_html_brief<\/strong>;\r\nSELECT <strong>html<\/strong> FROM <strong>sv_custom_html<\/strong>;\r\n<\/pre>\n<\/blockquote>\n<p><a href=\"..\/mycheckpoint\/documentation\/custom-monitoring\">Read more&#8230;<\/a><\/p>\n<h4>Skip alerts<\/h4>\n<p>Execute:<\/p>\n<blockquote>\n<pre> mycheckpoint --skip-alerts<\/pre>\n<\/blockquote>\n<p><a name=\"Skip email notifications\"><\/a><\/p>\n<h4>Skip email notifications<\/h4>\n<p>Execute:<\/p>\n<blockquote>\n<pre> mycheckpoint --skip-emails<\/pre>\n<\/blockquote>\n<p><a name=\"Report a bug\"><\/a><\/p>\n<h4>Report a bug<\/h4>\n<p>mycheckpoint is hosted on Google Code. Please report bugs on the <a href=\"https:\/\/code.google.com\/p\/mycheckpoint\/issues\/list\">Issues page<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a quick HOWTO for mycheckpoint. It explains very briefly how to: Download Install Setup Create a defaults file Monitor Generate human reports Generate HTML reports Setup alert conditions View pending alerts Setup &amp; monitor custom queries Skip alerts Skip email notifications Report a bug Download Get mycheckpoint from the Google Code mycheckpoint project&#8217;s homepage. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":147,"menu_order":-15,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-380","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/code.openark.org\/forge\/wp-json\/wp\/v2\/pages\/380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code.openark.org\/forge\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/code.openark.org\/forge\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/code.openark.org\/forge\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/code.openark.org\/forge\/wp-json\/wp\/v2\/comments?post=380"}],"version-history":[{"count":28,"href":"https:\/\/code.openark.org\/forge\/wp-json\/wp\/v2\/pages\/380\/revisions"}],"predecessor-version":[{"id":582,"href":"https:\/\/code.openark.org\/forge\/wp-json\/wp\/v2\/pages\/380\/revisions\/582"}],"up":[{"embeddable":true,"href":"https:\/\/code.openark.org\/forge\/wp-json\/wp\/v2\/pages\/147"}],"wp:attachment":[{"href":"https:\/\/code.openark.org\/forge\/wp-json\/wp\/v2\/media?parent=380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}