MySQL

Supported OS Linux Mac OS Windows

Intégration8.2.1

Dashboard MySQL

Présentation

L’Agent Datadog peut recueillir de nombreuses métriques à partir des bases de données MySQL, notamment (sans s’y limiter) :

  • Le débit de requêtes
  • Les performances des requêtes, notamment le délai d’exécution moyen des requêtes et les requêtes lentes
  • Les connexions, notamment les connexions actives, les connexions interrompues et les erreurs
  • InnoDB, notamment les métriques de pool de buffer

Vous pouvez également créer vos propres métriques à l’aide de requêtes SQL personnalisées.

Remarque : cette intégration est également compatible avec MariaDB, car elle sert de « remplacement » pour MySQL.

Configuration

Cette page décrit le fonctionnement de l'intégration d'Agent MySQL. Si vous souhaitez obtenir des informations sur la solution Database Monitoring pour MySQL, consultez la section Database Monitoring.

Installation

Le check MySQL est inclus avec le package de l’Agent Datadog. Vous n’avez donc rien d’autre à installer sur votre serveur MySQL.

Préparer MySQL

Sur chaque serveur MySQL, créez un utilisateur de base de données pour l’Agent Datadog.

Les instructions suivantes autorisent l’Agent à se connecter depuis n’importe quel host à l’aide de datadog@'%'. Vous pouvez restreindre l’utilisateur datadog avec datadog@'localhost', de façon à ce qu’il soit uniquement autorisé à se connecter depuis localhost. Consultez la section Ajouter des comptes, attribuer des droits d’accès et supprimer des comptes de la documentation MySQL (en anglais) pour en savoir plus.

mysql> CREATE USER 'datadog'@'%' IDENTIFIED BY '<MOT_DE_PASSE_UNIQUE>';
Query OK, 0 rows affected (0.00 sec)

Pour mySQL 8.0 et ultérieur, créez l’utilisateur datadog avec la méthode de hachage de mot de passe natif :

mysql> CREATE USER 'datadog'@'%' IDENTIFIED WITH mysql_native_password by '<MOT_DE_PASSE_UNIQUE>';
Query OK, 0 rows affected (0.00 sec)

Vérifiez que l’utilisateur a bien été créé à l’aide des commandes ci-dessous. Remplacez <MOT_DE_PASSE_UNIQUE> par le mot de passe que vous avez créé ci-dessus :

mysql -u datadog --password=<MOT_DE_PASSE_UNIQUE> -e "show status" | \
grep Uptime && echo -e "\033[0;32mMySQL user - OK\033[0m" || \
echo -e "\033[0;31mCannot connect to MySQL\033[0m"
mysql -u datadog --password=<MOT_DE_PASSE_UNIQUE> -e "show slave status" && \
echo -e "\033[0;32mMySQL grant - OK\033[0m" || \
echo -e "\033[0;31mMissing REPLICATION CLIENT grant\033[0m"

L’Agent a besoin de certains privilèges pour recueillir des métriques. Accordez à l’utilisateur les privilèges limités suivants UNIQUEMENT :

mysql> GRANT REPLICATION CLIENT ON *.* TO 'datadog'@'%' WITH MAX_USER_CONNECTIONS 5;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> GRANT PROCESS ON *.* TO 'datadog'@'%';
Query OK, 0 rows affected (0.00 sec)

Pour MySQL 8.0+, définissez max_user_connections avec :

mysql> ALTER USER 'datadog'@'%' WITH MAX_USER_CONNECTIONS 5;
Query OK, 0 rows affected (0.00 sec)

Si cette option est activée, les métriques peuvent être recueillies à partir de la base de données performance_schema en accordant un privilège supplémentaire :

mysql> show databases like 'performance_schema';
+-------------------------------+
| Database (performance_schema) |
+-------------------------------+
| performance_schema            |
+-------------------------------+
1 row in set (0.00 sec)

mysql> GRANT SELECT ON performance_schema.* TO 'datadog'@'%';
Query OK, 0 rows affected (0.00 sec)

Procédure à suivre

Suivez les instructions ci-dessous pour configurer ce check lorsque l’Agent est exécuté sur un host. Consultez la section Docker, Kubernetes ou ECS pour la configuration dans un environnement conteneurisé.

Host

Pour configurer ce check lorsque l’Agent est exécuté sur un host :

Modifiez le fichier mysql.d/conf.yaml dans le dossier conf.d/ à la racine du répertoire de configuration de votre Agent pour commencer à recueillir vos métriques et logs MySQL. Consultez le fichier d’exemple mysql.d/conf.yaml pour découvrir toutes les options de configuration disponibles.

Collecte de métriques
  • Ajoutez ce bloc de configuration à votre fichier mysql.d/conf.yaml pour recueillir vos métriques MySQL :

    init_config:
    
    instances:
      - server: 127.0.0.1
        user: datadog
        password: "<YOUR_CHOSEN_PASSWORD>" # from the CREATE USER step earlier
        port: "<YOUR_MYSQL_PORT>" # e.g. 3306
        options:
          replication: false
          galera_cluster: true
          extra_status_metrics: true
          extra_innodb_metrics: true
          extra_performance_metrics: true
          schema_size_metrics: false
          disable_innodb_metrics: false
    

Remarque : ajoutez des guillemets simples autour de votre mot de passe s’il contient un caractère spécial.

Pour recueillir d’autres métriques de performance (extra_performance_metrics), l’option performance_schema doit être activée sur votre serveur MySQL. Sinon, extra_performance_metrics doit être défini sur false. Pour en savoir plus sur performance_schema, consultez la section Prise en main du schéma de performance de la documentation MySQL (en anglais).

Remarque : l’utilisateur datadog doit être défini dans la configuration de l’intégration MySQL en tant que host: 127.0.0.1 au lieu de localhost. Vous pouvez également utiliser sock.

Consultez le fichier d’exemple mysql.yaml pour découvrir toutes les options de configuration disponibles, notamment pour les métriques custom.

Redémarrez l’Agent pour commencer à envoyer des métriques MySQL à Datadog.

