{"id":957,"date":"2011-04-10T18:28:20","date_gmt":"2011-04-10T09:28:20","guid":{"rendered":"http:\/\/blog.isnext.net\/issy\/?p=957"},"modified":"2011-04-10T18:35:38","modified_gmt":"2011-04-10T09:35:38","slug":"munin%e3%81%a7%e8%a4%87%e6%95%b0mysqld%e3%82%92%e7%9b%a3%e8%a6%96%e3%81%99%e3%82%8b%e8%a8%ad%e5%ae%9a%e3%83%a1%e3%83%a2","status":"publish","type":"post","link":"https:\/\/blog.isnext.net\/issy\/archives\/957","title":{"rendered":"munin\u3067\u8907\u6570mysqld\u3092\u76e3\u8996\u3059\u308b\u8a2d\u5b9a\u30e1\u30e2"},"content":{"rendered":"<p><strong>\u25a0munin\u3067\u8907\u6570mysqld\u3092\u76e3\u8996\u3059\u308b\u8a2d\u5b9a\u30e1\u30e2<\/strong><br \/>\n\u3000CentOS\u74b0\u5883\u3067\u540c\u4e00\u30db\u30b9\u30c8\u5185\u306b\u8a2d\u5b9a\u3055\u308c\u305f\u8907\u6570mysqld\u81ea\u4f53\u3084\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30a4\u30ba\u306e\u76e3\u8996\u3092munin\u3067\u884c\u3046\u8a2d\u5b9a\u306e\u30e1\u30e2\u3002epel\u30ea\u30dd\u30b8\u30c8\u30ea\u304c\u5fc5\u8981\u3002munin\u8a2d\u5b9a\u304c\u3067\u304d\u3066\u3044\u308b\u524d\u63d0\u3002\u8907\u6570mysqld\u306e\u8d77\u52d5\u8a2d\u5b9a\u30e1\u30e2\u306f<a href=\"https:\/\/blog.isnext.net\/issy\/archives\/79\">\u3053\u3061\u3089<\/a>\u3002<\/p>\n<p><strong>\u25a0\u8907\u6570mysqld\u81ea\u4f53\u306e\u76e3\u8996<\/strong><\/p>\n<p><strong>\uff11\uff09\u5fc5\u8981\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/strong><br \/>\n# yum install perl-Cache perl-Cache-Cache perl-DBD-MySQL<\/p>\n<p><strong>\uff12\uff09\u76e3\u8996\u30d5\u30a1\u30a4\u30eb\u304c\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u53c2\u7167<\/strong><br \/>\n\/usr\/share\/munin\/plugins\/mysql_\u3000\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u5229\u7528\u3059\u308b<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u51fa\u3066\u304d\u305f\u30ea\u30b9\u30c8\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u53d6\u5f97\u53ef\u80fd<\/p>\n<p># \/usr\/share\/munin\/plugins\/mysql_ suggest<br \/>\nmysql_bin_relay_log<br \/>\nmysql_commands<br \/>\nmysql_connections<br \/>\nmysql_files_tables<br \/>\nmysql_innodb_bpool<br \/>\nmysql_innodb_bpool_act<br \/>\nmysql_innodb_insert_buf<br \/>\nmysql_innodb_io<br \/>\nmysql_innodb_io_pend<br \/>\nmysql_innodb_log<br \/>\nmysql_innodb_rows<br \/>\nmysql_innodb_semaphores<br \/>\nmysql_innodb_tnx<br \/>\nmysql_myisam_indexes<br \/>\nmysql_network_traffic<br \/>\nmysql_qcache<br \/>\nmysql_qcache_mem<br \/>\nmysql_replication<br \/>\nmysql_select_types<br \/>\nmysql_slow<br \/>\nmysql_sorts<br \/>\nmysql_table_locks<br \/>\nmysql_tmp_tables<\/p>\n<p><strong>\uff13\uff09\u8907\u6570mysqld\u306e\u5206\u3092\u30b3\u30d4\u30fc\u3067\u4f5c\u6210\u3057\u5fc5\u8981\u306a\u7de8\u96c6\u3092\u884c\u3046<\/strong><\/p>\n<p># cp \/usr\/share\/munin\/plugins\/mysql_ \/usr\/share\/munin\/plugins\/mysql01_<br \/>\n# vi \/usr\/share\/munin\/plugins\/mysql01_<\/p>\n<p>132\u884c\u76ee\u304b\u3089\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3092\u6307\u5b9a<br \/>\nmy %config = (<br \/>\n&#8216;dsn&#8217; => $ENV{&#8216;mysqlconnection&#8217;} || &#8216;DBI:mysql:mysql;host=localhost;mysql_socket=\/path\/to\/mysql01\/mysql.sock&#8217;,<br \/>\n&#8216;user&#8217; => $ENV{&#8216;mysqluser&#8217;} || &#8216;dbuser&#8217;,<br \/>\n&#8216;password&#8217; => $ENV{&#8216;mysqlpassword&#8217;} || &#8216;password&#8217;,<br \/>\n);<\/p>\n<p>145\u884c\u76ee\u3067\u30ad\u30e3\u30c3\u30b7\u30e5\u30cd\u30fc\u30e0\u3092\u6307\u5b9a<br \/>\n&#8216;namespace&#8217; => &#8216;munin_mysql01&#8217;,<\/p>\n<p>690\u884c\u76ee\u3067\u63a5\u982d\u5024\u3092\u6307\u5b9a<br \/>\nmy $graph = substr(basename($0), length(&#8216;mysql01_&#8217;));<\/p>\n<p>814\u884c\u76ee\u3067munin\u4e0a\u3067\u8868\u793a\u3059\u308b\u30ab\u30c6\u30b4\u30ea\u540d\u3092\u6307\u5b9a<br \/>\nprint &#8220;graph_category mysql01\\n&#8221;;<\/p>\n<p>\u3053\u308c\u3092mysqld\u306e\u6570\u3060\u3051\u5024\u3092\u5909\u3048\u3066\u4f5c\u6210<\/p>\n<p><strong>\uff14\uff09\u76e3\u8996\u3057\u305f\u3044\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30ea\u30f3\u30af\u3092\u8cbc\u308b<\/strong><\/p>\n<p># cd \/etc\/munin\/plugins\/<br \/>\n# ln -s \/usr\/share\/munin\/plugins\/mysql01_ mysql01_commands<br \/>\n# ln -s \/usr\/share\/munin\/plugins\/mysql01_ mysql01_qcache<br \/>\n# ln -s \/usr\/share\/munin\/plugins\/mysql01_ mysql01_qcache_mem<br \/>\n# ln -s \/usr\/share\/munin\/plugins\/mysql01_ mysql01_slow<\/p>\n<p><strong>\uff15\uff09\u5024\u304c\u53d6\u5f97\u3067\u304d\u3066\u3044\u308b\u304b\u78ba\u8a8d<\/strong><br \/>\n\u3053\u3053\u3067\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3044\u308b\u3088\u3046\u3060\u3068\u8a2d\u5b9a\u306b\u30df\u30b9\u304c\u3042\u308b<\/p>\n<p># \/usr\/sbin\/munin-run &#8211;servicedir \/etc\/munin\/plugins mysql01_commands<br \/>\n# \/usr\/sbin\/munin-run &#8211;servicedir \/etc\/munin\/plugins mysql01_qcache<br \/>\n# \/usr\/sbin\/munin-run &#8211;servicedir \/etc\/munin\/plugins mysql01_qcache_mem<br \/>\n# \/usr\/sbin\/munin-run &#8211;servicedir \/etc\/munin\/plugins mysql01_slow<\/p>\n<p><strong>\u25a0\u8907\u6570mysqld\u5185\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30a4\u30ba\u3092\u76e3\u8996<\/strong><\/p>\n<p><strong>\uff11\uff09\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u5165\u624b\u3057\u3066\u8a2d\u7f6e\u3059\u308b<\/strong><br \/>\nhttp:\/\/exchange.munin-monitoring.org\/plugins\/mysql_size_\/details\u3000\u304b\u3089\u30d7\u30e9\u30b0\u30a4\u30f3\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<br \/>\n\/usr\/share\/munin\/plugins\/\u3000\u306bmysql01_size_ \u7b49\u756a\u53f7\u3092\u4ed8\u3051\u3066\u5fc5\u8981\u5206\u914d\u7f6e\u3059\u308b<\/p>\n<p>42\u884c\u76ee<br \/>\nunless ($0 =~ \/mysql_size(?:_([^_]+)|)_(.+)\\s*$\/)<\/p>\n<p>48\u884c\u76ee<br \/>\nmy $MYSQLADMIN = $ENV{mysqladmin} || &#8220;mysql&#8221;;<\/p>\n<p>\u3092\u8a2d\u5b9a\u3084\u74b0\u5883\u306b\u5408\u308f\u305b\u3066\u4fee\u6b63<br \/>\n\u4f8b\u3048\u3070<\/p>\n<p>unless ($0 =~ \/mysql01_size(?:_([^_]+)|)_(.+)\\s*$\/)<br \/>\nmy $MYSQLADMIN = &#8220;\/usr\/bin\/mysql&#8221;;<\/p>\n<p><strong>\uff12\uff09munin-node\u306b\u5fc5\u8981\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u8a2d\u5b9a\u3059\u308b<\/strong><\/p>\n<p># vi \/etc\/munin\/plugin-conf.d\/munin-node<\/p>\n<p>[mysql01_*]<br \/>\nenv.mysqlopts -uroot -ppassword &#8211;socket=\/path\/to\/mysql01\/mysql.sockk<br \/>\nenv.mysqladmin \/usr\/bin\/mysqladmin<\/p>\n<p>[mysql02_*]<br \/>\nenv.mysqlopts -uroot -ppassword &#8211;socket=\/path\/to\/mysql02\/mysql.sock<br \/>\nenv.mysqladmin \/usr\/bin\/mysqladmin<\/p>\n<p>\u306a\u3069<\/p>\n<p><strong>\uff13\uff09\u76e3\u8996\u3057\u305f\u3044DB\u306e\u30ea\u30f3\u30af\u3092\u8a2d\u5b9a\u3059\u308b<\/strong><\/p>\n<p># cd \/etc\/munin\/plugins\/<br \/>\n# ln -s \/usr\/share\/munin\/plugins\/mysql01_size_ mysql01_size_dbname01<br \/>\n# ln -s \/usr\/share\/munin\/plugins\/mysql01_size_ mysql01_size_dbname02<br \/>\n# ln -s \/usr\/share\/munin\/plugins\/mysql02_size_ mysql02_size_dbname03<\/p>\n<p><strong>\uff14\uff09\u5024\u304c\u53d6\u5f97\u3067\u304d\u3066\u3044\u308b\u304b\u78ba\u8a8d<\/strong><br \/>\n\u3053\u3053\u3067\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3044\u308b\u3088\u3046\u3060\u3068\u8a2d\u5b9a\u306b\u30df\u30b9\u304c\u3042\u308b<\/p>\n<p># \/usr\/sbin\/munin-run &#8211;servicedir \/etc\/munin\/plugins mysql01_size_dbname01<br \/>\n# \/usr\/sbin\/munin-run &#8211;servicedir \/etc\/munin\/plugins mysql01_size_dbname02<br \/>\n# \/usr\/sbin\/munin-run &#8211;servicedir \/etc\/munin\/plugins mysql02_size_dbname03<\/p>\n<p><strong>\u25a0\u52d5\u4f5c\u304c\u78ba\u8a8d\u3067\u304d\u305f\u3089\u8a2d\u5b9a\u3092\u53cd\u6620\u3059\u308b<\/strong><\/p>\n<p># \/sbin\/service munin-node restart<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u25a0munin\u3067\u8907\u6570mysqld\u3092\u76e3\u8996\u3059\u308b\u8a2d\u5b9a\u30e1\u30e2 \u3000CentOS\u74b0\u5883\u3067\u540c\u4e00\u30db\u30b9\u30c8\u5185\u306b\u8a2d\u5b9a\u3055\u308c\u305f\u8907\u6570mysqld\u81ea\u4f53\u3084\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30a4\u30ba\u306e\u76e3\u8996\u3092munin\u3067\u884c\u3046\u8a2d\u5b9a\u306e\u30e1\u30e2\u3002epel\u30ea\u30dd\u30b8\u30c8\u30ea\u304c\u5fc5\u8981\u3002munin\u8a2d\u5b9a\u304c\u3067\u304d\u3066\u3044 &hellip; <a href=\"https:\/\/blog.isnext.net\/issy\/archives\/957\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;munin\u3067\u8907\u6570mysqld\u3092\u76e3\u8996\u3059\u308b\u8a2d\u5b9a\u30e1\u30e2&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[20,28,24],"class_list":["post-957","post","type-post","status-publish","format-standard","hentry","category-linux","tag-centos","tag-munin","tag-mysql"],"_links":{"self":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts\/957","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/comments?post=957"}],"version-history":[{"count":5,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts\/957\/revisions"}],"predecessor-version":[{"id":959,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts\/957\/revisions\/959"}],"wp:attachment":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/media?parent=957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/categories?post=957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/tags?post=957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}