🚀 DevOps & SRE Certification Program 📅 Starting: 1st of Every Month 🤝 +91 8409492687 🔍 Contact@DevOpsSchool.com

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

How to monitor mysql using NewRelic with integration in Linux?

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 database server and analyze metric data so that you can easily find the source of any problems.

Compatibility and requirements

  • MySQL version 5.6 or higher.
  • Install the infrastructure agent
  • Install infrastructure on-host integrations

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’s health and analyze metric data so that you can easily find the source of any problems

Install and Configure Mysql Server in Centos

What is “infrastructure on-host integrations”?

New Relic’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.

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’s data, the agent acts as a forwarder for integrations’s data, and can forward logs.

Centos / RHEL – Install infrastructure on-host integrations for mysql in linux?

$ sudo yum -q makecache -y --disablerepo='*' --enablerepo='newrelic-infra'
$ sudo yum install nri-mysql
$ sudo systemctl restart newrelic-infra

# From the command line, create a user newrelic@localhost with a specific password by running:
$ sudo mysql -e "CREATE USER 'newrelic'@'localhost' IDENTIFIED BY $YOUR_PASSWORD WITH MAX_USER_CONNECTIONS 5;"

# Grant replication privileges to newrelic@localhost, with a maximum of 5 connections, by running:
$ sudo mysql -e "GRANT REPLICATION CLIENT ON *.* TO 'newrelic'@'localhost' WITH MAX_USER_CONNECTIONS 5;"

# Grant privileges to newrelic@localhost, with a maximum of 5 connections, by running:
$ sudo mysql -e "GRANT SELECT ON *.* TO 'newrelic'@'localhost' WITH MAX_USER_CONNECTIONS 5;"

# Change the directory to the integration's folder.

$ cd /etc/newrelic-infra/integrations.d
$ sudo cp mysql-config.yml.sample mysql-config.yml

# Edit the configuration file mysql-config.yml as explained in the next section.

$ vi mysql-config.yml

$ Restart the infrastructure agent.

Ubuntu – Install infrastructure on-host integrations for mysql in linux?


$ sudo apt-get install nri-mysql -y
$ sudo systemctl restart newrelic-infra

# From the command line, create a user newrelic@localhost with a specific password by running:
$ sudo mysql -e "CREATE USER 'newrelic'@'localhost' IDENTIFIED BY $YOUR_PASSWORD WITH MAX_USER_CONNECTIONS 5;"

# Grant replication privileges to newrelic@localhost, with a maximum of 5 connections, by running:
$ sudo mysql -e "GRANT REPLICATION CLIENT ON *.* TO 'newrelic'@'localhost' WITH MAX_USER_CONNECTIONS 5;"

# Grant privileges to newrelic@localhost, with a maximum of 5 connections, by running:
$ sudo mysql -e "GRANT SELECT ON *.* TO 'newrelic'@'localhost' WITH MAX_USER_CONNECTIONS 5;"

# Change the directory to the integration's folder.

$ cd /etc/newrelic-infra/integrations.d
$ sudo cp mysql-config.yml.sample mysql-config.yml

# Edit the configuration file mysql-config.yml as explained in the next section.

$ vi mysql-config.yml

$ Restart the infrastructure agent.

Reference

  • https://docs.newrelic.com/docs/integrations/host-integrations/installation/install-infrastructure-host-integrations/
  • https://docs.newrelic.com/docs/integrations/host-integrations/host-integrations-list/mysql-monitoring-integration/