Collecte de logs

Disponible à partir des versions > 6.0 de l’Agent

  1. Par défaut, MySQL enregistre tous ses logs dans /var/log/syslog, dont la lecture nécessite un accès root. Pour rendre les logs plus accessibles, voici les étapes à suivre :

    • Modifiez /etc/mysql/conf.d/mysqld_safe_syslog.cnf et supprimez ou commentez les lignes.

    • Modifiez /etc/mysql/my.cnf et ajoutez les lignes suivantes pour activer les logs généraux, d’erreurs et de requêtes lentes :

        [mysqld_safe]
        log_error = /var/log/mysql/mysql_error.log
      
        [mysqld]
        general_log = on
        general_log_file = /var/log/mysql/mysql.log
        log_error = /var/log/mysql/mysql_error.log
        slow_query_log = on
        slow_query_log_file = /var/log/mysql/mysql_slow.log
        long_query_time = 2
      
    • Enregistrez le fichier et redémarrez MySQL à l’aide des commandes suivantes : service mysql restart

    • Assurez-vous que l’Agent dispose d’une autorisation de lecture pour le répertoire /var/log/mysql et tous ses fichiers. Vérifiez votre configuration de logrotate pour vous assurer que ces fichiers sont pris en compte et que les autorisations sont correctement définies.

    • Dans /etc/logrotate.d/mysql-server, vous devriez voir des lignes similaires à ce qui suit :

        /var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql_slow.log {
                daily
                rotate 7
                missingok
                create 644 mysql adm
                Compress
        }
      
  2. La collecte de logs est désactivée par défaut dans l’Agent Datadog. Vous devez l’activer dans datadog.yaml :

    logs_enabled: true
    
  3. Ajoutez ce bloc de configuration à votre fichier mysql.d/conf.yaml pour commencer à recueillir vos logs MySQL :

    logs:
      - type: file
        path: "<ERROR_LOG_FILE_PATH>"
        source: mysql
        service: "<SERVICE_NAME>"
    
      - type: file
        path: "<SLOW_QUERY_LOG_FILE_PATH>"
        source: mysql
        service: "<SERVICE_NAME>"
        log_processing_rules:
          - type: multi_line
            name: new_slow_query_log_entry
            pattern: "# Time:"
            # If mysqld was started with `--log-short-format`, use:
            # pattern: "# Query_time:"
            # If using mysql version <5.7, use the following rules instead:
            # - type: multi_line
            #   name: new_slow_query_log_entry
            #   pattern: "# Time|# User@Host"
            # - type: exclude_at_match
            #   name: exclude_timestamp_only_line
            #   pattern: "# Time:"
    
      - type: file
        path: "<GENERAL_LOG_FILE_PATH>"
        source: mysql
        service: "<SERVICE_NAME>"
        # For multiline logs, if they start by the date with the format yyyy-mm-dd uncomment the following processing rule
        # log_processing_rules:
        #   - type: multi_line
        #     name: new_log_start_with_date
        #     pattern: \d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])
        # If the logs start with a date with the format yymmdd but include a timestamp with each new second, rather than with each log, uncomment the following processing rule
        # log_processing_rules:
        #   - type: multi_line
        #     name: new_logs_do_not_always_start_with_timestamp
        #     pattern: \t\t\s*\d+\s+|\d{6}\s+\d{,2}:\d{2}:\d{2}\t\s*\d+\s+
    

    Consultez le fichier d’exemple mysql.yaml pour découvrir toutes les options de configuration disponibles, notamment pour les métriques custom.

  4. Redémarrez l’Agent.

Docker

Pour configurer ce check lorsque l’Agent est exécuté sur un conteneur :

Collecte de métriques

Définissez des modèles d’intégration Autodiscovery en tant qu’étiquettes Docker sur votre conteneur d’application :

LABEL "com.datadoghq.ad.check_names"='["mysql"]'
LABEL "com.datadoghq.ad.init_configs"='[{}]'
LABEL "com.datadoghq.ad.instances"='[{"server": "%%host%%", "user": "datadog","password": "<MOT_DE_PASSE_UNIQUE>"}]'

Consultez la documentation relative aux template variables Autodiscovery pour découvrir comment utiliser <MOT_DE_PASSE_UNIQUE> en tant que variable d’environnement plutôt que sous forme d’étiquette.

Collecte de logs

La collecte des logs est désactivée par défaut dans l’Agent Datadog. Pour l’activer, consultez la section Collecte de logs avec Docker.

Définissez ensuite des intégrations de logs en tant qu’étiquettes Docker :

LABEL "com.datadoghq.ad.logs"='[{"source":"mysql","service":"mysql"}]'

Kubernetes

Pour configurer ce check lorsque l’Agent est exécuté sur Kubernetes :

Collecte de métriques

Définissez des modèles d’intégration Autodiscovery en tant qu’annotations de pod sur votre conteneur d’application. Vous pouvez également configurer des modèles avec un fichier, une configmap ou un stockage key/value.

apiVersion: v1
kind: Pod
metadata:
  name: mysql
  annotations:
    ad.datadoghq.com/mysql.check_names: '["mysql"]'
    ad.datadoghq.com/mysql.init_configs: '[{}]'
    ad.datadoghq.com/mysql.instances: |
      [
        {
          "server": "%%host%%", 
          "user": "datadog",
          "password": "<MOT_DE_PASSE_UNIQUE>"
        }
      ]      
  labels:
    name: mysql
spec:
  containers:
    - name: mysql

Consultez la documentation relative aux template variables Autodiscovery pour découvrir comment utiliser <MOT_DE_PASSE_UNIQUE> en tant que variable d’environnement plutôt que sous forme d’étiquette.

Collecte de logs

La collecte des logs est désactivée par défaut dans l’Agent Datadog. Pour l’activer, consultez la section Collecte de logs avec Kubernetes.

Définissez ensuite des intégrations de logs en tant qu’annotations de pod. Cette configuration peut également être réalisée avec un fichier, une configmap ou un stockage key/value.

