{"id":21411,"date":"2021-05-18T16:47:58","date_gmt":"2021-05-18T16:47:58","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=21411"},"modified":"2024-04-02T06:57:23","modified_gmt":"2024-04-02T06:57:23","slug":"how-to-monitor-mysql-using-newrelic-with-integration-in-linux","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-monitor-mysql-using-newrelic-with-integration-in-linux\/","title":{"rendered":"How to monitor mysql using NewRelic with integration in Linux?"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">What MySQL integration collects and sends?<\/h2>\n\n\n\n<p>NewRelic MySQL integration collects and sends inventory and metrics from your MySQL database to our platform, where you can see the health of your database server and analyze metric data so that you can easily find the source of any problems.<\/p>\n\n\n\n<p><strong>Compatibility and requirements<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>MySQL version 5.6 or higher.<\/li>\n\n\n\n<li>Install the infrastructure agent<\/li>\n\n\n\n<li>Install infrastructure on-host integrations<\/li>\n<\/ul>\n\n\n\n<p>Our MySQL integration uses the New Relic Infrastructure agent to collect and send performance metrics from your MySQL database to our platform. You can see your database server\u2019s health and analyze metric data so that you can easily find the source of any problems<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install and Configure Mysql Server in Centos<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>CENTOS  &#8211; <a href=\"https:\/\/www.devopsschool.com\/tutorial\/mysql\/how-to-install-mysql-on-centos-7.html\" target=\"_blank\" rel=\"noreferrer noopener\">How to Install MySQL on CentOS 7<\/a><\/li>\n\n\n\n<li>UBUNTU with Xampp &#8211; <a href=\"https:\/\/www.devopsschool.com\/blog\/installing-xampp-7-4-xxx-on-ubuntu\/\" target=\"_blank\" rel=\"noreferrer noopener\">Alternate \u2013 You may use XAMPP as well. How to install and Configure XAMPP on Ubuntu?<\/a><\/li>\n\n\n\n<li>MySql with XAMPP &#8211; <a href=\"https:\/\/www.devopsschool.com\/blog\/how-to-configure-xampp-and-wordpress-in-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Install &amp; configure Xampp with mysql in Linux?<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/how-to-install-mysql-server-and-client-on-ubuntu\/\">Ubuntu &#8211; How To Install MySQL server and client on Ubuntu?<\/a><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-devopsschool-com wp-block-embed-devopsschool-com\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"gPWCkQhfKX\"><a href=\"https:\/\/www.devopsschool.com\/blog\/newrelic-infrastructure-monitoring-linux-vitural-machine-using-newrelic-agent\/\">Newrelic Infrastructure: Monitoring Linux Vitural Machine using Newrelic Agent<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Newrelic Infrastructure: Monitoring Linux Vitural Machine using Newrelic Agent&#8221; &#8212; DevOpsSchool.com\" src=\"https:\/\/www.devopsschool.com\/blog\/newrelic-infrastructure-monitoring-linux-vitural-machine-using-newrelic-agent\/embed\/#?secret=jXvLGbnoB8#?secret=gPWCkQhfKX\" data-secret=\"gPWCkQhfKX\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">What is &#8220;infrastructure on-host integrations&#8221;?<\/h2>\n\n\n\n<p>New Relic&#8217;s on-host integrations are a type of infrastructure integration that collect data from core services running on your hosts, such as MySQL, Apache, or Redis, among others.<\/p>\n\n\n\n<p>To collect data from on-host services, all you need are two things: the infrastructure agent, and the on-host integrations. All on-host integrations require that our infrastructure agent is installed on the host. Besides collecting system&#8217;s data, the agent acts as a forwarder for integrations&#8217;s data, and can forward logs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Centos \/ RHEL &#8211; Install infrastructure on-host integrations for mysql in linux?<\/h2>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">$ sudo yum -q makecache -y --disablerepo=<span class=\"hljs-string\">'*'<\/span> --enablerepo=<span class=\"hljs-string\">'newrelic-infra'<\/span>\n$ sudo yum install nri-mysql\n$ sudo systemctl restart newrelic-infra\n\n<span class=\"hljs-comment\"># From the command line, create a user newrelic@localhost with a specific password by running:<\/span>\n$ sudo mysql -e <span class=\"hljs-string\">\"CREATE USER 'newrelic'@'localhost' IDENTIFIED BY $YOUR_PASSWORD WITH MAX_USER_CONNECTIONS 5;\"<\/span>\n\n<span class=\"hljs-comment\"># Grant replication privileges to newrelic@localhost, with a maximum of 5 connections, by running:<\/span>\n$ sudo mysql -e <span class=\"hljs-string\">\"GRANT REPLICATION CLIENT ON *.* TO 'newrelic'@'localhost' WITH MAX_USER_CONNECTIONS 5;\"<\/span>\n\n<span class=\"hljs-comment\"># Grant privileges to newrelic@localhost, with a maximum of 5 connections, by running:<\/span>\n$ sudo mysql -e <span class=\"hljs-string\">\"GRANT SELECT ON *.* TO 'newrelic'@'localhost' WITH MAX_USER_CONNECTIONS 5;\"<\/span>\n\n<span class=\"hljs-comment\"># Change the directory to the integration's folder.<\/span>\n\n$ cd \/etc\/newrelic-infra\/integrations.d\n$ sudo cp mysql-config.yml.sample mysql-config.yml\n\n<span class=\"hljs-comment\"># Edit the configuration file mysql-config.yml as explained in the next section.<\/span>\n\n$ vi mysql-config.yml\n\n$ Restart the infrastructure agent.\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Ubuntu &#8211; Install infrastructure on-host integrations for mysql in linux?<\/h2>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">$ sudo apt-get install nri-mysql -y\n$ sudo systemctl restart newrelic-infra\n\n<span class=\"hljs-comment\"># From the command line, create a user newrelic@localhost with a specific password by running:<\/span>\n$ sudo mysql -e <span class=\"hljs-string\">\"CREATE USER 'newrelic'@'localhost' IDENTIFIED BY $YOUR_PASSWORD WITH MAX_USER_CONNECTIONS 5;\"<\/span>\n\n<span class=\"hljs-comment\"># Grant replication privileges to newrelic@localhost, with a maximum of 5 connections, by running:<\/span>\n$ sudo mysql -e <span class=\"hljs-string\">\"GRANT REPLICATION CLIENT ON *.* TO 'newrelic'@'localhost' WITH MAX_USER_CONNECTIONS 5;\"<\/span>\n\n<span class=\"hljs-comment\"># Grant privileges to newrelic@localhost, with a maximum of 5 connections, by running:<\/span>\n$ sudo mysql -e <span class=\"hljs-string\">\"GRANT SELECT ON *.* TO 'newrelic'@'localhost' WITH MAX_USER_CONNECTIONS 5;\"<\/span>\n\n<span class=\"hljs-comment\"># Change the directory to the integration's folder.<\/span>\n\n$ cd \/etc\/newrelic-infra\/integrations.d\n$ sudo cp mysql-config.yml.sample mysql-config.yml\n\n<span class=\"hljs-comment\"># Edit the configuration file mysql-config.yml as explained in the next section.<\/span>\n\n$ vi mysql-config.yml\n\n$ Restart the infrastructure agent.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"700\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/04\/image-1024x700.png\" alt=\"\" class=\"wp-image-45367\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/04\/image-1024x700.png 1024w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/04\/image-300x205.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/04\/image-768x525.png 768w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2024\/04\/image.png 1401w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Reference<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>https:\/\/docs.newrelic.com\/docs\/integrations\/host-integrations\/installation\/install-infrastructure-host-integrations\/<\/li>\n\n\n\n<li>https:\/\/docs.newrelic.com\/docs\/integrations\/host-integrations\/host-integrations-list\/mysql-monitoring-integration\/<\/li>\n<\/ul>\n\n\n\n<script src=\"https:\/\/gist.github.com\/devops-school\/c59a8483c2c2f6cab910de8741c245ec.js\"><\/script>\n","protected":false},"excerpt":{"rendered":"<p>What MySQL integration collects and sends? NewRelic MySQL integration collects and sends inventory and metrics from your MySQL database to our platform, where you can see the health of your&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-21411","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/21411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=21411"}],"version-history":[{"count":10,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/21411\/revisions"}],"predecessor-version":[{"id":45369,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/21411\/revisions\/45369"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=21411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=21411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=21411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}