This configuration collects metrics every 30 seconds and inventory every 60 seconds:
integrations:
- name: nri-mysql
env:
METRICS: true
HOSTNAME: localhost
PORT: 3306
USERNAME: mysql_user
PASSWORD: mysql_password
REMOTE_MONITORING: true
interval: 30s
labels:
environment: production
- name: nri-mysql
env:
INVENTORY: true
HOSTNAME: localhost
PORT: 3306
USERNAME: mysql_user
PASSWORD: mysql_password
REMOTE_MONITORING: true
interval: 60s
labels:
environment: production
inventory_source: config/mysql
Use to connect to MySQL with TLS. You can add TLS_INSECURE_SKIP_VERIFY : true to disable the server name verification:
integrations:
- name: nri-mysql
env:
METRICS: true
HOSTNAME: localhost
PORT: 3306
USERNAME: mysql_user
PASSWORD: mysql_password
USE_TLS: true
REMOTE_MONITORING: true
interval: 30s
labels:
environment: production
Use to connect to MySQL with TLS. You can add TLS_INSECURE_SKIP_VERIFY : true to disable the server name verification:
integrations:
- name: nri-mysql
env:
METRICS: true
HOSTNAME: localhost
PORT: 3306
USERNAME: mysql_user
PASSWORD: mysql_password
USE_TLS: true
REMOTE_MONITORING: true
interval: 30s
labels:
environment: production
Use to connect to MySQL using a socket file. This is an alternative to a TCP Hostname/Port connection:
integrations:
- name: nri-mysql
env:
METRICS: true
USERNAME: mysql_user
PASSWORD: mysql_password
SOCKET: /var/run/mysql/mysql.sock
REMOTE_MONITORING: true
interval: 30s
labels:
environment: production
Use this to collect your metrics including extended, slave, innodb and my-isam metrics:
integrations:
- name: nri-mysql
env:
METRICS: true
HOSTNAME: localhost
PORT: 3306
USERNAME: mysql_user
PASSWORD: mysql_password
EXTENDED_METRICS: true
EXTENDED_INNODB_METRICS: true
EXTENDED_MY_ISAM_METRICS: true
REMOTE_MONITORING: true
interval: 30s
labels:
environment: production
Use this if you need to collect metrics from two different MySQL servers using the the same integration.
integrations:
- name: nri-mysql
env:
METRICS: true
HOSTNAME: mysql_host1
PORT: 3306
USERNAME: mysql1_user
PASSWORD: mysql1_password
REMOTE_MONITORING: true
interval: 30s
labels:
environment: production
- name: nri-mysql
env:
METRICS: true
HOSTNAME: mysql_host2
PORT: 3306
USERNAME: mysql2_user
PASSWORD: mysql2_password
REMOTE_MONITORING: true
interval: 30s
labels:
environment: production
integrations:
- name: nri-mysql
env:
HOSTNAME: localhost
PORT: 3306
USERNAME: mysql_user
PASSWORD: mysql_password
REMOTE_MONITORING: true
interval: 30s
labels:
environment: production
inventory_source: config/mysql
integrations:
- name: nri-mysql
env:
HOSTNAME: localhost
PORT: 3306
# ENABLE_TLS: false
# INSECURE_SKIP_VERIFY: false
# Specify extra connection parameters as attr1=val1&attr2=val2.
# EXTRA_CONNECTION_URL_ARGS: ""
# If not empty `socket` parameter will discard `port` parameter
#SOCKET: <PATH_TO_LOCAL_SOCKET_FILE_NAME>
USERNAME: newrelic
PASSWORD: RAJU%234
# Allow old password https://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_old_passwords
# OLD_PASSWORDS: false
# Name of the database to be monitored
# DATABASE: ""
# Enable extended metrics
# EXTENDED_METRICS: false
# Enable additional metrics
# EXTENDED_INNODB_METRICS: false
# EXTENDED_MY_ISAM_METRICS: false
# New users should leave this property as `true`, to identify the
# monitored entities as `remote`. Setting this property to `false` (the
# default value) is deprecated and will be removed soon, disallowing
# entities that are identified as `local`.
# entities that are identified as `local`.
# Please check the documentation to get more information about local
# versus remote entities:
# https://github.com/newrelic/infra-integrations-sdk/blob/master/docs/entity-definition.md
REMOTE_MONITORING: true
interval: 30s
labels:
env: production
role: write-replica
inventory_source: config/mysql

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.