apiVersion: v1
kind: Pod
metadata:
  name: mysql
  annotations:
    ad.datadoghq.com/mysql.logs: '[{"source": "mysql", "service": "mysql"}]'
  labels:
    name: mysql

ECS

Pour configurer ce check lorsque l’Agent est exécuté sur ECS :

Collecte de métriques

Définissez des modèles d’intégration Autodiscovery en tant qu’étiquettes Docker sur votre conteneur d’application :

{
  "containerDefinitions": [{
    "name": "mysql",
    "image": "mysql:latest",
    "dockerLabels": {
      "com.datadoghq.ad.check_names": "[\"mysql\"]",
      "com.datadoghq.ad.init_configs": "[{}]",
      "com.datadoghq.ad.instances": "[{\"server\": \"%%host%%\", \"user\": \"datadog\",\"password\": \"<MOT_DE_PASSE_UNIQUE>\"}]"
    }
  }]
}

Consultez la documentation relative aux template variables Autodiscovery pour découvrir comment utiliser <MOT_DE_PASSE_UNIQUE> en tant que variable d’environnement plutôt que sous forme d’étiquette.

Collecte de logs

Disponible à partir des versions > 6.0 de l’Agent

La collecte des logs est désactivée par défaut dans l’Agent Datadog. Pour l’activer, consultez la section Collecte de logs Amazon ECS.

Définissez ensuite des intégrations de logs en tant qu’étiquettes Docker :

{
  "containerDefinitions": [{
    "name": "mysql",
    "image": "mysql:latest",
    "dockerLabels": {
      "com.datadoghq.ad.logs": "[{\"source\":\"mysql\",\"service\":\"mysql\"}]"
    }
  }]
}

Validation

Lancez la sous-commande status de l’Agent et cherchez mysql dans la section Checks.

Données collectées

Métriques

