MySQL agent

Prerequisites

  • For prerequisite checks for agent installation, see Prerequisite checks for agent installation.
  • URL/IP of the SixthSense collector (your tenant URL, which will be provided by Customer Support).
  • Access token from the SixthSense portal. For accessing the token, see Accessing your Access Token under Getting started with the Observability Portal.
  • mysql agent version "latest".
  • database details (host name, port, database name, database user credentials).
  • Package token to download the agent (which will be provided by Customer Support).
  • For information about supported agent versions and framework, see Supported agents.

Downloading the Agent version 4.4.5 (latest)

For Windows and Linux based servers, use the following link.

curl --header "PRIVATE-TOKEN:<TOKEN>" --output meter-agent.zip "https://artifacts-observability.sixthsense.rakuten.com/api/v4/projects/32/packages/generic/Meter-Agent/v4.4.5/meter-agent.zip"
note

The agent depends on the Operating System and architecture.

Database User Permissions

To capture database metrics from the MySQL server, you must first create a MySQL user with replication and select permissions.

Perform the following steps to create user and grant permissions.

From the MySQL command line, create a user sixthsense@<your_host_name> with a specific password by running:

Create user

CREATE USER 'sixthsense'@'localhost' IDENTIFIED BY '<your_strong_password>' WITH MAX_USER_CONNECTIONS 5;

Grant replication privileges to sixthsense@<your_host_name> by running:

Grant replication permission

GRANT REPLICATION CLIENT ON *.* TO 'sixthsense'@'localhost';

Grant privileges to sixthsense@<your_host_name>, by running:

Grant select permission

GRANT SELECT ON *.* TO 'sixthsense'@'localhost';
note

Replace <your_host_name> and <your_strong_password> with your values.

Enable deadlock permission

SET GLOBAL innodb_print_all_deadlocks = ON;

Configuring the MySQL agent

Create a config.yaml file in the same directory as the agent.

# sixthsense-mysql-agent can be configured via yaml or environment variables
#
# Note: Environment Variables are given higher priority over yaml file
#
# Following are the environment variables that can be set:
# ENV VARIABLE CORRESPONDS TO
# SS_SERVICE_NAME service_name
# SS_AUTHENTICATION authentication
# SS_BACKEND sixthsense_backend
# SS_LOGGING logging
# SS_SECURE secure
sixthsense:
service_name: <custom-service-name>
# Login to Sixthsense UI --> Go to Settings on Side Navbar --> Copy Access Token
authentication: <custom-service-authKey>
logging: info
sixthsense_backend: <custom-sixthsense_backend-url>
# For GCP: grpc-collector-observability.sixthsense.rakuten.com:443
# (One Cloud) For connectivity to backend using intra public network: 133.237.176.44:80
# (One Cloud) For connectivity to backend using onecloud private network: 100.99.116.221:80
# SSL connection with backend true|false
secure: true
# (For One Cloud) secure: false
# MY | ES | MS | CB | OR
type: MY
# cron optional
# cron: "* * * * *"
hostname: <hostIp>
port: <port> #3306
user: <user>
password: <password>
mysql:
isCluster: <true|false>
clusterName: <clusterName>
# database optional
# database: demo_db
# socket: /tmp/mysql.sock
# log file path
# logPath: logs/logs.log
queryLimit: 10 #no of queries
queryThresholdTime: 200 #millisecond
note

Use either the sql port or socket.

Running the agent

For Linux:

Run MySQL agent in the terminal using the following commnad.

./meter-agent path/to/config/ss-mysql-config.yaml

For Windows:

  1. Register DBM agent as a Service in Windows. Type in the following command in cmd:
sc create "<Service Name>" binPath= "\"<path_to_exe>.exe\" -config \"<path_to_config>.yaml\"" start= auto

Example:

sc create "MeterAgent_mysql" binPath= "\"C:\ Downloads\meter-agent\Meter-Agent-v4.4.5\Windows\meter-agent-v4.4.5.exe\" -config \"C:\ Downloads\meter-agent\Meter-Agent-v4.4.5\Configs\ss-postgresql-config.yaml\"" start= auto
  1. Confirm whether the service is registered by opening Services and search for the Service Name with which you've registered.

  2. Run the service by opening the Services again and look for Service name > Start or sc start <service_name>.

Example: sc start MeterAgent_mysql

Editing the configuration in the yaml file

In yaml file, add the following configuration details:

  1. service_name: Servive name will display on UI
  2. authentication: Get access token from dashboard under setting
  3. sixthsense_backend: Backend collector URL
  4. hostname: hostname
  5. port: port
  6. user: db_user
  7. password: db_user_password
note

It supports instance name also with hostname

Example:

hostname: Hostname/SQLExpress