{"id":3452,"date":"2017-04-20T16:52:46","date_gmt":"2017-04-20T16:52:46","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=3452"},"modified":"2017-04-20T16:52:46","modified_gmt":"2017-04-20T16:52:46","slug":"monitor-mysql-zabbix","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2017\/04\/20\/monitor-mysql-zabbix\/","title":{"rendered":"Monitor MySql with Zabbix"},"content":{"rendered":"<p>How to configure the zabbix on the agent side to allow mysql data to populate in zabbix. Ssh to the server you want to monitor &#8211; the one with the zabbix agent installed on. Check that your zabbix_agent config file is including the path &#8220;\/etc\/zabbix\/zabbix_agentd.d\/&#8221;:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># nano \/etc\/zabbix\/zabbix_agentd.conf\n\n<\/pre>\n<p>Look towards the the end of file:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">Include=\/etc\/zabbix\/zabbix_agentd.d\/*.conf\n<\/pre>\n<p>Check where your zabbix_mysql config is:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># locate userparameter_mysql\n\/usr\/share\/doc\/zabbix-agent-4.4.5\/userparameter_mysql.conf<\/pre>\n<p>Copy to he following directory:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">cp \/usr\/share\/doc\/zabbix-agent-4.4.5\/userparameter_mysql.conf \/etc\/zabbix\/zabbix_agentd.d\/userparameter_mysql.conf<\/pre>\n<p>Open the config file:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># nano \/etc\/zabbix\/zabbix_agentd.d\/userparameter_mysql.conf\n\n<\/pre>\n<p>Looks for this type of info&#8230;<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">UserParameter=mysql.status&#x5B;*],echo &quot;show global status where Variable_name=&#039;$1&#039;;&quot; | HOME=\/var\/lib\/zabbix mysql -N | awk &#039;{print $$2}&#039;\n<\/pre>\n<p>If you&#8217;ll find it for example: HOME=\/var\/lib\/zabbix then create that directory if it does not exist:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># mkdir \/var\/lib\/zabbix\n\n<\/pre>\n<p>change to that directory and create\/edit .my.cnf file:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># cd \/var\/lib\/zabbix\n# nano .my.cnf\n<\/pre>\n<p>add the following (assuming you have a user zabbix added with a password. Or, you can use any user as long as they have permissions:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;mysql]\nuser=zabbix\npassword=zabbixpassword\nhost=localhost\n\n&#x5B;mysqladmin]\nuser=zabbix\npassword=zabbixpassword\nhost=localhost\n\n<\/pre>\n<p>Then save.<\/p>\n<p>Restart mysql:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">#systemctl restart mariadb.service\n\n<\/pre>\n<p>Restart zabbix agent:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">#systemctl restart zabbix-agent.service\n\n<\/pre>\n<p>Now go to Monitoring &#8211; Latest Data to view mysql data.<\/p>\n<p>Other Resources:<\/p>\n<p>http:\/\/stackoverflow.com\/questions\/34805211\/monitoring-mysql-with-zabbix-agent<\/p>\n<p>http:\/\/blog.themilkyway.org\/2013\/11\/how-to-monitor-mysql-using-the-new-zabbix-template-app-mysql\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to configure the zabbix on the agent side to allow mysql data to populate in zabbix. Ssh to the server you want to monitor &#8211; the one with the zabbix agent installed on. Check that your zabbix_agent config file is including the path &#8220;\/etc\/zabbix\/zabbix_agentd.d\/&#8221;: # nano \/etc\/zabbix\/zabbix_agentd.conf Look towards the the end of file: &#8230; <a title=\"Monitor MySql with Zabbix\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2017\/04\/20\/monitor-mysql-zabbix\/\" aria-label=\"Read more about Monitor MySql with Zabbix\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[133],"tags":[],"class_list":["post-3452","post","type-post","status-publish","format-standard","hentry","category-zabbix"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/3452","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=3452"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/3452\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=3452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=3452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=3452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}