mysql.binlog.cache_disk_use
(gauge)
The number of transactions that used the temporary binary log cache but that exceeded the value of binlog_cache_size and used a temporary file to store statements from the transaction.
Shown as transaction
mysql.binlog.cache_use
(gauge)
The number of transactions that used the binary log cache.
Shown as transaction
mysql.binlog.disk_use
(gauge)
Total binary log file size.
Shown as byte
mysql.galera.wsrep_cert_deps_distance
(gauge)
Shows the average distance between the lowest and highest sequence number, or seqno, values that the node can possibly apply in parallel.
mysql.galera.wsrep_cluster_size
(gauge)
The current number of nodes in the Galera cluster.
Shown as node
mysql.galera.wsrep_flow_control_paused
(gauge)
Shows the fraction of the time, since FLUSH STATUS was last called, that the node paused due to Flow Control.
Shown as fraction
mysql.galera.wsrep_flow_control_paused_ns
(count)
Shows the pause time due to Flow Control, in nanoseconds.
Shown as nanosecond
mysql.galera.wsrep_flow_control_recv
(count)
Shows the number of times the galera node has received a pausing Flow Control message from others
mysql.galera.wsrep_flow_control_sent
(count)
Shows the number of times the galera node has sent a pausing Flow Control message to others
mysql.galera.wsrep_local_cert_failures
(count)
Total number of local transactions that failed certification test.
mysql.galera.wsrep_local_recv_queue
(gauge)
Shows the current (instantaneous) size of the local received queue.
mysql.galera.wsrep_local_recv_queue_avg
(gauge)
Shows the average size of the local received queue since the last FLUSH STATUS query.
mysql.galera.wsrep_local_send_queue
(gauge)
Show the current (instantaneous) size of the send queue length since the last FLUSH STATUS query.
mysql.galera.wsrep_local_send_queue_avg
(gauge)
Show an average for the send queue length since the last FLUSH STATUS query.
mysql.galera.wsrep_local_state
(gauge)
Internal Galera cluster state number
mysql.galera.wsrep_received
(gauge)
Total number of write-sets received from other nodes.
mysql.galera.wsrep_received_bytes
(gauge)
Total size (in bytes) of writesets received from other nodes.
mysql.galera.wsrep_replicated_bytes
(gauge)
Total size (in bytes) of writesets sent to other nodes.
mysql.info.schema.size
(gauge)
Size of schemas in MiB
Shown as mebibyte
mysql.info.table.data_size
(gauge)
Size of tables data in MiB
Shown as mebibyte
mysql.info.table.index_size
(gauge)
Size of tables index in MiB
Shown as mebibyte
mysql.info.table.rows.changed
(count)
Total number of rows changed per table (Percona userstat only)
Shown as row
mysql.info.table.rows.read
(count)
Total number of rows read per table (Percona userstat only)
Shown as row
mysql.innodb.active_transactions
(gauge)
The number of active transactions on InnoDB tables.
Shown as operation
mysql.innodb.buffer_pool_data
(gauge)
The total number of bytes in the InnoDB buffer pool containing data. The number includes both dirty and clean pages.
Shown as byte
mysql.innodb.buffer_pool_dirty
(gauge)
The total current number of bytes held in dirty pages in the InnoDB buffer pool.
Shown as byte
mysql.innodb.buffer_pool_free
(gauge)
The number of free bytes in the InnoDB Buffer Pool.
Shown as byte
mysql.innodb.buffer_pool_pages_data
(gauge)
The number of pages in the InnoDB buffer pool containing data. The number includes both dirty and clean pages.
Shown as page
mysql.innodb.buffer_pool_pages_dirty
(gauge)
The current number of dirty pages in the InnoDB buffer pool.
Shown as page
mysql.innodb.buffer_pool_pages_flushed
(gauge)
The number of requests to flush pages from the InnoDB buffer pool.
Shown as page
mysql.innodb.buffer_pool_pages_free
(gauge)
The number of free pages in the InnoDB buffer pool.
Shown as page
mysql.innodb.buffer_pool_pages_total
(gauge)
The total size of the InnoDB buffer pool, in pages.
Shown as page
mysql.innodb.buffer_pool_read_ahead
(gauge)
The number of pages read into the InnoDB buffer pool by the read-ahead background thread.
Shown as page
mysql.innodb.buffer_pool_read_ahead_evicted
(gauge)
The number of pages read into the InnoDB buffer pool by the read-ahead background thread that were subsequently evicted without having been accessed by queries.
Shown as page
mysql.innodb.buffer_pool_read_ahead_rnd
(gauge)
The number of random read-aheads initiated by InnoDB. This happens when a query scans a large portion of a table but in random order.
Shown as operation
mysql.innodb.buffer_pool_read_requests
(gauge)
The number of logical read requests.
Shown as read
mysql.innodb.buffer_pool_reads
(gauge)
The number of logical reads that InnoDB could not satisfy from the buffer pool, and had to read directly from disk.
Shown as read
mysql.innodb.buffer_pool_total
(gauge)
The total number of bytes in the InnoDB Buffer Pool.
Shown as byte
mysql.innodb.buffer_pool_used
(gauge)
The number of used bytes in the InnoDB Buffer Pool.
Shown as byte
mysql.innodb.buffer_pool_utilization
(gauge)
The utilization of the InnoDB Buffer Pool.
Shown as fraction
mysql.innodb.buffer_pool_wait_free
(count)
When InnoDB needs to read or create a page and no clean pages are available, InnoDB flushes some dirty pages first and waits for that operation to finish. This counter counts instances of these waits.
Shown as wait
mysql.innodb.buffer_pool_write_requests
(gauge)
The number of writes done to the InnoDB buffer pool.
Shown as write
mysql.innodb.checkpoint_age
(gauge)
Checkpoint age as shown in the LOG section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.current_row_locks
(gauge)
The number of current row locks.
Shown as lock
mysql.innodb.current_transactions
(gauge)
Current InnoDB transactions
Shown as transaction
mysql.innodb.data_fsyncs
(gauge)
The number of fsync() operations per second.
Shown as operation
mysql.innodb.data_pending_fsyncs
(gauge)
The current number of pending fsync() operations.
Shown as operation
mysql.innodb.data_pending_reads
(gauge)
The current number of pending reads.
Shown as read
mysql.innodb.data_pending_writes
(gauge)
The current number of pending writes.
Shown as write
mysql.innodb.data_read
(gauge)
The amount of data read per second.
Shown as byte
mysql.innodb.data_reads
(gauge)
The rate of data reads.
Shown as read
mysql.innodb.data_writes
(gauge)
The rate of data writes.
Shown as write
mysql.innodb.data_written
(gauge)
The amount of data written per second.
Shown as byte
mysql.innodb.dblwr_pages_written
(gauge)
The number of pages written per second to the doublewrite buffer.
Shown as page
mysql.innodb.dblwr_writes
(gauge)
The number of doublewrite operations performed per second.
Shown as byte
mysql.innodb.deadlocks
(count)
The number of deadlocks.
Shown as lock
mysql.innodb.hash_index_cells_total
(gauge)
Total number of cells of the adaptive hash index
mysql.innodb.hash_index_cells_used
(gauge)
Number of used cells of the adaptive hash index
mysql.innodb.history_list_length
(gauge)
History list length as shown in the TRANSACTIONS section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.ibuf_free_list
(gauge)
Insert buffer free list, as shown in the INSERT BUFFER AND ADAPTIVE HASH INDEX section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.ibuf_merged
(gauge)
Insert buffer and adaptative hash index merged
Shown as operation
mysql.innodb.ibuf_merged_delete_marks
(gauge)
Insert buffer and adaptative hash index merged delete marks
Shown as operation
mysql.innodb.ibuf_merged_deletes
(gauge)
Insert buffer and adaptative hash index merged delete
Shown as operation
mysql.innodb.ibuf_merged_inserts
(gauge)
Insert buffer and adaptative hash index merged inserts
Shown as operation
mysql.innodb.ibuf_merges
(gauge)
Insert buffer and adaptative hash index merges
Shown as operation
mysql.innodb.ibuf_segment_size
(gauge)
Insert buffer segment size, as shown in the INSERT BUFFER AND ADAPTIVE HASH INDEX section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.ibuf_size
(gauge)
Insert buffer size, as shown in the INSERT BUFFER AND ADAPTIVE HASH INDEX section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.lock_structs
(gauge)
Lock structs
Shown as operation
mysql.innodb.locked_tables
(gauge)
Locked tables
Shown as operation
mysql.innodb.log_waits
(gauge)
The number of times that the log buffer was too small and a wait was required for it to be flushed before continuing.
Shown as wait
mysql.innodb.log_write_requests
(gauge)
The number of write requests for the InnoDB redo log.
Shown as write
mysql.innodb.log_writes
(gauge)
The number of physical writes to the InnoDB redo log file.
Shown as write
mysql.innodb.lsn_current
(gauge)
Log sequence number as shown in the LOG section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.lsn_flushed
(gauge)
Flushed up to log sequence number as shown in the LOG section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.lsn_last_checkpoint
(gauge)
Log sequence number last checkpoint as shown in the LOG section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.mem_adaptive_hash
(gauge)
As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.
Shown as byte
mysql.innodb.mem_additional_pool
(gauge)
As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output. Only available in MySQL 5.6.
Shown as byte
mysql.innodb.mem_dictionary
(gauge)
As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.
Shown as byte
mysql.innodb.mem_file_system
(gauge)
As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.mem_lock_system
(gauge)
As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.mem_page_hash
(gauge)
As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.mem_recovery_system
(gauge)
As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.mem_total
(gauge)
As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.
Shown as byte
mysql.innodb.mutex_os_waits
(gauge)
The rate of mutex OS waits. Only available in MySQL 5.6 and 5.7.
Shown as event
mysql.innodb.mutex_spin_rounds
(gauge)
The rate of mutex spin rounds. Only available in MySQL 5.6 and 5.7.
Shown as event
mysql.innodb.mutex_spin_waits
(gauge)
The rate of mutex spin waits. Only available in MySQL 5.6 and 5.7.
Shown as event
mysql.innodb.os_file_fsyncs
(gauge)
(Delta) The total number of fsync() operations performed by InnoDB.
Shown as operation
mysql.innodb.os_file_reads
(gauge)
(Delta) The total number of files reads performed by read threads within InnoDB.
Shown as operation
mysql.innodb.os_file_writes
(gauge)
(Delta) The total number of file writes performed by write threads within InnoDB.
Shown as operation
mysql.innodb.os_log_fsyncs
(gauge)
The rate of fsync writes to the log file.
Shown as write
mysql.innodb.os_log_pending_fsyncs
(gauge)
Number of pending InnoDB log fsync (sync-to-disk) requests.
Shown as operation
mysql.innodb.os_log_pending_writes
(gauge)
Number of pending InnoDB log writes.
Shown as write
mysql.innodb.os_log_written
(gauge)
Number of bytes written to the InnoDB log.
Shown as byte
mysql.innodb.pages_created
(gauge)
Number of InnoDB pages created.
Shown as page
mysql.innodb.pages_read
(gauge)
Number of InnoDB pages read.
Shown as page
mysql.innodb.pages_written
(gauge)
Number of InnoDB pages written.
Shown as page
mysql.innodb.pending_aio_log_ios
(gauge)
As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.pending_aio_sync_ios
(gauge)
As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.pending_buffer_pool_flushes
(gauge)
As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.
Shown as flush
mysql.innodb.pending_checkpoint_writes
(gauge)
As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.pending_ibuf_aio_reads
(gauge)
As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.pending_log_flushes
(gauge)
As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output. Only available in MySQL 5.6 and 5.7.
Shown as flush
mysql.innodb.pending_log_writes
(gauge)
As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output. Only available in MySQL 5.6 and 5.7.
Shown as write
mysql.innodb.pending_normal_aio_reads
(gauge)
As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.
Shown as read
mysql.innodb.pending_normal_aio_writes
(gauge)
As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.
Shown as write
mysql.innodb.queries_inside
(gauge)
As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.
Shown as query
mysql.innodb.queries_queued
(gauge)
As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.
Shown as query
mysql.innodb.read_views
(gauge)
As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.row_lock_current_waits
(gauge)
The number of row locks currently being waited for by operations on InnoDB tables.
mysql.innodb.row_lock_time
(gauge)
Fraction of time spent (ms/s) acquiring row locks.
Shown as fraction
mysql.innodb.row_lock_waits
(gauge)
The number of times per second a row lock had to be waited for.
Shown as event
mysql.innodb.rows_deleted
(gauge)
Number of rows deleted from InnoDB tables.
Shown as row
mysql.innodb.rows_inserted
(gauge)
Number of rows inserted into InnoDB tables.
Shown as row
mysql.innodb.rows_read
(gauge)
Number of rows read from InnoDB tables.
Shown as row
mysql.innodb.rows_updated
(gauge)
Number of rows updated in InnoDB tables.
Shown as row
mysql.innodb.s_lock_os_waits
(gauge)
As shown in the SEMAPHORES section of the SHOW ENGINE INNODB STATUS output
mysql.innodb.s_lock_spin_rounds
(gauge)
As shown in the SEMAPHORES section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.s_lock_spin_waits
(gauge)
As shown in the SEMAPHORES section of the SHOW ENGINE INNODB STATUS output.
Shown as wait
mysql.innodb.semaphore_wait_time
(gauge)
Semaphore wait time
mysql.innodb.semaphore_waits
(gauge)
The number semaphore currently being waited for by operations on InnoDB tables.
mysql.innodb.tables_in_use
(gauge)
Tables in use
Shown as operation
mysql.innodb.x_lock_os_waits
(gauge)
As shown in the SEMAPHORES section of the SHOW ENGINE INNODB STATUS output.
Shown as wait
mysql.innodb.x_lock_spin_rounds
(gauge)
As shown in the SEMAPHORES section of the SHOW ENGINE INNODB STATUS output.
mysql.innodb.x_lock_spin_waits
(gauge)
As shown in the SEMAPHORES section of the SHOW ENGINE INNODB STATUS output.
Shown as wait
mysql.myisam.key_buffer_bytes_unflushed
(gauge)
MyISAM key buffer bytes unflushed.
Shown as byte
mysql.myisam.key_buffer_bytes_used
(gauge)
MyISAM key buffer bytes used.
Shown as byte
mysql.myisam.key_buffer_size
(gauge)
Size of the buffer used for index blocks.
Shown as byte
mysql.myisam.key_read_requests
(gauge)
The number of requests to read a key block from the MyISAM key cache.
Shown as read
mysql.myisam.key_reads
(gauge)
The number of physical reads of a key block from disk into the MyISAM key cache. If key_reads is large, then your keybuffersize value is probably too small. The cache miss rate can be calculated as key_reads/key_read_requests.
Shown as read
mysql.myisam.key_write_requests
(gauge)
The number of requests to write a key block to the MyISAM key cache.
Shown as write
mysql.myisam.key_writes
(gauge)
The number of physical writes of a key block from the MyISAM key cache to disk.
Shown as write
mysql.net.aborted_clients
(gauge)
The number of connections that were aborted because the client died without closing the connection properly.
Shown as connection
mysql.net.aborted_connects
(gauge)
The number of failed attempts to connect to the MySQL server.
Shown as connection
mysql.net.connections
(gauge)
The rate of connections to the server.
Shown as connection
mysql.net.max_connections
(gauge)
The maximum number of connections that have been in use simultaneously since the server started.
Shown as connection
mysql.net.max_connections_available
(gauge)
The maximum permitted number of simultaneous client connections.
Shown as connection
mysql.performance.bytes_received
(gauge)
The number of bytes received from all clients.
Shown as byte
mysql.performance.bytes_sent
(gauge)
The number of bytes sent to all clients.
Shown as byte
mysql.performance.com_delete
(gauge)
The rate of delete statements.
Shown as query
mysql.performance.com_delete_multi
(gauge)
The rate of delete-multi statements.
Shown as query
mysql.performance.com_insert
(gauge)
The rate of insert statements.
Shown as query
mysql.performance.com_insert_select
(gauge)
The rate of insert-select statements.
Shown as query
mysql.performance.com_load
(gauge)
The rate of load statements.
Shown as query
mysql.performance.com_replace
(gauge)
The rate of replace statements.
Shown as query
mysql.performance.com_replace_select
(gauge)
The rate of replace-select statements.
Shown as query
mysql.performance.com_select
(gauge)
The rate of select statements.
Shown as query
mysql.performance.com_update
(gauge)
The rate of update statements.
Shown as query
mysql.performance.com_update_multi
(gauge)
The rate of update-multi.
Shown as query
mysql.performance.cpu_time
(gauge)
Percentage of CPU time spent by MySQL.
Shown as percent
mysql.performance.created_tmp_disk_tables
(gauge)
The rate of internal on-disk temporary tables created by second by the server while executing statements.
Shown as table
mysql.performance.created_tmp_files
(gauge)
The rate of temporary files created by second.
Shown as file
mysql.performance.created_tmp_tables
(gauge)
The rate of internal temporary tables created by second by the server while executing statements.
Shown as table
mysql.performance.digest_95th_percentile.avg_us
(gauge)
Query response time 95th percentile per schema.
Shown as microsecond
mysql.performance.handler_commit
(gauge)
The number of internal COMMIT statements.
Shown as operation
mysql.performance.handler_delete
(gauge)
The number of internal DELETE statements.
Shown as operation
mysql.performance.handler_prepare
(gauge)
The number of internal PREPARE statements.
Shown as operation
mysql.performance.handler_read_first
(gauge)
The number of internal READ_FIRST statements.
Shown as operation
mysql.performance.handler_read_key
(gauge)
The number of internal READ_KEY statements.
Shown as operation
mysql.performance.handler_read_next
(gauge)
The number of internal READ_NEXT statements.
Shown as operation
mysql.performance.handler_read_prev
(gauge)
The number of internal READ_PREV statements.
Shown as operation
mysql.performance.handler_read_rnd
(gauge)
The number of internal READ_RND statements.
Shown as operation
mysql.performance.handler_read_rnd_next
(gauge)
The number of internal READRNDNEXT statements.
Shown as operation
mysql.performance.handler_rollback
(gauge)
The number of internal ROLLBACK statements.
Shown as operation
mysql.performance.handler_update
(gauge)
The number of internal UPDATE statements.
Shown as operation
mysql.performance.handler_write
(gauge)
The number of internal WRITE statements.
Shown as operation
mysql.performance.kernel_time
(gauge)
Percentage of CPU time spent in kernel space by MySQL.
Shown as percent
mysql.performance.key_cache_utilization
(gauge)
The key cache utilization ratio.
Shown as fraction
mysql.performance.max_prepared_stmt_count
(gauge)
The maximum allowed prepared statements on the server.
mysql.performance.open_files
(gauge)
The number of open files.
Shown as file
mysql.performance.open_tables
(gauge)
The number of of tables that are open.
Shown as table
mysql.performance.opened_tables
(gauge)
The number of tables that have been opened. If opened_tables is big, your table_open_cache value is probably too small.
Shown as table
mysql.performance.prepared_stmt_count
(gauge)
The current number of prepared statements.
Shown as query
mysql.performance.qcache.utilization
(gauge)
Fraction of the query cache memory currently being used.
Shown as fraction
mysql.performance.qcache_free_blocks
(gauge)
The number of free memory blocks in the query cache.
Shown as block
mysql.performance.qcache_free_memory
(gauge)
The amount of free memory for the query cache.
Shown as byte
mysql.performance.qcache_hits
(gauge)
The rate of query cache hits.
Shown as hit
mysql.performance.qcache_inserts
(gauge)
The number of queries added to the query cache.
Shown as query
mysql.performance.qcache_lowmem_prunes
(gauge)
The number of queries that were deleted from the query cache because of low memory.
Shown as query
mysql.performance.qcache_not_cached
(gauge)
The number of noncached queries (not cacheable, or not cached due to the query_cache_type setting).
Shown as query
mysql.performance.qcache_queries_in_cache
(gauge)
The number of queries registered in the query cache.
Shown as query
mysql.performance.qcache_size
(gauge)
The amount of memory allocated for caching query results.
Shown as byte
mysql.performance.qcache_total_blocks
(gauge)
The total number of blocks in the query cache.
Shown as block
mysql.performance.queries
(gauge)
The rate of queries.
Shown as query
mysql.performance.query_run_time.avg
(gauge)
Avg query response time per schema.
Shown as microsecond
mysql.performance.questions
(gauge)
The rate of statements executed by the server.
Shown as query
mysql.performance.select_full_join
(gauge)
The number of joins that perform table scans because they do not use indexes. If this value is not 0, you should carefully check the indexes of your tables.
Shown as operation
mysql.performance.select_full_range_join
(gauge)
The number of joins that used a range search on a reference table.
Shown as operation
mysql.performance.select_range
(gauge)
The number of joins that used ranges on the first table. This is normally not a critical issue even if the value is quite large.
Shown as operation
mysql.performance.select_range_check
(gauge)
The number of joins without keys that check for key usage after each row. If this is not 0, you should carefully check the indexes of your tables.
Shown as operation
mysql.performance.select_scan
(gauge)
The number of joins that did a full scan of the first table.
Shown as operation
mysql.performance.slow_queries
(gauge)
The rate of slow queries (log queries that exceed a particular execution time).
Shown as query
mysql.performance.sort_merge_passes
(gauge)
The number of merge passes that the sort algorithm has had to do. If this value is large, you should consider increasing the value of the sort_buffer_size system variable.
Shown as operation
mysql.performance.sort_range
(gauge)
The number of sorts that were done using ranges.
Shown as operation
mysql.performance.sort_rows
(gauge)
The number of sorted rows.
Shown as operation
mysql.performance.sort_scan
(gauge)
The number of sorts that were done by scanning the table.
Shown as operation
mysql.performance.table_cache_hits
(gauge)
The number of hits for open tables cache lookups.
Shown as hit
mysql.performance.table_cache_misses
(gauge)
The number of misses for open tables cache lookups.
Shown as miss
mysql.performance.table_locks_immediate
(gauge)
The number of times that a request for a table lock could be granted immediately.
mysql.performance.table_locks_immediate.rate
(gauge)
The rate of times that a request for a table lock could be granted immediately.
mysql.performance.table_locks_waited
(gauge)
The total number of times that a request for a table lock could not be granted immediately and a wait was needed.
mysql.performance.table_locks_waited.rate
(gauge)
The rate of times that a request for a table lock could not be granted immediately and a wait was needed.
mysql.performance.table_open_cache
(gauge)
The number of open tables for all threads. Increasing this value increases the number of file descriptors that mysqld requires.
mysql.performance.thread_cache_size
(gauge)
How many threads the server should cache for reuse. When a client disconnects, the client's threads are put in the cache if there are fewer than thread_cache_size threads there.
Shown as byte
mysql.performance.threads_cached
(gauge)
The number of threads in the thread cache.
Shown as thread
mysql.performance.threads_connected
(gauge)
The number of currently open connections.
Shown as connection
mysql.performance.threads_created
(count)
The number of threads created to handle connections. If threads_created is big, you may want to increase the thread_cache_size value.
Shown as thread
mysql.performance.threads_running
(gauge)
The number of threads that are not sleeping.
Shown as thread
mysql.performance.user_connections
(gauge)
The number of user connections. Tags: processlist_db, processlist_host, processlist_state, processlist_user
Shown as connection
mysql.performance.user_time
(gauge)
Percentage of CPU time spent in user space by MySQL.
Shown as percent
mysql.queries.count
(count)
The total count of executed queries per normalized query and schema. (DBM only)
Shown as query
mysql.queries.errors
(count)
The total count of queries run with an error per normalized query and schema. (DBM only)
Shown as error
mysql.queries.lock_time
(count)
The total time spent waiting on locks per normalized query and schema. (DBM only)
Shown as nanosecond
mysql.queries.no_good_index_used
(count)
The total count of queries which used a sub-optimal index per normalized query and schema. (DBM only)
Shown as query
mysql.queries.no_index_used
(count)
The total count of queries which do not use an index per normalized query and schema. (DBM only)
Shown as query
mysql.queries.rows_affected
(count)
The number of rows mutated per normalized query and schema. (DBM only)
Shown as row
mysql.queries.rows_examined
(count)
The number of rows examined per normalized query and schema. (DBM only)
Shown as row
mysql.queries.rows_sent
(count)
The number of rows sent per normalized query and schema. (DBM only)
Shown as row
mysql.queries.select_full_join
(count)
The total count of full table scans on a joined table per normalized query and schema. (DBM only)
mysql.queries.select_scan
(count)
The total count of full table scans on the first table per normalized query and schema. (DBM only)
mysql.queries.time
(count)
The total query execution time per normalized query and schema. (DBM only)
Shown as nanosecond
mysql.replication.group.conflicts_detected
(gauge)
The number of transactions that have not passed the conflict detection check.
Shown as transaction
mysql.replication.group.member_status
(gauge)
Information about the node status in a group replication environment, always equal to 1.
mysql.replication.group.transactions
(gauge)
The number of transactions in the queue pending conflict detection checks.
Shown as transaction
mysql.replication.group.transactions_applied
(gauge)
Number of transactions this member has received from the group and applied.
Shown as transaction
mysql.replication.group.transactions_check
(gauge)
The number of transactions that have been checked for conflicts.
Shown as transaction
mysql.replication.group.transactions_in_applier_queue
(gauge)
The number of transactions that this member has received from the replication group which are waiting to be applied.
Shown as transaction
mysql.replication.group.transactions_proposed
(gauge)
The number of transactions which originated on this member and were sent to the group.
Shown as transaction
mysql.replication.group.transactions_rollback
(gauge)
The number of transactions which originated on this member and were rolled back by the group.
Shown as transaction
mysql.replication.group.transactions_validating
(gauge)
The number of transaction rows which can be used for certification, but have not been garbage collected.
Shown as transaction
mysql.replication.replicas_connected
(gauge)
Number of replicas connected to a replication source.
mysql.replication.seconds_behind_master
(gauge)
The lag in seconds between the master and the slave.
Shown as second
mysql.replication.seconds_behind_source
(gauge)
The lag in seconds between the source and the replica.
Shown as second
mysql.replication.slave_running
(gauge)
Deprecated. Use service check mysql.replication.replica_running instead. A boolean showing if this server is a replication slave / master that is running.
mysql.replication.slaves_connected
(gauge)
Deprecated. Use mysql.replication.replicas_connected instead. Number of slaves connected to a replication master.

