{"id":474,"date":"2017-12-13T15:11:39","date_gmt":"2017-12-13T15:11:39","guid":{"rendered":"https:\/\/pandorafms.com\/library\/?p=474"},"modified":"2017-12-13T15:18:07","modified_gmt":"2017-12-13T15:18:07","slug":"basic-mysql-monitoring-on-linux","status":"publish","type":"post","link":"https:\/\/pandorafms.com\/library\/basic-mysql-monitoring-on-linux\/","title":{"rendered":"Basic MySQL Monitoring on Linux"},"content":{"rendered":"<p class=\"description_pui\">Several local modules in Linux for doing a general MySQL monitoring using the SQL\/CLI tool. This could be done in any OS (adapting commands), just using the Pandora FMS agent.<\/p>\n<h2>Modules<\/h2>\n<pre>Active threads\u00a0\r\n\r\nmodule_begin\u00a0\r\nmodule_name Mysql_Threads\u00a0\r\nmodule_description Mysql Threads\u00a0\r\nmodule_type generic_data\u00a0\r\nmodule_exec mysqladmin status -u root -pxxxx | grep -o \"Threads: [0-9]*\" | awk '{ print $2 }'\u00a0\r\nmodule_end\u00a0\r\n\r\nSQL Queries\u00a0\r\n\r\nmodule_begin\u00a0\r\nmodule_name Mysql_Questions\u00a0\r\nmodule_description Mysql Questions\u00a0\r\nmodule_type generic_data_inc\u00a0\r\nmodule_exec mysqladmin status -u root -pxxxx | grep -o \"Questions: [0-9]*\" | awk '{ print $2 }'\u00a0\r\nmodule_end\u00a0\r\n\r\nSQL Open (DB)\u00a0\r\n\r\nmodule_begin\u00a0\r\nmodule_name Mysql_Opens\u00a0\r\nmodule_description Mysql Opens\u00a0\r\nmodule_type generic_data_inc\u00a0\r\nmodule_exec mysqladmin status -u root -pxxxx | grep -o \"Opens: [0-9]*\" | awk '{ print $2 }'\u00a0\r\nmodule_end\u00a0\r\n\r\nSQL Open (Table access)\u00a0\r\n\r\nmodule_begin\u00a0\r\nmodule_name Mysql_OpenTables\u00a0\r\nmodule_description Mysql Opened tables\u00a0\r\nmodule_type generic_data\u00a0\r\nmodule_exec mysqladmin status -u root -pxxxx | grep -o \"Open tables: [0-9]*\" | awk '{ print $3 }'\u00a0\r\nmodule_end\u00a0\r\n\r\nSQL Queries per second\u00a0\r\n\r\nmodule_begin\u00a0\r\nmodule_name Mysql_QPS\u00a0\r\nmodule_description Mysql Queries per second\u00a0\r\nmodule_type generic_data\u00a0\r\nmodule_exec mysqladmin status -u root -pxxxx | grep -o \"Queries per second avg: [.0-9]*\" | awk '{ print $5 }'\u00a0\r\nmodule_end\u00a0\r\n\r\nMySQL process (mysqld) CPU usage (%)\u00a0\r\n\r\nmodule_begin\u00a0\r\nmodule_name Mysql_CPU\u00a0\r\nmodule_description Mysql CPU usage (%)\u00a0\r\nmodule_type generic_data\u00a0\r\nmodule_exec ps aux | grep \"mysqld --basedir\" | grep -v \"grep\" | awk '{ print $3 }'\u00a0\r\nmodule_end\u00a0\r\n\r\nMySQL Process (mysqld) RAM usage (%)\u00a0\r\n\r\nmodule_begin\u00a0\r\nmodule_name Mysql_RAM\u00a0\r\nmodule_description Mysql RAM usage (%)\u00a0\r\nmodule_type generic_data\u00a0\r\nmodule_exec ps aux | grep \"mysqld --basedir\" | grep -v \"grep\" | awk '{ print $4 }'\u00a0\r\nmodule_end<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Several local modules in Linux for doing a general MySQL monitoring using the SQL\/CLI tool. This could be done in any OS (adapting commands), just using the Pandora FMS agent. Modules Active threads\u00a0 module_begin\u00a0 module_name Mysql_Threads\u00a0 module_description Mysql Threads\u00a0 module_type generic_data\u00a0 module_exec mysqladmin status -u root -pxxxx | grep -o &#8220;Threads: [0-9]*&#8221; | awk &#8216;{ [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[15],"tags":[92],"_links":{"self":[{"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/posts\/474"}],"collection":[{"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/comments?post=474"}],"version-history":[{"count":0,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/posts\/474\/revisions"}],"wp:attachment":[{"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/media?parent=474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/categories?post=474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/tags?post=474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}