MySQL PI in Foglight serves the primary function of providing comprehensive monitoring and performance analysis capabilities for MySQL database environments. It continuously monitors various performance metrics of MySQL databases in real-time. It collects data on metrics such as waits statistics, memory utilization, disk I/O, query execution times, and more. For MySQL PI to function properly, configurations on monitored MySQL instances are necessary.
This section covers the following key areas:
To implement configuration changes, users can modify the MySQL options file, commonly referred to as my.cnf on Unix-like systems or my.ini on Windows platforms. This involves adding or altering prerequisite parameters within the file. It is important to note that these adjustments will only become effective following a restart of the MySQL service. Once applied, the changes will persist permanently.
To enact a permanent change using the configuration file, you should copy and add the lines below directly to your MySQL configuration file. The name and location of this file depends on the operating system used:
my.cnf
file in /etc/my.cnf, /usr/my.cnf or the default installation directory.my.ini
or my.cnf
file, typically found in either the Windows directory or the MySQL installation directory.
These changes should be added in the MySQL options file that is initialized during the MySQL server startup (known as my.cnf
or my.ini
).
The default for performance_schema_max_digest_length is 200 on MySQL version 5.6.
#Make sure the following Performance schema consumers are set
[mysql]
performance-schema-consumer-events-waits-current=ON
performance-schema-consumer-events-waits-history=ON
performance-schema-consumer-statements-digest=ON
performance-schema-consumer-thread-instrumentation=ON
performance-schema-consumer-events-statements-current=ON
performance-schema-consumer-events-statements-history=ON
performance-schema-consumer-statements-digest=ON
performance-schema-consumer-events-statements-history-long=ON
#Make sure the following Performance schema instruments are on
[mysql]
performance_schema=ON
performance_schema_instrument='statement/%=on'
performance_schema_instrument='wait/%=on'```
#Make sure the following server variables are configured more than a default (which is too low)
#To gather more digests (Nomalized)
[mysql]
performance_schema_digests_size=10000
performance_schema_events_waits_history_size=100
performance_schema_events_waits_history_long_size=10000
performance_schema_events_statements_history_size=1000
performance_schema_events_statements_history_long_size=20000
#To see larger digest text (Normalized)
[mysql]
max_digest_length=1024
performance_schema_max_digest_length=1024
#To see larger SQL text
[mysql]
performance_schema_max_sql_text_length=1024
When installing MySQL on AWS RDS, there are two types of performance schema parameters: Both of these should be configured in MySQL instances.
The commands below should be copied and executed using the AWS CLI utility. These changes will take effect only after the MySQL RDS instance is rebooted.
--db-parameter-group-name < replace with parameters group name > ^
--parameters "ParameterName=performance_schema,ParameterValue=1,ApplyMethod=pending-reboot"
aws rds modify-db-parameter-group ^
--db-parameter-group-name < replace with parameters group name > ^
--parameters "ParameterName=performance_schema_digests_size,ParameterValue=10000,ApplyMethod=pending-reboot"
aws rds modify-db-parameter-group ^
--db-parameter-group-name < replace with parameters group name > ^
--parameters "ParameterName=performance_schema_events_waits_history_size,ParameterValue=100,ApplyMethod=pending-reboot"
aws rds modify-db-parameter-group ^
--db-parameter-group-name < replace with parameters group name > ^
--parameters "ParameterName=performance_schema_events_waits_history_long_size,ParameterValue=10000,ApplyMethod=pending-reboot"
aws rds modify-db-parameter-group ^
--db-parameter-group-name < replace with parameters group name > ^
--parameters "ParameterName=performance_schema_events_statements_history_size,ParameterValue=1000,ApplyMethod=pending-reboot"
aws rds modify-db-parameter-group ^
--db-parameter-group-name < replace with parameters group name > ^
--parameters "ParameterName=performance_schema_events_statements_history_long_size,ParameterValue=20000,ApplyMethod=pending-reboot"
aws rds modify-db-parameter-group ^
--db-parameter-group-name < replace with parameters group name > ^
--parameters "ParameterName=max_digest_length,ParameterValue=1024,ApplyMethod=pending-reboot"
aws rds modify-db-parameter-group ^
--db-parameter-group-name < replace with parameters group name > ^
--parameters "ParameterName=performance_schema_max_digest_length,ParameterValue=1024,ApplyMethod=pending-reboot"
aws rds modify-db-parameter-group ^
--db-parameter-group-name < replace with parameters group name > ^
--parameters "ParameterName=performance_schema_max_sql_text_length,ParameterValue=1024,ApplyMethod=pending-reboot"
The following lines should also be copied and executed on each monitored MySQL instance. Please note that this script should be executed after each MySQL RDS instance reboot.
UPDATE performance_schema.setup_consumers SET enabled = 'YES'
WHERE NAME IN ('events_waits_current', 'events_waits_history', 'statements_digest', 'thread_instrumentation', 'events_statements_current', 'events_statements_history', 'events_statements_history_long');
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES' WHERE NAME LIKE ( 'wait%' );
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES' WHERE NAME LIKE ( 'statement%' );
CREATE TEMPORARY TABLES grant
In releases 6.0.1.10 and higher of the MySQL PI cartridge, the foglight account being used by the MySQL PI agent requires the CREATE TEMPORARY TABLES grant.
MySQL Configuration Scripts
Following are the eight scripts that the cartridge uses to run in the background with the account configured in the MySQL PI agent to check the prerequisite requirements. You need to run the script corresponding to the MySQL or MariaDB version level and platform.
Activating the MySQL performance_schema affects the resource usage of the instance. The parameters and values suggested in this section are merely recommendations. Modifying or disabling certain parameters can help lower resource consumption. For more information refer to MySQL documentation. Disabling certain parameters may result in reduction of the relevant information available in Foglight PI.
To enable MySQL PI for an agent:
Once all prerequisites are fulfilled, PostgreSQL PI is enabled for the selected agent.
MariaDB and MySQL (PaaS) versions on Azure are currently not supported and have not been certified by R&D. Presently, only IaaS/on-premise and AWS RDS versions are supported. An Enhancement Request FGMYSQL-I-14 has been logged for certification of these environments with MySQL PI.