Par défaut, le check ne recueille pas toutes les métriques. Définissez les options de configuration booléennes suivantes sur true pour activer les métriques correspondantes :

extra_status_metrics ajoute les métriques suivantes :

Nom de la métriqueType de la métrique
mysql.binlog.cache_disk_useGAUGE
mysql.binlog.cache_useGAUGE
mysql.performance.handler_commitRATE
mysql.performance.handler_deleteRATE
mysql.performance.handler_prepareRATE
mysql.performance.handler_read_firstRATE
mysql.performance.handler_read_keyRATE
mysql.performance.handler_read_nextRATE
mysql.performance.handler_read_prevRATE
mysql.performance.handler_read_rndRATE
mysql.performance.handler_read_rnd_nextRATE
mysql.performance.handler_rollbackRATE
mysql.performance.handler_updateRATE
mysql.performance.handler_writeRATE
mysql.performance.opened_tablesRATE
mysql.performance.qcache_total_blocksGAUGE
mysql.performance.qcache_free_blocksGAUGE
mysql.performance.qcache_free_memoryGAUGE
mysql.performance.qcache_not_cachedRATE
mysql.performance.qcache_queries_in_cacheGAUGE
mysql.performance.select_full_joinRATE
mysql.performance.select_full_range_joinRATE
mysql.performance.select_rangeRATE
mysql.performance.select_range_checkRATE
mysql.performance.select_scanRATE
mysql.performance.sort_merge_passesRATE
mysql.performance.sort_rangeRATE
mysql.performance.sort_rowsRATE
mysql.performance.sort_scanRATE
mysql.performance.table_locks_immediateGAUGE
mysql.performance.table_locks_immediate.rateRATE
mysql.performance.threads_cachedGAUGE
mysql.performance.threads_createdMONOTONIC

extra_innodb_metrics ajoute les métriques suivantes :

Nom de la métriqueType de la métrique
mysql.innodb.active_transactionsGAUGE
mysql.innodb.buffer_pool_dataGAUGE
mysql.innodb.buffer_pool_pages_dataGAUGE
mysql.innodb.buffer_pool_pages_dirtyGAUGE
mysql.innodb.buffer_pool_pages_flushedRATE
mysql.innodb.buffer_pool_pages_freeGAUGE
mysql.innodb.buffer_pool_pages_totalGAUGE
mysql.innodb.buffer_pool_read_aheadRATE
mysql.innodb.buffer_pool_read_ahead_evictedRATE
mysql.innodb.buffer_pool_read_ahead_rndGAUGE
mysql.innodb.buffer_pool_wait_freeMONOTONIC
mysql.innodb.buffer_pool_write_requestsRATE
mysql.innodb.checkpoint_ageGAUGE
mysql.innodb.current_transactionsGAUGE
mysql.innodb.data_fsyncsRATE
mysql.innodb.data_pending_fsyncsGAUGE
mysql.innodb.data_pending_readsGAUGE
mysql.innodb.data_pending_writesGAUGE
mysql.innodb.data_readRATE
mysql.innodb.data_writtenRATE
mysql.innodb.dblwr_pages_writtenRATE
mysql.innodb.dblwr_writesRATE
mysql.innodb.hash_index_cells_totalGAUGE
mysql.innodb.hash_index_cells_usedGAUGE
mysql.innodb.history_list_lengthGAUGE
mysql.innodb.ibuf_free_listGAUGE
mysql.innodb.ibuf_mergedRATE
mysql.innodb.ibuf_merged_delete_marksRATE
mysql.innodb.ibuf_merged_deletesRATE
mysql.innodb.ibuf_merged_insertsRATE
mysql.innodb.ibuf_mergesRATE
mysql.innodb.ibuf_segment_sizeGAUGE
mysql.innodb.ibuf_sizeGAUGE
mysql.innodb.lock_structsRATE
mysql.innodb.locked_tablesGAUGE
mysql.innodb.locked_transactionsGAUGE
mysql.innodb.log_waitsRATE
mysql.innodb.log_write_requestsRATE
mysql.innodb.log_writesRATE
mysql.innodb.lsn_currentRATE
mysql.innodb.lsn_flushedRATE
mysql.innodb.lsn_last_checkpointRATE
mysql.innodb.mem_adaptive_hashGAUGE
mysql.innodb.mem_additional_poolGAUGE
mysql.innodb.mem_dictionaryGAUGE
mysql.innodb.mem_file_systemGAUGE
mysql.innodb.mem_lock_systemGAUGE
mysql.innodb.mem_page_hashGAUGE
mysql.innodb.mem_recovery_systemGAUGE
mysql.innodb.mem_thread_hashGAUGE
mysql.innodb.mem_totalGAUGE
mysql.innodb.os_file_fsyncsRATE
mysql.innodb.os_file_readsRATE
mysql.innodb.os_file_writesRATE
mysql.innodb.os_log_pending_fsyncsGAUGE
mysql.innodb.os_log_pending_writesGAUGE
mysql.innodb.os_log_writtenRATE
mysql.innodb.pages_createdRATE
mysql.innodb.pages_readRATE
mysql.innodb.pages_writtenRATE
mysql.innodb.pending_aio_log_iosGAUGE
mysql.innodb.pending_aio_sync_iosGAUGE
mysql.innodb.pending_buffer_pool_flushesGAUGE
mysql.innodb.pending_checkpoint_writesGAUGE
mysql.innodb.pending_ibuf_aio_readsGAUGE
mysql.innodb.pending_log_flushesGAUGE
mysql.innodb.pending_log_writesGAUGE
mysql.innodb.pending_normal_aio_readsGAUGE
mysql.innodb.pending_normal_aio_writesGAUGE
mysql.innodb.queries_insideGAUGE
mysql.innodb.queries_queuedGAUGE
mysql.innodb.read_viewsGAUGE
mysql.innodb.rows_deletedRATE
mysql.innodb.rows_insertedRATE
mysql.innodb.rows_readRATE
mysql.innodb.rows_updatedRATE
mysql.innodb.s_lock_os_waitsRATE
mysql.innodb.s_lock_spin_roundsRATE
mysql.innodb.s_lock_spin_waitsRATE
mysql.innodb.semaphore_wait_timeGAUGE
mysql.innodb.semaphore_waitsGAUGE
mysql.innodb.tables_in_useGAUGE
mysql.innodb.x_lock_os_waitsRATE
mysql.innodb.x_lock_spin_roundsRATE
mysql.innodb.x_lock_spin_waitsRATE

extra_performance_metrics ajoute les métriques suivantes :

Nom de la métriqueType de la métrique
mysql.performance.query_run_time.avgGAUGE
mysql.performance.digest_95th_percentile.avg_usGAUGE

schema_size_metrics ajoute la métrique suivante :

Nom de la métriqueType de la métrique
mysql.info.schema.sizeGAUGE

Événements

Le check MySQL n’inclut aucun événement.

Checks de service

mysql.can_connect
Renvoie CRITICAL si l’Agent n’est pas capable de se connecter à l’instance MySQL qu’il surveille. Si ce n’est pas le cas, renvoie OK.
Statuses: ok, critical

Dépannage

Pour aller plus loin

Documentation, liens et articles supplémentaires utiles :

PREVIEWING: rtrieu/product-analytics-ui-changes